Adding unprefixed pointer support, fixing #69

This commit is contained in:
Matt Rakow 2015-06-09 17:33:05 -07:00
Родитель 8e2d42a003
Коммит d8997de9d2
2 изменённых файлов: 21 добавлений и 2 удалений

Просмотреть файл

@ -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%;