Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/ |
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/autoscroll.min.js.map |
{"version":3,"sources":["../src/autoscroll.js"],"names":["define","$","autoscroll","SCROLL_THRESHOLD","SCROLL_FREQUENCY","SCROLL_SPEED","scrollingId","scrollAmount","callback","start","window","on","mouseMove","touchMove","stop","off","stopScrolling","e","i","changedTouches","length","handleMove","clientX","clientY","Math","min","height","startScrolling","maxScroll","document","setInterval","y","scrollTop","offset","round","realOffset","clearInterval"],"mappings":"AA8BAA,OAAM,mBAAC,CAAC,QAAD,CAAD,CAAa,SAASC,CAAT,CAAY,CAI3B,GAAIC,CAAAA,CAAU,CAAG,CAKbC,gBAAgB,CAAE,EALL,CAWbC,gBAAgB,CAAE,IAAO,EAXZ,CAiBbC,YAAY,CAAE,EAjBD,CAuBbC,WAAW,CAAE,IAvBA,CA6BbC,YAAY,CAAE,CA7BD,CAmCbC,QAAQ,CAAE,IAnCG,CA4CbC,KAAK,CAAE,eAASD,CAAT,CAAmB,CACtBP,CAAC,CAACS,MAAD,CAAD,CAAUC,EAAV,CAAa,WAAb,CAA0BT,CAAU,CAACU,SAArC,EACAX,CAAC,CAACS,MAAD,CAAD,CAAUC,EAAV,CAAa,WAAb,CAA0BT,CAAU,CAACW,SAArC,EACAX,CAAU,CAACM,QAAX,CAAsBA,CACzB,CAhDY,CAuDbM,IAAI,CAAE,eAAW,CACbb,CAAC,CAACS,MAAD,CAAD,CAAUK,GAAV,CAAc,WAAd,CAA2Bb,CAAU,CAACU,SAAtC,EACAX,CAAC,CAACS,MAAD,CAAD,CAAUK,GAAV,CAAc,WAAd,CAA2Bb,CAAU,CAACW,SAAtC,EACA,GAA+B,IAA3B,GAAAX,CAAU,CAACI,WAAf,CAAqC,CACjCJ,CAAU,CAACc,aAAX,EACH,CACJ,CA7DY,CAqEbH,SAAS,CAAE,mBAASI,CAAT,CAAY,CACnB,IAAK,GAAIC,CAAAA,CAAC,CAA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AAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/*\n * JavaScript to provide automatic scrolling, e.g. during a drag operation.\n *\n * Note: this module is defined statically. It is a singleton. You\n * can only have one use of it active at any time. However, since this\n * is usually used in relation to drag-drop, and since you only ever\n * drag one thing at a time, this is not a problem in practice.\n *\n * @module core/autoscroll\n * @class autoscroll\n * @package core\n * @copyright 2016 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 3.6\n */\ndefine(['jquery'], function($) {\n /**\n * @alias module:core/autoscroll\n */\n var autoscroll = {\n /**\n * Size of area near edge of screen that triggers scrolling.\n * @private\n */\n SCROLL_THRESHOLD: 30,\n\n /**\n * How frequently to scroll window.\n * @private\n */\n SCROLL_FREQUENCY: 1000 / 60,\n\n /**\n * How many pixels to scroll per unit (1 = max scroll 30).\n * @private\n */\n SCROLL_SPEED: 0.5,\n\n /**\n * Set if currently scrolling up/down.\n * @private\n */\n scrollingId: null,\n\n /**\n * Speed we are supposed to scroll (range 1 to SCROLL_THRESHOLD).\n * @private\n */\n scrollAmount: 0,\n\n /**\n * Optional callback called when it scrolls\n * @private\n */\n callback: null,\n\n /**\n * Starts automatically scrolling if user moves near edge of window.\n * This should be called in response to mouse down or touch start.\n *\n * @public\n * @param {Function} callback Optional callback that is called every time it scrolls\n */\n start: function(callback) {\n $(window).on('mousemove', autoscroll.mouseMove);\n $(window).on('touchmove', autoscroll.touchMove);\n autoscroll.callback = callback;\n },\n\n /**\n * Stops automatically scrolling. This should be called in response to mouse up or touch end.\n *\n * @public\n */\n stop: function() {\n $(window).off('mousemove', autoscroll.mouseMove);\n $(window).off('touchmove', autoscroll.touchMove);\n if (autoscroll.scrollingId !== null) {\n autoscroll.stopScrolling();\n }\n },\n\n /**\n * Event handler for touch move.\n *\n * @private\n * @param {Object} e Event\n */\n touchMove: function(e) {\n for (var i = 0; i < e.changedTouches.length; i++) {\n autoscroll.handleMove(e.changedTouches[i].clientX, e.changedTouches[i].clientY);\n }\n },\n\n /**\n * Event handler for mouse move.\n *\n * @private\n * @param {Object} e Event\n */\n mouseMove: function(e) {\n autoscroll.handleMove(e.clientX, e.clientY);\n },\n\n /**\n * Handles user moving.\n *\n * @private\n * @param {number} clientX X\n * @param {number} clientY Y\n */\n handleMove: function(clientX, clientY) {\n // If near the bottom or top, start auto-scrolling.\n if (clientY < autoscroll.SCROLL_THRESHOLD) {\n autoscroll.scrollAmount = -Math.min(autoscroll.SCROLL_THRESHOLD - clientY, autoscroll.SCROLL_THRESHOLD);\n } else if (clientY > $(window).height() - autoscroll.SCROLL_THRESHOLD) {\n autoscroll.scrollAmount = Math.min(clientY - ($(window).height() - autoscroll.SCROLL_THRESHOLD),\n autoscroll.SCROLL_THRESHOLD);\n } else {\n autoscroll.scrollAmount = 0;\n }\n if (autoscroll.scrollAmount && autoscroll.scrollingId === null) {\n autoscroll.startScrolling();\n } else if (!autoscroll.scrollAmount && autoscroll.scrollingId !== null) {\n autoscroll.stopScrolling();\n }\n },\n\n /**\n * Starts automatic scrolling.\n *\n * @private\n */\n startScrolling: function() {\n var maxScroll = $(document).height() - $(window).height();\n autoscroll.scrollingId = window.setInterval(function() {\n // Work out how much to scroll.\n var y = $(window).scrollTop();\n var offset = Math.round(autoscroll.scrollAmount * autoscroll.SCROLL_SPEED);\n if (y + offset < 0) {\n offset = -y;\n }\n if (y + offset > maxScroll) {\n offset = maxScroll - y;\n }\n if (offset === 0) {\n return;\n }\n\n // Scroll.\n $(window).scrollTop(y + offset);\n var realOffset = $(window).scrollTop() - y;\n if (realOffset === 0) {\n return;\n }\n\n // Inform callback\n if (autoscroll.callback) {\n autoscroll.callback(realOffset);\n }\n\n }, autoscroll.SCROLL_FREQUENCY);\n },\n\n /**\n * Stops the automatic scrolling.\n *\n * @private\n */\n stopScrolling: function() {\n window.clearInterval(autoscroll.scrollingId);\n autoscroll.scrollingId = null;\n }\n };\n\n return {\n /**\n * Starts automatic scrolling if user moves near edge of window.\n * This should be called in response to mouse down or touch start.\n *\n * @public\n * @param {Function} callback Optional callback that is called every time it scrolls\n */\n start: autoscroll.start,\n\n /**\n * Stops automatic scrolling. This should be called in response to mouse up or touch end.\n *\n * @public\n */\n stop: autoscroll.stop\n };\n\n});\n"],"file":"autoscroll.min.js"}