Adding unprefixed pointer support, fixing #69
This commit is contained in:
Родитель
8e2d42a003
Коммит
d8997de9d2
|
@ -442,8 +442,25 @@
|
|||
addParticles();
|
||||
|
||||
// Determine correct events to register for
|
||||
if (navigator.msPointerEnabled) {
|
||||
if (navigator.pointerEnabled) {
|
||||
// Pointers supported
|
||||
downevent = 'pointerdown';
|
||||
upevent = 'pointerup';
|
||||
moveevent = 'pointermove';
|
||||
document.addEventListener('pointercancel', function (e) {
|
||||
removeTouchPoint(e);
|
||||
}, false);
|
||||
document.addEventListener('MSGestureInit', function (e) {
|
||||
if (e.preventManipulation) {
|
||||
e.preventManipulation();
|
||||
}
|
||||
}, false);
|
||||
document.addEventListener('MSHoldVisual', function (e) {
|
||||
e.preventDefault();
|
||||
}, false);
|
||||
}
|
||||
else if (navigator.msPointerEnabled) {
|
||||
// MSPointers supported
|
||||
downevent = 'MSPointerDown';
|
||||
upevent = 'MSPointerUp';
|
||||
moveevent = 'MSPointerMove';
|
||||
|
@ -458,7 +475,8 @@
|
|||
document.addEventListener('MSHoldVisual', function (e) {
|
||||
e.preventDefault();
|
||||
}, false);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Pointers not supported. Defaulting to mouse events
|
||||
downevent = 'mousedown';
|
||||
upevent = 'mouseup';
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
#canvas {
|
||||
background-color: #000;
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
|
|
Загрузка…
Ссылка в новой задаче