0
イメージをキャンバス上に描画し、その座標を使用しています。例えば;イメージをキャンバスにサイズ変更して再配置するサイズ変更
var data = {
x: 100, y: 100, // the coord when the image drawn
src: imguri,
scale: 1.6 // the scale when the image drawn
}
以下のようなズーム機能。私はキャンバスのサイズが変更されたとき、それは/アウトでズームされているように見えるように画像のサイズを変更して再位置はどうすればよい
var scale = 1.6, width = canvas.width, height = canvas.height
function zoom(positiveOrNegative) {
scale += positiveOrNegative * .2
canvas.width = width * scale
canvas.height = height * scale
loadImage()
}
function loadImage() {
var img = new Image()
img.src = data.src;
img.onload = function() { context.drawImage(img, data.x, data.y) }
}
https://jsfiddle.net/bbuv53u6/
?