MCPcopy Index your code
hub / github.com/SortableJS/Sortable / AutoScrollPlugin

Function AutoScrollPlugin

modular/sortable.core.esm.js:2421–2523  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2419 touchEvt$1,
2420 pointerElemChangedInterval;
2421function AutoScrollPlugin() {
2422 function AutoScroll() {
2423 this.defaults = {
2424 scroll: true,
2425 forceAutoScrollFallback: false,
2426 scrollSensitivity: 30,
2427 scrollSpeed: 10,
2428 bubbleScroll: true
2429 };
2430
2431 // Bind all private methods
2432 for (var fn in this) {
2433 if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
2434 this[fn] = this[fn].bind(this);
2435 }
2436 }
2437 }
2438 AutoScroll.prototype = {
2439 dragStarted: function dragStarted(_ref) {
2440 var originalEvent = _ref.originalEvent;
2441 if (this.sortable.nativeDraggable) {
2442 on(document, 'dragover', this._handleAutoScroll);
2443 } else {
2444 if (this.options.supportPointer) {
2445 on(document, 'pointermove', this._handleFallbackAutoScroll);
2446 } else if (originalEvent.touches) {
2447 on(document, 'touchmove', this._handleFallbackAutoScroll);
2448 } else {
2449 on(document, 'mousemove', this._handleFallbackAutoScroll);
2450 }
2451 }
2452 },
2453 dragOverCompleted: function dragOverCompleted(_ref2) {
2454 var originalEvent = _ref2.originalEvent;
2455 // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
2456 if (!this.options.dragOverBubble && !originalEvent.rootEl) {
2457 this._handleAutoScroll(originalEvent);
2458 }
2459 },
2460 drop: function drop() {
2461 if (this.sortable.nativeDraggable) {
2462 off(document, 'dragover', this._handleAutoScroll);
2463 } else {
2464 off(document, 'pointermove', this._handleFallbackAutoScroll);
2465 off(document, 'touchmove', this._handleFallbackAutoScroll);
2466 off(document, 'mousemove', this._handleFallbackAutoScroll);
2467 }
2468 clearPointerElemChangedInterval();
2469 clearAutoScrolls();
2470 cancelThrottle();
2471 },
2472 nulling: function nulling() {
2473 touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
2474 autoScrolls.length = 0;
2475 },
2476 _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
2477 this._handleAutoScroll(evt, true);
2478 },

Callers

nothing calls this directly

Calls 8

onFunction · 0.70
offFunction · 0.70
clearAutoScrollsFunction · 0.70
cancelThrottleFunction · 0.70
_extendsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…