Мне удалось успешно нарисовать изображение на холсте HTML. Но мне нужно иметь возможность перетаскивать изображение на холст.
Я знаю, что эта функция может быть легко реализована некоторыми библиотеками JavaScript, такими как KinectJS. Но я хочу просто сделать это с помощью простого JavaScript.
window.onload = function(){
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
var destX = 0;
var destY = 0;
var imageObj = new Image();
imageObj.onload = function(){
context.drawImage(imageObj, destX, destY);
};
imageObj.src = "westeros.png";
<canvas id="myCanvas" height=1024 width=360></canvas>