MCPcopy
hub / github.com/SortableJS/Sortable / AutoScrollPlugin

Function AutoScrollPlugin

Sortable.js:2427–2529  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

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…