Space Between Touch Points on IE10

I am working on a flot.touch.js plugin that adds touch interactivity (pan and zoom) to a diagram for webkit browsers. I want it to work on IE10 too, but I don’t know how to get the space between my touches (I need this to calculate the scale).

In webkit browsers, we can do this using the following variables:

evt.originalEvent.touches[0].pageX
evt.originalEvent.touches[0].pagey
evt.originalEvent.touches[1].pageX
evt.originalEvent.touches[1].pageY
+5
source share
3 answers

IE . iOS ( ), "" . , .

pointerId, . , , . :

var pointers = {};
function pointerDown(evt) {
    if (evt.preventManipulation)
        evt.preventManipulation();

    pointers[evt.pointerId] = [evt.PageX, evt.PageY];

    for (var k in pointers) {
        // loop over your other active pointers
    }
}
function pointerUp(evt) {
    delete pointers[evt.pointerId];
}

:

+4

. , , ( x y, )

: http://ie.microsoft.com/testdrive/Graphics/TouchEffects/, F12 Script: http://ie.microsoft.com/testdrive/Graphics/TouchEffects/Demo.js

:

function addTouchPoint(e) {
    if(touchCount == 0) {
        document.addEventListener(moveevent, moveTouchPoint, false);
    }

    var pID = e.pointerId || 0;
    if(!touchPoints[pID]) {
        touchCount++;
        touchPoints[pID] = {x : e.clientX, y : e.clientY};
    }
}

,

+4

Windows 8, IE10 MSGesture. iOS. , , MSPointer MSPointerDown. :

var myGesture = new MSGesture();
var myElement = document.getElementById("MyCanvas");
myGesture.target = myElement;  //sets target
myElement.addEventListener("MSPointerDown", function (event){
   redGesture.addPointer(evt.pointerId);  // adds pointer to the MSGesture object
}, false);  

Here you can add an event listener for the MSGestureChange function to handle the event.scale property. Note: if the target is not set, an InvalidStateError exception will occur.

+1
source

All Articles