Input data cannot be processed in the non-chronological order - Error being thrown from WinRT

1

I am currently using the below code for detecting gestures

var inputManager = (function () {
    var that = {};
    var gr;
    var canvas;
    var manipulating = false;


    that.manipulationHandler = function (evt) {
        if (evt.delta) {
            //
        }
    };

    that.isManipulating = function () {
        return manipulating;
    };

    that.processDown = function (evt) {
        gr.processDownEvent(evt.currentPoint);
    };

    that.processMove = function (evt) {
        gr.processMoveEvents(evt.intermediatePoints);
    };

    that.processUp = function (evt) {
        gr.processUpEvent(evt.currentPoint);
    };

    that.processMouse = function (evt) {
        gr.processMouseWheelEvent(evt.currentPoint, evt.shiftKey, evt.ctrlKey);
    };

    // The following functions are registered to handle GestureRecognizer gesture events
    that.manipulationStartedHandler = function (evt) {
        manipulating = true;
        that.manipulationHandler(evt);
    };

    that.manipulationDeltaHandler = function (evt) {
        that.manipulationHandler(evt);
    };

    that.manipulationEndHandler = function (evt) {
        manipulating = false;
        that.manipulationHandler(evt);
    };

    that.tappedHandler = function (evt) {
    };

    that.initialize = function () {

        gr = new Windows.UI.Input.GestureRecognizer();

        gr.gestureSettings =
            Windows.UI.Input.GestureSettings.manipulationRotate |
            Windows.UI.Input.GestureSettings.manipulationTranslateX |
            Windows.UI.Input.GestureSettings.manipulationTranslateY |
            Windows.UI.Input.GestureSettings.manipulationScale |
            Windows.UI.Input.GestureSettings.manipulationRotateInertia |
            Windows.UI.Input.GestureSettings.manipulationScaleInertia |
            Windows.UI.Input.GestureSettings.manipulationTranslateInertia |
            Windows.UI.Input.GestureSettings.tap;

        // Turn off UI feedback for gestures (we'll still see UI feedback for PointerPoints)
        gr.showGestureFeedback = true;

        // Register event listeners for the gestures that we just configured
        gr.addEventListener('manipulationstarted', that.manipulationStartedHandler);
        gr.addEventListener('manipulationupdated', that.manipulationDeltaHandler);
        gr.addEventListener('manipulationcompleted', that.manipulationEndHandler);
        gr.addEventListener('tapped', that.tappedHandler);

        canvas = document.getElementById("canvas");

        // Register event listeners for DOM pointer events, these are the
        // raw touch events we will be using to feed the gestureRecognizer
        canvas.addEventListener('MSPointerDown', that.processDown, false);
        canvas.addEventListener('MSPointerMove', that.processMove, false);
        canvas.addEventListener('MSPointerUp', that.processUp, false);
        canvas.addEventListener('MSPointerCancel', that.processUp, false);
        canvas.addEventListener('wheel', that.processMouse, false);
    };

    return that;
})();

But I was getting the error

0x80400000 - JavaScript runtime error: Input data cannot be processed in the non-chronological order.

WinRT information: Input data cannot be processed in the non-chronological order.

thrown in the processMove function when you tapped away like crazy on the device. The device I am using is a multi touch tablet. Adding try catch blocks around each of the functions seemed to fix it.

that.processDown = function (evt) {
        try { 
            gr.processDownEvent(evt.currentPoint);
        } catch (e) { }
    };

    that.processMove = function (evt) {

        try {
            gr.processMoveEvents(evt.intermediatePoints);

        } catch (e) { }
    };

    that.processUp = function (evt) {
        try {
            gr.processUpEvent(evt.currentPoint);
        } catch (e) { }
    };

Is this the correct/best approach to detecting gestures on a multi touch device and for handling the error that was been thrown?

javascript
windows-8
windows-runtime
uigesturerecognizer
multi-touch
asked on Stack Overflow May 14, 2013 by Tom

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0