| 805 | } |
| 806 | |
| 807 | function handlePointerDown(e, layerdict) { |
| 808 | if (e.button != 0 && e.button != 1) { |
| 809 | return; |
| 810 | } |
| 811 | e.preventDefault(); |
| 812 | e.stopPropagation(); |
| 813 | |
| 814 | if (!e.hasOwnProperty("offsetX")) { |
| 815 | // The polyfill doesn't set this properly |
| 816 | e.offsetX = e.pageX - e.currentTarget.offsetLeft; |
| 817 | e.offsetY = e.pageY - e.currentTarget.offsetTop; |
| 818 | } |
| 819 | |
| 820 | layerdict.pointerStates[e.pointerId] = { |
| 821 | distanceTravelled: 0, |
| 822 | lastX: e.offsetX, |
| 823 | lastY: e.offsetY, |
| 824 | downTime: Date.now(), |
| 825 | }; |
| 826 | } |
| 827 | |
| 828 | function handleMouseClick(e, layerdict) { |
| 829 | if (!e.hasOwnProperty("offsetX")) { |