src/extensions/default/InlineTimingFunctionEditor/BezierCurveEditor.js
function handlePointMove(e, x, y) {
        var self = e.target,
            bezierEditor = self.bezierEditor;

        // Helper function to redraw curve
        function mouseMoveRedraw() {
            if (!bezierEditor.dragElement) {
                animationRequest = null;
                return;
            }

            // Update code
            bezierEditor._commitTimingFunction();

            bezierEditor._updateCanvas();
            animationRequest = window.requestAnimationFrame(mouseMoveRedraw);
        }

        // This is a dragging state, but left button is no longer down, so mouse
        // exited element, was released, and re-entered element. Treat like a drop.
        if (bezierEditor.dragElement && (e.which !== 1)) {
            bezierEditor.dragElement = null;
            bezierEditor._commitTimingFunction();
            bezierEditor._updateCanvas();
            bezierEditor = null;
            return;
        }

        // Constrain time (x-axis) to 0 to 1 range. Progression (y-axis) is
        // theoretically not constrained, although canvas to drawing curve is
        // arbitrarily constrained to -0.5 to 1.5 range.
        x = Math.min(Math.max(0, x), WIDTH_MAIN);

        if (bezierEditor.dragElement) {
            $(bezierEditor.dragElement).css({
                left: x + "px",
                top:  y + "px"
            });
        }

        // update coords
        bezierEditor._cubicBezierCoords = bezierEditor.bezierCanvas
            .offsetsToCoordinates(bezierEditor.P1)
            .concat(bezierEditor.bezierCanvas.offsetsToCoordinates(bezierEditor.P2));

        if (!animationRequest) {
            animationRequest = window.requestAnimationFrame(mouseMoveRedraw);
        }
    }
function handlePointMove(e, x, y) {
        var self = e.target,
            bezierEditor = self.bezierEditor;

        // Helper function to redraw curve
        function mouseMoveRedraw() {
            if (!bezierEditor.dragElement) {
                animationRequest = null;
                return;
            }

            // Update code
            bezierEditor._commitTimingFunction();

            bezierEditor._updateCanvas();
            animationRequest = window.requestAnimationFrame(mouseMoveRedraw);
        }

        // This is a dragging state, but left button is no longer down, so mouse
        // exited element, was released, and re-entered element. Treat like a drop.
        if (bezierEditor.dragElement && (e.which !== 1)) {
            bezierEditor.dragElement = null;
            bezierEditor._commitTimingFunction();
            bezierEditor._updateCanvas();
            bezierEditor = null;
            return;
        }

        // Constrain time (x-axis) to 0 to 1 range. Progression (y-axis) is
        // theoretically not constrained, although canvas to drawing curve is
        // arbitrarily constrained to -0.5 to 1.5 range.
        x = Math.min(Math.max(0, x), WIDTH_MAIN);

        if (bezierEditor.dragElement) {
            $(bezierEditor.dragElement).css({
                left: x + "px",
                top:  y + "px"
            });
        }

        // update coords
        bezierEditor._cubicBezierCoords = bezierEditor.bezierCanvas
            .offsetsToCoordinates(bezierEditor.P1)
            .concat(bezierEditor.bezierCanvas.offsetsToCoordinates(bezierEditor.P2));

        if (!animationRequest) {
            animationRequest = window.requestAnimationFrame(mouseMoveRedraw);
        }
    }
function handlePointMove ( e , x , y ) { var self = e . target , bezierEditor = self . bezierEditor ; // Helper function to redraw curve function mouseMoveRedraw ( ) { if ( ! bezierEditor . dragElement ) { animationRequest = null ; return ; } // Update code bezierEditor . _commitTimingFunction ( ) ; bezierEditor . _updateCanvas ( ) ; animationRequest = window . requestAnimationFrame ( mouseMoveRedraw ) ; } // This is a dragging state, but left button is no longer down, so mouse // exited element, was released, and re-entered element. Treat like a drop. if ( bezierEditor . dragElement && ( e . which !== 1 ) ) { bezierEditor . dragElement = null ; bezierEditor . _commitTimingFunction ( ) ; bezierEditor . _updateCanvas ( ) ; bezierEditor = null ; return ; } // Constrain time (x-axis) to 0 to 1 range. Progression (y-axis) is // theoretically not constrained, although canvas to drawing curve is // arbitrarily constrained to -0.5 to 1.5 range. x = Math . min ( Math . max ( 0 , x ) , WIDTH_MAIN ) ; if ( bezierEditor . dragElement ) { $ ( bezierEditor . dragElement ) . css ( { left : x + "px" , top : y + "px" } ) ; } // update coords bezierEditor . _cubicBezierCoords = bezierEditor . bezierCanvas . offsetsToCoordinates ( bezierEditor . P1 ) . concat ( bezierEditor . bezierCanvas . offsetsToCoordinates ( bezierEditor . P2 ) ) ; if ( ! animationRequest ) { animationRequest = window . requestAnimationFrame ( mouseMoveRedraw ) ; } }
Helper function for handling point move

@param {Event} e Mouse move event
@param {number} x New horizontal position
@param {number} y New vertical position
Helper function for handling point move