Files
Testing/videocall1/Canvas-Designer/dev/arrow-handler.js
sean 0e8a8b3028
Some checks failed
deploy-testing / deploy (push) Has been cancelled
Initial testing snapshot
2026-11-17 16:15:01 -05:00

41 lines
959 B
JavaScript

var arrowHandler = {
ismousedown: false,
prevX: 0,
prevY: 0,
arrowSize: 10,
mousedown: function(e) {
var x = e.pageX - canvas.offsetLeft,
y = e.pageY - canvas.offsetTop;
var t = this;
t.prevX = x;
t.prevY = y;
t.ismousedown = true;
},
mouseup: function(e) {
var x = e.pageX - canvas.offsetLeft,
y = e.pageY - canvas.offsetTop;
var t = this;
if (t.ismousedown) {
points[points.length] = ['arrow', [t.prevX, t.prevY, x, y], drawHelper.getOptions()];
t.ismousedown = false;
}
},
mousemove: function(e) {
var x = e.pageX - canvas.offsetLeft,
y = e.pageY - canvas.offsetTop;
var t = this;
if (t.ismousedown) {
tempContext.clearRect(0, 0, innerWidth, innerHeight);
drawHelper.arrow(tempContext, [t.prevX, t.prevY, x, y]);
}
}
};