3
I would like to create a zoom function inside a js extension file, I already have a canvas function, however in my drawing is coming out very small depending on the initial coordinates, so I would like something that when needed I could zoom in on the figure. My canvas function is:
function fcanvas(){
var scale = 1;
var originx = 0;
var originy = 0;
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.strokeStyle = '#000000';
ctx.lineWidth = 2;
ctx.font='20px Arial';
ctx.beginPath();
ctx.moveTo(500,250)
ctx.lineTo(500,250-(aa));
ctx.lineTo(500-(-bb),250 );
ctx.lineTo(500,250);
ctx.font='12px Arial';
ctx.fillText("Tela 1000x500",20,20);
ctx.stroke();
}
I would like something easy, or something that is very detailed, because I’m starting to learn how to program and I don’t know many tags yet.
You want the
canvas
continue of the same size, only what is drawn on it increases in scale, or wants itself tocanvas
grow together with everything inside it (without you needing to change the way you draw it)? Both possibilities exist, it just wasn’t clear to me what you intend.– mgibsonbr
I want only what is drawn on the canvas to increase, leaving it the same size
– Isabela