mirror of
https://github.com/lovasoa/whitebophir
synced 2024-11-10 14:34:20 +00:00
Fix the erasing tool on touchscreens
This commit is contained in:
parent
9e1742f735
commit
c7cb8fb989
1 changed files with 10 additions and 3 deletions
|
@ -40,9 +40,16 @@
|
|||
"id": ""
|
||||
};
|
||||
function erase(x, y, evt) {
|
||||
/*evt.target is the element over which the mouse is.*/
|
||||
if (erasing && evt.target !== Tools.svg) {
|
||||
msg.id = evt.target.id;
|
||||
// evt.target should be the element over which the mouse is...
|
||||
var target = evt.target;
|
||||
if (evt.type === "touchmove") {
|
||||
// ... the target of touchmove events is the element that was initially touched,
|
||||
// not the one **currently** being touched
|
||||
var touch = evt.touches[0];
|
||||
target = document.elementFromPoint(touch.clientX, touch.clientY);
|
||||
}
|
||||
if (erasing && target !== Tools.svg) {
|
||||
msg.id = target.id;
|
||||
Tools.drawAndSend(msg);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue