src/Mouse.js
function mousewheel_handler(e) {

        // Determine approximate scroll amount (in pixels)
        var delta = e.deltaY || -e.wheelDeltaY || -e.wheelDelta;

        // If successfully retrieved scroll amount, convert to pixels if not
        // already in pixels
        if (delta) {

            // Convert to pixels if delta was lines
            if (e.deltaMode === 1)
                delta = e.deltaY * guac_mouse.PIXELS_PER_LINE;

            // Convert to pixels if delta was pages
            else if (e.deltaMode === 2)
                delta = e.deltaY * guac_mouse.PIXELS_PER_PAGE;

        }

        // Otherwise, assume legacy mousewheel event and line scrolling
        else
            delta = e.detail * guac_mouse.PIXELS_PER_LINE;
        
        // Update overall delta
        scroll_delta += delta;

        // Up
        if (scroll_delta <= -guac_mouse.scrollThreshold) {

            // Repeatedly click the up button until insufficient delta remains
            do {

                if (guac_mouse.onmousedown) {
                    guac_mouse.currentState.up = true;
                    guac_mouse.onmousedown(guac_mouse.currentState);
                }

                if (guac_mouse.onmouseup) {
                    guac_mouse.currentState.up = false;
                    guac_mouse.onmouseup(guac_mouse.currentState);
                }

                scroll_delta += guac_mouse.scrollThreshold;

            } while (scroll_delta <= -guac_mouse.scrollThreshold);

            // Reset delta
            scroll_delta = 0;

        }

        // Down
        if (scroll_delta >= guac_mouse.scrollThreshold) {

            // Repeatedly click the down button until insufficient delta remains
            do {

                if (guac_mouse.onmousedown) {
                    guac_mouse.currentState.down = true;
                    guac_mouse.onmousedown(guac_mouse.currentState);
                }

                if (guac_mouse.onmouseup) {
                    guac_mouse.currentState.down = false;
                    guac_mouse.onmouseup(guac_mouse.currentState);
                }

                scroll_delta -= guac_mouse.scrollThreshold;

            } while (scroll_delta >= guac_mouse.scrollThreshold);

            // Reset delta
            scroll_delta = 0;

        }

        cancelEvent(e);

    }
function mousewheel_handler(e) {

        // Determine approximate scroll amount (in pixels)
        var delta = e.deltaY || -e.wheelDeltaY || -e.wheelDelta;

        // If successfully retrieved scroll amount, convert to pixels if not
        // already in pixels
        if (delta) {

            // Convert to pixels if delta was lines
            if (e.deltaMode === 1)
                delta = e.deltaY * guac_mouse.PIXELS_PER_LINE;

            // Convert to pixels if delta was pages
            else if (e.deltaMode === 2)
                delta = e.deltaY * guac_mouse.PIXELS_PER_PAGE;

        }

        // Otherwise, assume legacy mousewheel event and line scrolling
        else
            delta = e.detail * guac_mouse.PIXELS_PER_LINE;
        
        // Update overall delta
        scroll_delta += delta;

        // Up
        if (scroll_delta <= -guac_mouse.scrollThreshold) {

            // Repeatedly click the up button until insufficient delta remains
            do {

                if (guac_mouse.onmousedown) {
                    guac_mouse.currentState.up = true;
                    guac_mouse.onmousedown(guac_mouse.currentState);
                }

                if (guac_mouse.onmouseup) {
                    guac_mouse.currentState.up = false;
                    guac_mouse.onmouseup(guac_mouse.currentState);
                }

                scroll_delta += guac_mouse.scrollThreshold;

            } while (scroll_delta <= -guac_mouse.scrollThreshold);

            // Reset delta
            scroll_delta = 0;

        }

        // Down
        if (scroll_delta >= guac_mouse.scrollThreshold) {

            // Repeatedly click the down button until insufficient delta remains
            do {

                if (guac_mouse.onmousedown) {
                    guac_mouse.currentState.down = true;
                    guac_mouse.onmousedown(guac_mouse.currentState);
                }

                if (guac_mouse.onmouseup) {
                    guac_mouse.currentState.down = false;
                    guac_mouse.onmouseup(guac_mouse.currentState);
                }

                scroll_delta -= guac_mouse.scrollThreshold;

            } while (scroll_delta >= guac_mouse.scrollThreshold);

            // Reset delta
            scroll_delta = 0;

        }

        cancelEvent(e);

    }
function mousewheel_handler ( e ) { // Determine approximate scroll amount (in pixels) var delta = e . deltaY || - e . wheelDeltaY || - e . wheelDelta ; // If successfully retrieved scroll amount, convert to pixels if not // already in pixels if ( delta ) { // Convert to pixels if delta was lines if ( e . deltaMode === 1 ) delta = e . deltaY * guac_mouse . PIXELS_PER_LINE ; // Convert to pixels if delta was pages else if ( e . deltaMode === 2 ) delta = e . deltaY * guac_mouse . PIXELS_PER_PAGE ; } // Otherwise, assume legacy mousewheel event and line scrolling else delta = e . detail * guac_mouse . PIXELS_PER_LINE ; // Update overall delta scroll_delta += delta ; // Up if ( scroll_delta <= - guac_mouse . scrollThreshold ) { // Repeatedly click the up button until insufficient delta remains do { if ( guac_mouse . onmousedown ) { guac_mouse . currentState . up = true ; guac_mouse . onmousedown ( guac_mouse . currentState ) ; } if ( guac_mouse . onmouseup ) { guac_mouse . currentState . up = false ; guac_mouse . onmouseup ( guac_mouse . currentState ) ; } scroll_delta += guac_mouse . scrollThreshold ; } while ( scroll_delta <= - guac_mouse . scrollThreshold ) ; // Reset delta scroll_delta = 0 ; } // Down if ( scroll_delta >= guac_mouse . scrollThreshold ) { // Repeatedly click the down button until insufficient delta remains do { if ( guac_mouse . onmousedown ) { guac_mouse . currentState . down = true ; guac_mouse . onmousedown ( guac_mouse . currentState ) ; } if ( guac_mouse . onmouseup ) { guac_mouse . currentState . down = false ; guac_mouse . onmouseup ( guac_mouse . currentState ) ; } scroll_delta -= guac_mouse . scrollThreshold ; } while ( scroll_delta >= guac_mouse . scrollThreshold ) ; // Reset delta scroll_delta = 0 ; } cancelEvent ( e ) ; }
Scroll wheel support
Scroll wheel support