function handleMouseDown(event) {
        mouseDown = true;
        lastMouseX = event.clientX;
        lastMouseY = event.clientY;
        startX = event.clientX;
        startY = event.clientY;

        //get coordinates within canvas (with the right orientation)
        var r = viewer._canvas.getBoundingClientRect();
        var viewX = startX - r.left;
        var viewY = viewer._height - (startY - r.top);

        //this is for picking
        id = viewer._getID(viewX, viewY);

        /**
        * Occurs when mousedown event happens on underlying canvas.
        *
        * @event xViewer#mouseDown
        * @type {object}
        * @param {Number} id - product ID of the element or null if there wasn't any product under mouse
        */
        viewer._fire('mouseDown', {id: id});


        //keep information about the mouse button
        switch (event.button) {
            case 0:
                button = 'left';
                break;

            case 1:
                button = 'middle';
                break;

            case 2:
                button = 'right';
                break;

            default:
                button = 'left';
                break;
        }

        viewer._disableTextSelection();
    }
function handleMouseDown(event) {
        mouseDown = true;
        lastMouseX = event.clientX;
        lastMouseY = event.clientY;
        startX = event.clientX;
        startY = event.clientY;

        
        var r = viewer._canvas.getBoundingClientRect();
        var viewX = startX - r.left;
        var viewY = viewer._height - (startY - r.top);

        
        id = viewer._getID(viewX, viewY);

        
        viewer._fire('mouseDown', {id: id});


        
        switch (event.button) {
            case 0:
                button = 'left';
                break;

            case 1:
                button = 'middle';
                break;

            case 2:
                button = 'right';
                break;

            default:
                button = 'left';
                break;
        }

        viewer._disableTextSelection();
    }
function handleMouseDown ( event ) { mouseDown = true ; lastMouseX = event . clientX ; lastMouseY = event . clientY ; startX = event . clientX ; startY = event . clientY ; //get coordinates within canvas (with the right orientation) var r = viewer . _canvas . getBoundingClientRect ( ) ; var viewX = startX - r . left ; var viewY = viewer . _height - ( startY - r . top ) ; //this is for picking id = viewer . _getID ( viewX , viewY ) ; /**
        * Occurs when mousedown event happens on underlying canvas.
        *
        * @event xViewer#mouseDown
        * @type {object}
        * @param {Number} id - product ID of the element or null if there wasn't any product under mouse
        */ viewer . _fire ( 'mouseDown' , { id : id } ) ; //keep information about the mouse button switch ( event . button ) { case 0 : button = 'left' ; break ; case 1 : button = 'middle' ; break ; case 2 : button = 'right' ; break ; default : button = 'left' ; break ; } viewer . _disableTextSelection ( ) ; }
set initial conditions so that different gestures can be identified
set initial conditions so that different gestures can be identified