Files
Testing/videocall3/Canvas-Designer/dev/eraser-handler.js
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

44 lines
1.0 KiB
JavaScript

var eraserHandler = {
ismousedown: false,
prevX: 0,
prevY: 0,
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;
tempContext.lineCap = 'round';
drawHelper.line(tempContext, [t.prevX, t.prevY, x, y]);
points[points.length] = ['line', [t.prevX, t.prevY, x, y], drawHelper.getOptions()];
t.prevX = x;
t.prevY = y;
},
mouseup: function(e) {
this.ismousedown = false;
},
mousemove: function(e) {
var x = e.pageX - canvas.offsetLeft,
y = e.pageY - canvas.offsetTop;
var t = this;
if (t.ismousedown) {
tempContext.lineCap = 'round';
drawHelper.line(tempContext, [t.prevX, t.prevY, x, y]);
points[points.length] = ['line', [t.prevX, t.prevY, x, y], drawHelper.getOptions()];
t.prevX = x;
t.prevY = y;
}
}
};