Browse Source

Added fix for module-dragging on mobile

Nathan Schneider 4 năm trước cách đây
mục cha
commit
49a3ae1137

+ 10 - 0
_layouts/rule.html

@@ -4,6 +4,16 @@ layout: default
 # Follow comments below in various sections for further explanation
 ---
 
+<!-- enable drag/drop for mobile github.com/timruffles/mobile-drag-drop -->
+<link rel="stylesheet" href="/assets/mobile-drag-drop/default.css">
+<script src="/assets/mobile-drag-drop/index.min.js"></script>
+<script>
+  (event)=> {
+      event.preventDefault();
+  }
+</script>
+
+<!-- the main event -->
 <script>
   // Enter JavaScript-land!
   // First, some functions, followed by initialization commands

+ 44 - 0
assets/mobile-drag-drop/debug.css

@@ -0,0 +1,44 @@
+/* debug classes */
+
+.dnd-poly-debug {
+    -webkit-transition-duration: 250ms, 250ms;
+    -webkit-transition-property: outline, outline-offset;
+
+    -moz-transition-duration: 250ms, 250ms;
+    -moz-transition-property: outline, outline-offset;
+
+    -o-transition-duration: 250ms, 250ms;
+    -o-transition-property: outline, outline-offset;
+
+    transition-duration: 250ms, 250ms;
+    transition-property: outline, outline-offset;
+
+    outline: 1px solid transparent;
+    outline-offset: 10px;
+}
+
+.dnd-poly-immediate-user-selection {
+    background-color: steelblue !important;
+}
+
+.dnd-poly-current-drop-target {
+    background-color: lime !important;
+}
+
+.dnd-poly-event-target {
+    -webkit-transition-duration: 0ms, 0ms;
+    -moz-transition-duration: 0ms, 0ms;
+    -o-transition-duration: 0ms, 0ms;
+    transition-duration: 0ms, 0ms;
+    outline: 1px solid red !important;
+    outline-offset: 0;
+}
+
+.dnd-poly-event-related-target {
+    -webkit-transition-duration: 0ms, 0ms;
+    -moz-transition-duration: 0ms, 0ms;
+    -o-transition-duration: 0ms, 0ms;
+    transition-duration: 0ms, 0ms;
+    outline: 1px solid lime !important;
+    outline-offset: 0;
+}

+ 10 - 0
assets/mobile-drag-drop/default.css

@@ -0,0 +1,10 @@
+
+.dnd-poly-drag-image {
+    opacity: .5 !important;
+}
+
+.dnd-poly-drag-image.dnd-poly-snapback {
+    transition-property: transform, -webkit-transform !important;
+    transition-duration: 250ms !important;
+    transition-timing-function: ease-out !important;
+}

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 11 - 0
assets/mobile-drag-drop/icons.css


+ 18 - 0
assets/mobile-drag-drop/index.d.ts

@@ -0,0 +1,18 @@
+import { Point } from "./internal/dom-utils";
+export { Point } from "./internal/dom-utils";
+export declare type DragImageTranslateOverrideFn = (event: TouchEvent, hoverCoordinates: Point, hoveredElement: HTMLElement, translateDragImageFn: (offsetX: number, offsetY: number) => void) => void;
+export interface Config {
+    forceApply?: boolean;
+    dragImageOffset?: Point;
+    dragImageCenterOnTouch?: boolean;
+    iterationInterval?: number;
+    dragStartConditionOverride?: (event: TouchEvent) => boolean;
+    dragImageTranslateOverride?: DragImageTranslateOverrideFn;
+    defaultActionOverride?: (event: TouchEvent) => void;
+    holdToDrag?: number;
+    tryFindDraggableTarget?: (event: TouchEvent) => HTMLElement | undefined;
+    dragImageSetup?: (element: HTMLElement) => HTMLElement;
+    elementFromPoint?: (x: number, y: number) => Element;
+}
+export declare function polyfill(override?: Config): boolean;
+export as namespace MobileDragDrop;

+ 760 - 0
assets/mobile-drag-drop/index.js

@@ -0,0 +1,760 @@
+(function (global, factory) {
+	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+	typeof define === 'function' && define.amd ? define(['exports'], factory) :
+	(factory((global.MobileDragDrop = global.MobileDragDrop || {})));
+}(this, (function (exports) { 'use strict';
+
+var CLASS_PREFIX = "dnd-poly-";
+var CLASS_DRAG_IMAGE = CLASS_PREFIX + "drag-image";
+var CLASS_DRAG_IMAGE_SNAPBACK = CLASS_PREFIX + "snapback";
+var CLASS_DRAG_OPERATION_ICON = CLASS_PREFIX + "icon";
+var EVENT_PREFIX = "dnd-poly-";
+var EVENT_DRAG_DRAGSTART_PENDING = EVENT_PREFIX + "dragstart-pending";
+var EVENT_DRAG_DRAGSTART_CANCEL = EVENT_PREFIX + "dragstart-cancel";
+var ALLOWED_EFFECTS = ["none", "copy", "copyLink", "copyMove", "link", "linkMove", "move", "all"];
+var DROP_EFFECTS = ["none", "copy", "move", "link"];
+
+function detectFeatures() {
+    var features = {
+        dragEvents: ("ondragstart" in document.documentElement),
+        draggable: ("draggable" in document.documentElement),
+        userAgentSupportingNativeDnD: undefined
+    };
+    var isBlinkEngine = !!(window.chrome) || /chrome/i.test(navigator.userAgent);
+    features.userAgentSupportingNativeDnD = !((/iPad|iPhone|iPod|Android/.test(navigator.userAgent))
+        ||
+            (isBlinkEngine && ("ontouchstart" in document.documentElement)));
+    return features;
+}
+function supportsPassiveEventListener() {
+    var supportsPassiveEventListeners = false;
+    try {
+        var opts = Object.defineProperty({}, "passive", {
+            get: function () {
+                supportsPassiveEventListeners = true;
+            }
+        });
+        window.addEventListener("test", null, opts);
+    }
+    catch (e) {
+    }
+    return supportsPassiveEventListeners;
+}
+
+var supportsPassive = supportsPassiveEventListener();
+function isDOMElement(object) {
+    return object && object.tagName;
+}
+function addDocumentListener(ev, handler, passive) {
+    if (passive === void 0) { passive = true; }
+    document.addEventListener(ev, handler, supportsPassive ? { passive: passive } : false);
+}
+function removeDocumentListener(ev, handler) {
+    document.removeEventListener(ev, handler);
+}
+function onEvt(el, event, handler, capture) {
+    if (capture === void 0) { capture = false; }
+    var options = supportsPassive ? { passive: true, capture: capture } : capture;
+    el.addEventListener(event, handler, options);
+    return {
+        off: function () {
+            el.removeEventListener(event, handler, options);
+        }
+    };
+}
+function prepareNodeCopyAsDragImage(srcNode, dstNode) {
+    if (srcNode.nodeType === 1) {
+        var cs = getComputedStyle(srcNode);
+        for (var i = 0; i < cs.length; i++) {
+            var csName = cs[i];
+            dstNode.style.setProperty(csName, cs.getPropertyValue(csName), cs.getPropertyPriority(csName));
+        }
+        dstNode.style.pointerEvents = "none";
+        dstNode.removeAttribute("id");
+        dstNode.removeAttribute("class");
+        dstNode.removeAttribute("draggable");
+        if (dstNode.nodeName === "CANVAS") {
+            var canvasSrc = srcNode;
+            var canvasDst = dstNode;
+            var canvasSrcImgData = canvasSrc.getContext("2d").getImageData(0, 0, canvasSrc.width, canvasSrc.height);
+            canvasDst.getContext("2d").putImageData(canvasSrcImgData, 0, 0);
+        }
+    }
+    if (srcNode.hasChildNodes()) {
+        for (var i = 0; i < srcNode.childNodes.length; i++) {
+            prepareNodeCopyAsDragImage(srcNode.childNodes[i], dstNode.childNodes[i]);
+        }
+    }
+}
+function createDragImage(sourceNode) {
+    var dragImage = sourceNode.cloneNode(true);
+    prepareNodeCopyAsDragImage(sourceNode, dragImage);
+    return dragImage;
+}
+function average(array) {
+    if (array.length === 0) {
+        return 0;
+    }
+    return array.reduce((function (s, v) {
+        return v + s;
+    }), 0) / array.length;
+}
+function isTouchIdentifierContainedInTouchEvent(touchEvent, touchIdentifier) {
+    for (var i = 0; i < touchEvent.changedTouches.length; i++) {
+        var touch = touchEvent.changedTouches[i];
+        if (touch.identifier === touchIdentifier) {
+            return true;
+        }
+    }
+    return false;
+}
+function updateCentroidCoordinatesOfTouchesIn(coordinateProp, event, outPoint) {
+    var pageXs = [], pageYs = [];
+    for (var i = 0; i < event.touches.length; i++) {
+        var touch = event.touches[i];
+        pageXs.push(touch[coordinateProp + "X"]);
+        pageYs.push(touch[coordinateProp + "Y"]);
+    }
+    outPoint.x = average(pageXs);
+    outPoint.y = average(pageYs);
+}
+var TRANSFORM_CSS_VENDOR_PREFIXES = ["", "-webkit-"];
+function extractTransformStyles(sourceNode) {
+    return TRANSFORM_CSS_VENDOR_PREFIXES.map(function (prefix) {
+        var transform = sourceNode.style[prefix + "transform"];
+        if (!transform || transform === "none") {
+            return "";
+        }
+        return transform.replace(/translate\(\D*\d+[^,]*,\D*\d+[^,]*\)\s*/g, "");
+    });
+}
+function translateElementToPoint(element, pnt, originalTransforms, offset, centerOnCoordinates) {
+    if (centerOnCoordinates === void 0) { centerOnCoordinates = true; }
+    var x = pnt.x, y = pnt.y;
+    if (offset) {
+        x += offset.x;
+        y += offset.y;
+    }
+    if (centerOnCoordinates) {
+        x -= (parseInt(element.offsetWidth, 10) / 2);
+        y -= (parseInt(element.offsetHeight, 10) / 2);
+    }
+    var translate = "translate3d(" + x + "px," + y + "px, 0)";
+    for (var i = 0; i < TRANSFORM_CSS_VENDOR_PREFIXES.length; i++) {
+        var transformProp = TRANSFORM_CSS_VENDOR_PREFIXES[i] + "transform";
+        element.style[transformProp] = translate + " " + originalTransforms[i];
+    }
+}
+function applyDragImageSnapback(sourceEl, dragImage, dragImageTransforms, transitionEndCb) {
+    var cs = getComputedStyle(sourceEl);
+    if (cs.visibility === "hidden" || cs.display === "none") {
+        console.log("dnd-poly: source node is not visible. skipping snapback transition.");
+        transitionEndCb();
+        return;
+    }
+    dragImage.classList.add(CLASS_DRAG_IMAGE_SNAPBACK);
+    var csDragImage = getComputedStyle(dragImage);
+    var durationInS = parseFloat(csDragImage.transitionDuration);
+    if (isNaN(durationInS) || durationInS === 0) {
+        console.log("dnd-poly: no transition used - skipping snapback");
+        transitionEndCb();
+        return;
+    }
+    console.log("dnd-poly: starting dragimage snap back");
+    var rect = sourceEl.getBoundingClientRect();
+    var pnt = {
+        x: rect.left,
+        y: rect.top
+    };
+    pnt.x += (document.body.scrollLeft || document.documentElement.scrollLeft);
+    pnt.y += (document.body.scrollTop || document.documentElement.scrollTop);
+    pnt.x -= parseInt(cs.marginLeft, 10);
+    pnt.y -= parseInt(cs.marginTop, 10);
+    var delayInS = parseFloat(csDragImage.transitionDelay);
+    var durationInMs = Math.round((durationInS + delayInS) * 1000);
+    translateElementToPoint(dragImage, pnt, dragImageTransforms, undefined, false);
+    setTimeout(transitionEndCb, durationInMs);
+}
+
+var DataTransfer = (function () {
+    function DataTransfer(_dataStore, _setDragImageHandler) {
+        this._dataStore = _dataStore;
+        this._setDragImageHandler = _setDragImageHandler;
+        this._dropEffect = DROP_EFFECTS[0];
+    }
+    Object.defineProperty(DataTransfer.prototype, "dropEffect", {
+        get: function () {
+            return this._dropEffect;
+        },
+        set: function (value) {
+            if (this._dataStore.mode !== 0
+                && ALLOWED_EFFECTS.indexOf(value) > -1) {
+                this._dropEffect = value;
+            }
+        },
+        enumerable: true,
+        configurable: true
+    });
+    Object.defineProperty(DataTransfer.prototype, "types", {
+        get: function () {
+            if (this._dataStore.mode !== 0) {
+                return Object.freeze(this._dataStore.types);
+            }
+        },
+        enumerable: true,
+        configurable: true
+    });
+    Object.defineProperty(DataTransfer.prototype, "effectAllowed", {
+        get: function () {
+            return this._dataStore.effectAllowed;
+        },
+        set: function (value) {
+            if (this._dataStore.mode === 2
+                && ALLOWED_EFFECTS.indexOf(value) > -1) {
+                this._dataStore.effectAllowed = value;
+            }
+        },
+        enumerable: true,
+        configurable: true
+    });
+    DataTransfer.prototype.setData = function (type, data) {
+        if (this._dataStore.mode === 2) {
+            if (type.indexOf(" ") > -1) {
+                throw new Error("illegal arg: type contains space");
+            }
+            this._dataStore.data[type] = data;
+            if (this._dataStore.types.indexOf(type) === -1) {
+                this._dataStore.types.push(type);
+            }
+        }
+    };
+    DataTransfer.prototype.getData = function (type) {
+        if (this._dataStore.mode === 1
+            || this._dataStore.mode === 2) {
+            return this._dataStore.data[type] || "";
+        }
+    };
+    DataTransfer.prototype.clearData = function (format) {
+        if (this._dataStore.mode === 2) {
+            if (format && this._dataStore.data[format]) {
+                delete this._dataStore.data[format];
+                var index = this._dataStore.types.indexOf(format);
+                if (index > -1) {
+                    this._dataStore.types.splice(index, 1);
+                }
+                return;
+            }
+            this._dataStore.data = {};
+            this._dataStore.types = [];
+        }
+    };
+    DataTransfer.prototype.setDragImage = function (image, x, y) {
+        if (this._dataStore.mode === 2) {
+            this._setDragImageHandler(image, x, y);
+        }
+    };
+    return DataTransfer;
+}());
+
+function tryFindDraggableTarget(event) {
+    var el = event.target;
+    do {
+        if (el.draggable === false) {
+            continue;
+        }
+        if (el.draggable === true) {
+            return el;
+        }
+        if (el.getAttribute
+            && el.getAttribute("draggable") === "true") {
+            return el;
+        }
+    } while ((el = el.parentNode) && el !== document.body);
+}
+function determineDropEffect(effectAllowed, sourceNode) {
+    if (!effectAllowed) {
+        if (sourceNode.nodeType === 3 && sourceNode.tagName === "A") {
+            return DROP_EFFECTS[3];
+        }
+        return DROP_EFFECTS[1];
+    }
+    if (effectAllowed === ALLOWED_EFFECTS[0]) {
+        return DROP_EFFECTS[0];
+    }
+    if (effectAllowed.indexOf(ALLOWED_EFFECTS[1]) === 0 || effectAllowed === ALLOWED_EFFECTS[7]) {
+        return DROP_EFFECTS[1];
+    }
+    if (effectAllowed.indexOf(ALLOWED_EFFECTS[4]) === 0) {
+        return DROP_EFFECTS[3];
+    }
+    if (effectAllowed === ALLOWED_EFFECTS[6]) {
+        return DROP_EFFECTS[2];
+    }
+    return DROP_EFFECTS[1];
+}
+function createDragEventFromTouch(targetElement, e, type, cancelable, window, dataTransfer, relatedTarget) {
+    if (relatedTarget === void 0) { relatedTarget = null; }
+    var touch = e.changedTouches[0];
+    var dndEvent = new Event(type, {
+        bubbles: true,
+        cancelable: cancelable
+    });
+    dndEvent.dataTransfer = dataTransfer;
+    dndEvent.relatedTarget = relatedTarget;
+    dndEvent.screenX = touch.screenX;
+    dndEvent.screenY = touch.screenY;
+    dndEvent.clientX = touch.clientX;
+    dndEvent.clientY = touch.clientY;
+    dndEvent.pageX = touch.pageX;
+    dndEvent.pageY = touch.pageY;
+    var targetRect = targetElement.getBoundingClientRect();
+    dndEvent.offsetX = dndEvent.clientX - targetRect.left;
+    dndEvent.offsetY = dndEvent.clientY - targetRect.top;
+    return dndEvent;
+}
+function dispatchDragEvent(dragEvent, targetElement, touchEvent, dataStore, dataTransfer, cancelable, relatedTarget) {
+    if (cancelable === void 0) { cancelable = true; }
+    if (relatedTarget === void 0) { relatedTarget = null; }
+    console.log("dnd-poly: dispatching " + dragEvent);
+    var leaveEvt = createDragEventFromTouch(targetElement, touchEvent, dragEvent, cancelable, document.defaultView, dataTransfer, relatedTarget);
+    var cancelled = !targetElement.dispatchEvent(leaveEvt);
+    dataStore.mode = 0;
+    return cancelled;
+}
+function determineDragOperation(effectAllowed, dropEffect) {
+    if (!effectAllowed || effectAllowed === ALLOWED_EFFECTS[7]) {
+        return dropEffect;
+    }
+    if (dropEffect === DROP_EFFECTS[1]) {
+        if (effectAllowed.indexOf(DROP_EFFECTS[1]) === 0) {
+            return DROP_EFFECTS[1];
+        }
+    }
+    else if (dropEffect === DROP_EFFECTS[3]) {
+        if (effectAllowed.indexOf(DROP_EFFECTS[3]) === 0 || effectAllowed.indexOf("Link") > -1) {
+            return DROP_EFFECTS[3];
+        }
+    }
+    else if (dropEffect === DROP_EFFECTS[2]) {
+        if (effectAllowed.indexOf(DROP_EFFECTS[2]) === 0 || effectAllowed.indexOf("Move") > -1) {
+            return DROP_EFFECTS[2];
+        }
+    }
+    return DROP_EFFECTS[0];
+}
+
+var DragOperationController = (function () {
+    function DragOperationController(_initialEvent, _config, _sourceNode, _dragOperationEndedCb) {
+        this._initialEvent = _initialEvent;
+        this._config = _config;
+        this._sourceNode = _sourceNode;
+        this._dragOperationEndedCb = _dragOperationEndedCb;
+        this._dragOperationState = 0;
+        this._immediateUserSelection = null;
+        this._currentDropTarget = null;
+        console.log("dnd-poly: setting up potential drag operation..");
+        this._lastTouchEvent = _initialEvent;
+        this._initialTouch = _initialEvent.changedTouches[0];
+        this._touchMoveHandler = this._onTouchMove.bind(this);
+        this._touchEndOrCancelHandler = this._onTouchEndOrCancel.bind(this);
+        addDocumentListener("touchmove", this._touchMoveHandler, false);
+        addDocumentListener("touchend", this._touchEndOrCancelHandler, false);
+        addDocumentListener("touchcancel", this._touchEndOrCancelHandler, false);
+    }
+    DragOperationController.prototype._setup = function () {
+        var _this = this;
+        console.log("dnd-poly: starting drag and drop operation");
+        this._dragOperationState = 1;
+        this._currentDragOperation = DROP_EFFECTS[0];
+        this._dragDataStore = {
+            data: {},
+            effectAllowed: undefined,
+            mode: 3,
+            types: [],
+        };
+        this._currentHotspotCoordinates = {
+            x: null,
+            y: null
+        };
+        this._dragImagePageCoordinates = {
+            x: null,
+            y: null
+        };
+        var dragImageSrc = this._sourceNode;
+        this._dataTransfer = new DataTransfer(this._dragDataStore, function (element, x, y) {
+            dragImageSrc = element;
+            if (typeof x === "number" || typeof y === "number") {
+                _this._dragImageOffset = {
+                    x: x || 0,
+                    y: y || 0
+                };
+            }
+        });
+        this._dragDataStore.mode = 2;
+        this._dataTransfer.dropEffect = DROP_EFFECTS[0];
+        if (dispatchDragEvent("dragstart", this._sourceNode, this._lastTouchEvent, this._dragDataStore, this._dataTransfer)) {
+            console.log("dnd-poly: dragstart cancelled");
+            this._dragOperationState = 3;
+            this._cleanup();
+            return false;
+        }
+        updateCentroidCoordinatesOfTouchesIn("page", this._lastTouchEvent, this._dragImagePageCoordinates);
+        var dragImage = this._config.dragImageSetup(dragImageSrc);
+        this._dragImageTransforms = extractTransformStyles(dragImage);
+        dragImage.style.position = "absolute";
+        dragImage.style.left = "0px";
+        dragImage.style.top = "0px";
+        dragImage.style.zIndex = "999999";
+        dragImage.classList.add(CLASS_DRAG_IMAGE);
+        dragImage.classList.add(CLASS_DRAG_OPERATION_ICON);
+        this._dragImage = dragImage;
+        if (!this._dragImageOffset) {
+            if (this._config.dragImageOffset) {
+                this._dragImageOffset = {
+                    x: this._config.dragImageOffset.x,
+                    y: this._config.dragImageOffset.y
+                };
+            }
+            else if (this._config.dragImageCenterOnTouch) {
+                var cs = getComputedStyle(dragImageSrc);
+                this._dragImageOffset = {
+                    x: 0 - parseInt(cs.marginLeft, 10),
+                    y: 0 - parseInt(cs.marginTop, 10)
+                };
+            }
+            else {
+                var targetRect = dragImageSrc.getBoundingClientRect();
+                var cs = getComputedStyle(dragImageSrc);
+                this._dragImageOffset = {
+                    x: targetRect.left - this._initialTouch.clientX - parseInt(cs.marginLeft, 10) + targetRect.width / 2,
+                    y: targetRect.top - this._initialTouch.clientY - parseInt(cs.marginTop, 10) + targetRect.height / 2
+                };
+            }
+        }
+        translateElementToPoint(this._dragImage, this._dragImagePageCoordinates, this._dragImageTransforms, this._dragImageOffset, this._config.dragImageCenterOnTouch);
+        document.body.appendChild(this._dragImage);
+        this._iterationIntervalId = window.setInterval(function () {
+            if (_this._iterationLock) {
+                console.log("dnd-poly: iteration skipped because previous iteration hast not yet finished.");
+                return;
+            }
+            _this._iterationLock = true;
+            _this._dragAndDropProcessModelIteration();
+            _this._iterationLock = false;
+        }, this._config.iterationInterval);
+        return true;
+    };
+    DragOperationController.prototype._cleanup = function () {
+        console.log("dnd-poly: cleanup");
+        if (this._iterationIntervalId) {
+            clearInterval(this._iterationIntervalId);
+            this._iterationIntervalId = null;
+        }
+        removeDocumentListener("touchmove", this._touchMoveHandler);
+        removeDocumentListener("touchend", this._touchEndOrCancelHandler);
+        removeDocumentListener("touchcancel", this._touchEndOrCancelHandler);
+        if (this._dragImage) {
+            this._dragImage.parentNode.removeChild(this._dragImage);
+            this._dragImage = null;
+        }
+        this._dragOperationEndedCb(this._config, this._lastTouchEvent, this._dragOperationState);
+    };
+    DragOperationController.prototype._onTouchMove = function (event) {
+        var _this = this;
+        if (isTouchIdentifierContainedInTouchEvent(event, this._initialTouch.identifier) === false) {
+            return;
+        }
+        this._lastTouchEvent = event;
+        if (this._dragOperationState === 0) {
+            var startDrag = void 0;
+            if (this._config.dragStartConditionOverride) {
+                try {
+                    startDrag = this._config.dragStartConditionOverride(event);
+                }
+                catch (e) {
+                    console.error("dnd-poly: error in dragStartConditionOverride hook: " + e);
+                    startDrag = false;
+                }
+            }
+            else {
+                startDrag = (event.touches.length === 1);
+            }
+            if (!startDrag) {
+                this._cleanup();
+                return;
+            }
+            if (this._setup() === true) {
+                this._initialEvent.preventDefault();
+                event.preventDefault();
+            }
+            return;
+        }
+        console.log("dnd-poly: moving draggable..");
+        event.preventDefault();
+        updateCentroidCoordinatesOfTouchesIn("client", event, this._currentHotspotCoordinates);
+        updateCentroidCoordinatesOfTouchesIn("page", event, this._dragImagePageCoordinates);
+        if (this._config.dragImageTranslateOverride) {
+            try {
+                var handledDragImageTranslate_1 = false;
+                this._config.dragImageTranslateOverride(event, {
+                    x: this._currentHotspotCoordinates.x,
+                    y: this._currentHotspotCoordinates.y
+                }, this._immediateUserSelection, function (offsetX, offsetY) {
+                    if (!_this._dragImage) {
+                        return;
+                    }
+                    handledDragImageTranslate_1 = true;
+                    _this._currentHotspotCoordinates.x += offsetX;
+                    _this._currentHotspotCoordinates.y += offsetY;
+                    _this._dragImagePageCoordinates.x += offsetX;
+                    _this._dragImagePageCoordinates.y += offsetY;
+                    translateElementToPoint(_this._dragImage, _this._dragImagePageCoordinates, _this._dragImageTransforms, _this._dragImageOffset, _this._config.dragImageCenterOnTouch);
+                });
+                if (handledDragImageTranslate_1) {
+                    return;
+                }
+            }
+            catch (e) {
+                console.log("dnd-poly: error in dragImageTranslateOverride hook: " + e);
+            }
+        }
+        translateElementToPoint(this._dragImage, this._dragImagePageCoordinates, this._dragImageTransforms, this._dragImageOffset, this._config.dragImageCenterOnTouch);
+    };
+    DragOperationController.prototype._onTouchEndOrCancel = function (event) {
+        if (isTouchIdentifierContainedInTouchEvent(event, this._initialTouch.identifier) === false) {
+            return;
+        }
+        if (this._config.dragImageTranslateOverride) {
+            try {
+                this._config.dragImageTranslateOverride(undefined, undefined, undefined, function () {
+                });
+            }
+            catch (e) {
+                console.log("dnd-poly: error in dragImageTranslateOverride hook: " + e);
+            }
+        }
+        if (this._dragOperationState === 0) {
+            this._cleanup();
+            return;
+        }
+        event.preventDefault();
+        this._dragOperationState = (event.type === "touchcancel") ? 3 : 2;
+    };
+    DragOperationController.prototype._dragAndDropProcessModelIteration = function () {
+        var _this = this;
+        var previousDragOperation = this._currentDragOperation;
+        this._dragDataStore.mode = 3;
+        this._dataTransfer.dropEffect = DROP_EFFECTS[0];
+        var dragCancelled = dispatchDragEvent("drag", this._sourceNode, this._lastTouchEvent, this._dragDataStore, this._dataTransfer);
+        if (dragCancelled) {
+            console.log("dnd-poly: drag event cancelled.");
+            this._currentDragOperation = DROP_EFFECTS[0];
+        }
+        if (dragCancelled || this._dragOperationState === 2 || this._dragOperationState === 3) {
+            var dragFailed = this._dragOperationEnded(this._dragOperationState);
+            if (dragFailed) {
+                applyDragImageSnapback(this._sourceNode, this._dragImage, this._dragImageTransforms, function () {
+                    _this._finishDragOperation();
+                });
+                return;
+            }
+            this._finishDragOperation();
+            return;
+        }
+        var newUserSelection = this._config.elementFromPoint(this._currentHotspotCoordinates.x, this._currentHotspotCoordinates.y);
+        console.log("dnd-poly: new immediate user selection is: " + newUserSelection);
+        var previousTargetElement = this._currentDropTarget;
+        if (newUserSelection !== this._immediateUserSelection && newUserSelection !== this._currentDropTarget) {
+            this._immediateUserSelection = newUserSelection;
+            if (this._currentDropTarget !== null) {
+                this._dragDataStore.mode = 3;
+                this._dataTransfer.dropEffect = DROP_EFFECTS[0];
+                dispatchDragEvent("dragexit", this._currentDropTarget, this._lastTouchEvent, this._dragDataStore, this._dataTransfer, false);
+            }
+            if (this._immediateUserSelection === null) {
+                this._currentDropTarget = this._immediateUserSelection;
+                console.log("dnd-poly: current drop target changed to null");
+            }
+            else {
+                this._dragDataStore.mode = 3;
+                this._dataTransfer.dropEffect = determineDropEffect(this._dragDataStore.effectAllowed, this._sourceNode);
+                if (dispatchDragEvent("dragenter", this._immediateUserSelection, this._lastTouchEvent, this._dragDataStore, this._dataTransfer)) {
+                    console.log("dnd-poly: dragenter default prevented");
+                    this._currentDropTarget = this._immediateUserSelection;
+                    this._currentDragOperation = determineDragOperation(this._dataTransfer.effectAllowed, this._dataTransfer.dropEffect);
+                }
+                else {
+                    if (this._immediateUserSelection !== document.body) {
+                        this._currentDropTarget = document.body;
+                    }
+                }
+            }
+        }
+        if (previousTargetElement !== this._currentDropTarget && (isDOMElement(previousTargetElement))) {
+            console.log("dnd-poly: current drop target changed.");
+            this._dragDataStore.mode = 3;
+            this._dataTransfer.dropEffect = DROP_EFFECTS[0];
+            dispatchDragEvent("dragleave", previousTargetElement, this._lastTouchEvent, this._dragDataStore, this._dataTransfer, false, this._currentDropTarget);
+        }
+        if (isDOMElement(this._currentDropTarget)) {
+            this._dragDataStore.mode = 3;
+            this._dataTransfer.dropEffect = determineDropEffect(this._dragDataStore.effectAllowed, this._sourceNode);
+            if (dispatchDragEvent("dragover", this._currentDropTarget, this._lastTouchEvent, this._dragDataStore, this._dataTransfer) === false) {
+                console.log("dnd-poly: dragover not prevented on possible drop-target.");
+                this._currentDragOperation = DROP_EFFECTS[0];
+            }
+            else {
+                console.log("dnd-poly: dragover prevented.");
+                this._currentDragOperation = determineDragOperation(this._dataTransfer.effectAllowed, this._dataTransfer.dropEffect);
+            }
+        }
+        console.log("dnd-poly: d'n'd iteration ended. current drag operation: " + this._currentDragOperation);
+        if (previousDragOperation !== this._currentDragOperation) {
+            this._dragImage.classList.remove(CLASS_PREFIX + previousDragOperation);
+        }
+        var currentDragOperationClass = CLASS_PREFIX + this._currentDragOperation;
+        this._dragImage.classList.add(currentDragOperationClass);
+    };
+    DragOperationController.prototype._dragOperationEnded = function (state) {
+        console.log("dnd-poly: drag operation end detected with " + this._currentDragOperation);
+        var dragFailed = (this._currentDragOperation === DROP_EFFECTS[0]
+            || this._currentDropTarget === null
+            || state === 3);
+        if (dragFailed) {
+            if (isDOMElement(this._currentDropTarget)) {
+                this._dragDataStore.mode = 3;
+                this._dataTransfer.dropEffect = DROP_EFFECTS[0];
+                dispatchDragEvent("dragleave", this._currentDropTarget, this._lastTouchEvent, this._dragDataStore, this._dataTransfer, false);
+            }
+        }
+        else {
+            if (isDOMElement(this._currentDropTarget)) {
+                this._dragDataStore.mode = 1;
+                this._dataTransfer.dropEffect = this._currentDragOperation;
+                if (dispatchDragEvent("drop", this._currentDropTarget, this._lastTouchEvent, this._dragDataStore, this._dataTransfer) ===
+                    true) {
+                    this._currentDragOperation = this._dataTransfer.dropEffect;
+                }
+                else {
+                    this._currentDragOperation = DROP_EFFECTS[0];
+                }
+            }
+        }
+        return dragFailed;
+    };
+    DragOperationController.prototype._finishDragOperation = function () {
+        console.log("dnd-poly: dragimage snap back transition ended");
+        this._dragDataStore.mode = 3;
+        this._dataTransfer.dropEffect = this._currentDragOperation;
+        dispatchDragEvent("dragend", this._sourceNode, this._lastTouchEvent, this._dragDataStore, this._dataTransfer, false);
+        this._dragOperationState = 2;
+        this._cleanup();
+    };
+    return DragOperationController;
+}());
+
+var config = {
+    iterationInterval: 150,
+    tryFindDraggableTarget: tryFindDraggableTarget,
+    dragImageSetup: createDragImage,
+    elementFromPoint: function (x, y) { return document.elementFromPoint(x, y); }
+};
+var activeDragOperation;
+function onTouchstart(e) {
+    console.log("dnd-poly: global touchstart");
+    if (activeDragOperation) {
+        console.log("dnd-poly: drag operation already active");
+        return;
+    }
+    var dragTarget = config.tryFindDraggableTarget(e);
+    if (!dragTarget) {
+        console.log("dnd-poly: no draggable at touchstart coordinates");
+        return;
+    }
+    try {
+        activeDragOperation = new DragOperationController(e, config, dragTarget, dragOperationEnded);
+    }
+    catch (err) {
+        dragOperationEnded(config, e, 3);
+        throw err;
+    }
+}
+function onDelayTouchstart(evt) {
+    console.log("dnd-poly: setup delayed dragstart..");
+    var el = evt.target;
+    var heldItem = function () {
+        console.log("dnd-poly: starting delayed drag..");
+        end.off();
+        cancel.off();
+        move.off();
+        scroll.off();
+        onTouchstart(evt);
+    };
+    var onReleasedItem = function (event) {
+        console.log("dnd-poly: aborting delayed drag because of " + event.type);
+        end.off();
+        cancel.off();
+        move.off();
+        scroll.off();
+        if (el) {
+            el.dispatchEvent(new CustomEvent(EVENT_DRAG_DRAGSTART_CANCEL, { bubbles: true, cancelable: true }));
+        }
+        clearTimeout(timer);
+    };
+    if (el) {
+        el.dispatchEvent(new CustomEvent(EVENT_DRAG_DRAGSTART_PENDING, { bubbles: true, cancelable: true }));
+    }
+    var timer = window.setTimeout(heldItem, config.holdToDrag);
+    var end = onEvt(el, "touchend", onReleasedItem);
+    var cancel = onEvt(el, "touchcancel", onReleasedItem);
+    var move = onEvt(el, "touchmove", onReleasedItem);
+    var scroll = onEvt(window, "scroll", onReleasedItem, true);
+}
+function dragOperationEnded(_config, event, state) {
+    if (state === 0) {
+        console.log("dnd-poly: Drag never started. Last event was " + event.type);
+        if (_config.defaultActionOverride) {
+            try {
+                _config.defaultActionOverride(event);
+                if (event.defaultPrevented) {
+                    console.log("dnd-poly: defaultActionOverride has taken care of triggering the default action. preventing default on original event");
+                }
+            }
+            catch (e) {
+                console.log("dnd-poly: error in defaultActionOverride: " + e);
+            }
+        }
+    }
+    activeDragOperation = null;
+}
+function polyfill(override) {
+    if (override) {
+        Object.keys(override).forEach(function (key) {
+            config[key] = override[key];
+        });
+    }
+    if (!config.forceApply) {
+        var detectedFeatures = detectFeatures();
+        if (detectedFeatures.userAgentSupportingNativeDnD
+            && detectedFeatures.draggable
+            && detectedFeatures.dragEvents) {
+            return false;
+        }
+    }
+    console.log("dnd-poly: Applying mobile drag and drop polyfill.");
+    if (config.holdToDrag) {
+        console.log("dnd-poly: holdToDrag set to " + config.holdToDrag);
+        addDocumentListener("touchstart", onDelayTouchstart, false);
+    }
+    else {
+        addDocumentListener("touchstart", onTouchstart, false);
+    }
+    return true;
+}
+
+exports.polyfill = polyfill;
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
+//# sourceMappingURL=index.js.map

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
assets/mobile-drag-drop/index.js.map


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 0
assets/mobile-drag-drop/index.min.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
assets/mobile-drag-drop/index.min.js.map


+ 25 - 0
assets/mobile-drag-drop/internal/constants.d.ts

@@ -0,0 +1,25 @@
+export declare const CLASS_PREFIX = "dnd-poly-";
+export declare const CLASS_DRAG_IMAGE: string;
+export declare const CLASS_DRAG_IMAGE_SNAPBACK: string;
+export declare const CLASS_DRAG_OPERATION_ICON: string;
+export declare const EVENT_PREFIX = "dnd-poly-";
+export declare const EVENT_DRAG_DRAGSTART_PENDING: string;
+export declare const EVENT_DRAG_DRAGSTART_CANCEL: string;
+export declare const enum EFFECT_ALLOWED {
+    NONE = 0,
+    COPY = 1,
+    COPY_LINK = 2,
+    COPY_MOVE = 3,
+    LINK = 4,
+    LINK_MOVE = 5,
+    MOVE = 6,
+    ALL = 7,
+}
+export declare const ALLOWED_EFFECTS: string[];
+export declare const enum DROP_EFFECT {
+    NONE = 0,
+    COPY = 1,
+    MOVE = 2,
+    LINK = 3,
+}
+export declare const DROP_EFFECTS: string[];

+ 16 - 0
assets/mobile-drag-drop/internal/dom-utils.d.ts

@@ -0,0 +1,16 @@
+export interface Point {
+    x: number;
+    y: number;
+}
+export declare function isDOMElement(object: Element): string;
+export declare function addDocumentListener(ev: string, handler: EventListener, passive?: boolean): void;
+export declare function removeDocumentListener(ev: string, handler: EventListener): void;
+export declare function onEvt(el: EventTarget, event: string, handler: EventListener, capture?: boolean): {
+    off(): void;
+};
+export declare function createDragImage(sourceNode: HTMLElement): HTMLElement;
+export declare function isTouchIdentifierContainedInTouchEvent(touchEvent: TouchEvent, touchIdentifier: number): boolean;
+export declare function updateCentroidCoordinatesOfTouchesIn(coordinateProp: "page" | "client", event: TouchEvent, outPoint: Point): void;
+export declare function extractTransformStyles(sourceNode: HTMLElement): string[];
+export declare function translateElementToPoint(element: HTMLElement, pnt: Point, originalTransforms: string[], offset?: Point, centerOnCoordinates?: boolean): void;
+export declare function applyDragImageSnapback(sourceEl: HTMLElement, dragImage: HTMLElement, dragImageTransforms: string[], transitionEndCb: Function): void;

+ 27 - 0
assets/mobile-drag-drop/internal/drag-data-store.d.ts

@@ -0,0 +1,27 @@
+export declare const enum DragDataStoreMode {
+    _DISCONNECTED = 0,
+    READONLY = 1,
+    READWRITE = 2,
+    PROTECTED = 3,
+}
+export interface DragDataStore {
+    mode: DragDataStoreMode;
+    data: {
+        [type: string]: any;
+    };
+    types: Array<string>;
+    effectAllowed: string;
+}
+export declare class DataTransfer {
+    private _dataStore;
+    private _setDragImageHandler;
+    private _dropEffect;
+    dropEffect: string;
+    readonly types: ReadonlyArray<string>;
+    effectAllowed: string;
+    constructor(_dataStore: DragDataStore, _setDragImageHandler: (image: Element, x: number, y: number) => void);
+    setData(type: string, data: string): void;
+    getData(type: string): string;
+    clearData(format?: string): void;
+    setDragImage(image: Element, x: number, y: number): void;
+}

+ 38 - 0
assets/mobile-drag-drop/internal/drag-operation-controller.d.ts

@@ -0,0 +1,38 @@
+import { Config } from "../index";
+export declare const enum DragOperationState {
+    POTENTIAL = 0,
+    STARTED = 1,
+    ENDED = 2,
+    CANCELLED = 3,
+}
+export declare class DragOperationController {
+    private _initialEvent;
+    private _config;
+    private _sourceNode;
+    private _dragOperationEndedCb;
+    private _dragOperationState;
+    private _dragImage;
+    private _dragImageTransforms;
+    private _dragImagePageCoordinates;
+    private _dragImageOffset;
+    private _currentHotspotCoordinates;
+    private _immediateUserSelection;
+    private _currentDropTarget;
+    private _dragDataStore;
+    private _dataTransfer;
+    private _currentDragOperation;
+    private _initialTouch;
+    private _touchMoveHandler;
+    private _touchEndOrCancelHandler;
+    private _lastTouchEvent;
+    private _iterationLock;
+    private _iterationIntervalId;
+    constructor(_initialEvent: TouchEvent, _config: Config, _sourceNode: HTMLElement, _dragOperationEndedCb: (config: Config, event: TouchEvent, state: DragOperationState) => void);
+    private _setup();
+    private _cleanup();
+    private _onTouchMove(event);
+    private _onTouchEndOrCancel(event);
+    private _dragAndDropProcessModelIteration();
+    private _dragOperationEnded(state);
+    private _finishDragOperation();
+}

+ 5 - 0
assets/mobile-drag-drop/internal/drag-utils.d.ts

@@ -0,0 +1,5 @@
+import { DataTransfer, DragDataStore } from "./drag-data-store";
+export declare function tryFindDraggableTarget(event: TouchEvent): HTMLElement | undefined;
+export declare function determineDropEffect(effectAllowed: string, sourceNode: Element): string;
+export declare function dispatchDragEvent(dragEvent: string, targetElement: Element, touchEvent: TouchEvent, dataStore: DragDataStore, dataTransfer: DataTransfer, cancelable?: boolean, relatedTarget?: Element | null): boolean;
+export declare function determineDragOperation(effectAllowed: string, dropEffect: string): string;

+ 7 - 0
assets/mobile-drag-drop/internal/feature-detection.d.ts

@@ -0,0 +1,7 @@
+export interface DetectedFeatures {
+    draggable: boolean;
+    dragEvents: boolean;
+    userAgentSupportingNativeDnD: boolean;
+}
+export declare function detectFeatures(): DetectedFeatures;
+export declare function supportsPassiveEventListener(): boolean;

+ 123 - 0
assets/mobile-drag-drop/package.json

@@ -0,0 +1,123 @@
+{
+  "_from": "mobile-drag-drop",
+  "_id": "mobile-drag-drop@2.3.0-rc.2",
+  "_inBundle": false,
+  "_integrity": "sha512-4rHP0PUeWkSp0O3waNHPQZCHeZnLu8bE59MerWOnZJ249BCyICXL1WWp3xqkMKXEDFYuhfk3bS42bKB9IeN9uw==",
+  "_location": "/mobile-drag-drop",
+  "_phantomChildren": {},
+  "_requested": {
+    "type": "tag",
+    "registry": true,
+    "raw": "mobile-drag-drop",
+    "name": "mobile-drag-drop",
+    "escapedName": "mobile-drag-drop",
+    "rawSpec": "",
+    "saveSpec": null,
+    "fetchSpec": "latest"
+  },
+  "_requiredBy": [
+    "#USER",
+    "/"
+  ],
+  "_resolved": "https://registry.npmjs.org/mobile-drag-drop/-/mobile-drag-drop-2.3.0-rc.2.tgz",
+  "_shasum": "00d6e85e04512a620fd5357366e8786bd29aa7aa",
+  "_spec": "mobile-drag-drop",
+  "_where": "/home/ntnsndr/Desktop/communityrule",
+  "author": {
+    "name": "Tim Ruffles",
+    "email": "me@truffles.me.uk"
+  },
+  "bugs": {
+    "url": "https://github.com/timruffles/ios-html5-drag-drop-shim/issues"
+  },
+  "bundleDependencies": false,
+  "contributors": [
+    {
+      "name": "Stefan Steinhart",
+      "email": "stefansteinhart@artec-engineering.com"
+    },
+    {
+      "name": "Kaur Kuut",
+      "email": "strom@nevermore.ee"
+    },
+    {
+      "name": "Tim Ruffles",
+      "email": "me@truffles.me.uk"
+    },
+    {
+      "name": "Joshua-Smith",
+      "email": "noidea@example.com"
+    },
+    {
+      "name": "Jason Hickner",
+      "email": "jhickner@gmail.com"
+    },
+    {
+      "name": "Matt Oakley",
+      "email": "matt@annaandmatt.net"
+    },
+    {
+      "name": "James Smith",
+      "email": "jellyes2@gmail.com"
+    },
+    {
+      "name": "James Shore",
+      "email": "shore.james@gmail.com"
+    },
+    {
+      "name": "Paul Shirren",
+      "email": "shirro@shirro.com"
+    },
+    {
+      "name": "Simon Altschuler",
+      "email": "simon@altschuler.dk"
+    }
+  ],
+  "deprecated": false,
+  "description": "Polyfill for making HTML5 drag and drop possible in all browsers.",
+  "devDependencies": {
+    "grunt": "^1.0.1",
+    "grunt-bump": "^0.8.0",
+    "grunt-contrib-clean": "^1.0.0",
+    "grunt-contrib-connect": "^1.0.2",
+    "grunt-contrib-copy": "^1.0.0",
+    "grunt-contrib-uglify": "^3.3.0",
+    "grunt-contrib-watch": "^1.0.0",
+    "grunt-exec": "^3.0.0",
+    "grunt-npm": "0.0.2",
+    "rollup": "^0.54.1",
+    "rollup-plugin-sourcemaps": "^0.4.2",
+    "tslint": "^5.9.1",
+    "typescript": "^2.6.2"
+  },
+  "homepage": "http://timruffles.github.io/ios-html5-drag-drop-shim/demo/",
+  "keywords": [
+    "dragdrop",
+    "drag-drop",
+    "html5",
+    "shim",
+    "mobile",
+    "polyfill"
+  ],
+  "license": "MIT",
+  "main": "index.min.js",
+  "name": "mobile-drag-drop",
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/timruffles/ios-html5-drag-drop-shim.git"
+  },
+  "scripts": {
+    "build": "grunt compile",
+    "release:build": "grunt build-release",
+    "release:prepare:major": "grunt prepare-release:major",
+    "release:prepare:minor": "grunt prepare-release:minor",
+    "release:prepare:patch": "grunt prepare-release:patch",
+    "release:prepare:prerelease": "grunt prepare-release:prerelease",
+    "release:publish": "grunt publish-release && npm publish release",
+    "release:serve": "grunt serve-release",
+    "start": "grunt",
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "types": "index.d.ts",
+  "version": "2.3.0-rc.2"
+}

+ 7 - 0
assets/mobile-drag-drop/scroll-behaviour.d.ts

@@ -0,0 +1,7 @@
+import { DragImageTranslateOverrideFn } from "./index";
+export interface ScrollOptions {
+    threshold?: number;
+    velocityFn: (velocity: number, threshold: number) => number;
+}
+export declare const scrollBehaviourDragImageTranslateOverride: DragImageTranslateOverrideFn;
+export as namespace MobileDragDrop;

+ 207 - 0
assets/mobile-drag-drop/scroll-behaviour.js

@@ -0,0 +1,207 @@
+(function (global, factory) {
+	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+	typeof define === 'function' && define.amd ? define(['exports'], factory) :
+	(factory((global.MobileDragDrop = global.MobileDragDrop || {})));
+}(this, (function (exports) { 'use strict';
+
+function isTopLevelEl(el) {
+    return (el === document.body || el === document.documentElement);
+}
+function getElementViewportOffset(el, axis) {
+    var offset;
+    if (isTopLevelEl(el)) {
+        offset = (axis === 0) ? el.clientLeft : el.clientTop;
+    }
+    else {
+        var bounds = el.getBoundingClientRect();
+        offset = (axis === 0) ? bounds.left : bounds.top;
+    }
+    return offset;
+}
+function getElementViewportSize(el, axis) {
+    var size;
+    if (isTopLevelEl(el)) {
+        size = (axis === 0) ? window.innerWidth : window.innerHeight;
+    }
+    else {
+        size = (axis === 0) ? el.clientWidth : el.clientHeight;
+    }
+    return size;
+}
+function getSetElementScroll(el, axis, scroll) {
+    var prop = (axis === 0) ? "scrollLeft" : "scrollTop";
+    var isTopLevel = isTopLevelEl(el);
+    if (arguments.length === 2) {
+        if (isTopLevel) {
+            return document.body[prop] || document.documentElement[prop];
+        }
+        return el[prop];
+    }
+    if (isTopLevel) {
+        document.documentElement[prop] += scroll;
+        document.body[prop] += scroll;
+    }
+    else {
+        el[prop] += scroll;
+    }
+}
+function isScrollable(el) {
+    var cs = getComputedStyle(el);
+    if (el.scrollHeight > el.clientHeight && (cs.overflowY === "scroll" || cs.overflowY === "auto")) {
+        return true;
+    }
+    if (el.scrollWidth > el.clientWidth && (cs.overflowX === "scroll" || cs.overflowX === "auto")) {
+        return true;
+    }
+    return false;
+}
+function findScrollableParent(el) {
+    do {
+        if (!el) {
+            return undefined;
+        }
+        if (isScrollable(el)) {
+            return el;
+        }
+        if (el === document.documentElement) {
+            return null;
+        }
+    } while (el = el.parentNode);
+    return null;
+}
+function determineScrollIntention(currentCoordinate, size, threshold) {
+    if (currentCoordinate < threshold) {
+        return -1;
+    }
+    else if (size - currentCoordinate < threshold) {
+        return 1;
+    }
+    return 0;
+}
+function determineDynamicVelocity(scrollIntention, currentCoordinate, size, threshold) {
+    if (scrollIntention === -1) {
+        return Math.abs(currentCoordinate - threshold);
+    }
+    else if (scrollIntention === 1) {
+        return Math.abs(size - currentCoordinate - threshold);
+    }
+    return 0;
+}
+function isScrollEndReached(axis, scrollIntention, scrollBounds) {
+    var currentScrollOffset = (axis === 0) ? (scrollBounds.scrollX) : (scrollBounds.scrollY);
+    if (scrollIntention === 1) {
+        var maxScrollOffset = (axis === 0) ? (scrollBounds.scrollWidth - scrollBounds.width) : (scrollBounds.scrollHeight -
+            scrollBounds.height);
+        return currentScrollOffset >= maxScrollOffset;
+    }
+    else if (scrollIntention === -1) {
+        return (currentScrollOffset <= 0);
+    }
+    return true;
+}
+var _options = {
+    threshold: 75,
+    velocityFn: function (velocity, threshold) {
+        var multiplier = velocity / threshold;
+        var easeInCubic = multiplier * multiplier * multiplier;
+        return easeInCubic * threshold;
+    }
+};
+var _scrollIntentions = {
+    horizontal: 0,
+    vertical: 0
+};
+var _dynamicVelocity = {
+    x: 0,
+    y: 0
+};
+var _scrollAnimationFrameId;
+var _currentCoordinates;
+var _hoveredElement;
+var _scrollableParent;
+var _translateDragImageFn;
+function handleDragImageTranslateOverride(event, currentCoordinates, hoveredElement, translateDragImageFn) {
+    _currentCoordinates = currentCoordinates;
+    _translateDragImageFn = translateDragImageFn;
+    if (_hoveredElement !== hoveredElement) {
+        _hoveredElement = hoveredElement;
+        _scrollableParent = findScrollableParent(_hoveredElement);
+    }
+    var performScrollAnimation = updateScrollIntentions(_currentCoordinates, _scrollableParent, _options.threshold, _scrollIntentions, _dynamicVelocity);
+    if (performScrollAnimation) {
+        scheduleScrollAnimation();
+    }
+    else if (!!_scrollAnimationFrameId) {
+        window.cancelAnimationFrame(_scrollAnimationFrameId);
+        _scrollAnimationFrameId = null;
+    }
+}
+function scheduleScrollAnimation() {
+    if (!!_scrollAnimationFrameId) {
+        return;
+    }
+    _scrollAnimationFrameId = window.requestAnimationFrame(scrollAnimation);
+}
+function scrollAnimation() {
+    var scrollDiffX = 0, scrollDiffY = 0, isTopLevel = isTopLevelEl(_scrollableParent);
+    if (_scrollIntentions.horizontal !== 0) {
+        scrollDiffX = Math.round(_options.velocityFn(_dynamicVelocity.x, _options.threshold) * _scrollIntentions.horizontal);
+        getSetElementScroll(_scrollableParent, 0, scrollDiffX);
+    }
+    if (_scrollIntentions.vertical !== 0) {
+        scrollDiffY = Math.round(_options.velocityFn(_dynamicVelocity.y, _options.threshold) * _scrollIntentions.vertical);
+        getSetElementScroll(_scrollableParent, 1, scrollDiffY);
+    }
+    if (isTopLevel) {
+        _translateDragImageFn(scrollDiffX, scrollDiffY);
+    }
+    else {
+        _translateDragImageFn(0, 0);
+    }
+    _scrollAnimationFrameId = null;
+    if (updateScrollIntentions(_currentCoordinates, _scrollableParent, _options.threshold, _scrollIntentions, _dynamicVelocity)) {
+        scheduleScrollAnimation();
+    }
+}
+function updateScrollIntentions(currentCoordinates, scrollableParent, threshold, scrollIntentions, dynamicVelocity) {
+    if (!currentCoordinates || !scrollableParent) {
+        return false;
+    }
+    var scrollableParentBounds = {
+        x: getElementViewportOffset(scrollableParent, 0),
+        y: getElementViewportOffset(scrollableParent, 1),
+        width: getElementViewportSize(scrollableParent, 0),
+        height: getElementViewportSize(scrollableParent, 1),
+        scrollX: getSetElementScroll(scrollableParent, 0),
+        scrollY: getSetElementScroll(scrollableParent, 1),
+        scrollWidth: scrollableParent.scrollWidth,
+        scrollHeight: scrollableParent.scrollHeight
+    };
+    var currentCoordinatesOffset = {
+        x: currentCoordinates.x - scrollableParentBounds.x,
+        y: currentCoordinates.y - scrollableParentBounds.y
+    };
+    scrollIntentions.horizontal = determineScrollIntention(currentCoordinatesOffset.x, scrollableParentBounds.width, threshold);
+    scrollIntentions.vertical = determineScrollIntention(currentCoordinatesOffset.y, scrollableParentBounds.height, threshold);
+    if (scrollIntentions.horizontal && isScrollEndReached(0, scrollIntentions.horizontal, scrollableParentBounds)) {
+        scrollIntentions.horizontal = 0;
+    }
+    else if (scrollIntentions.horizontal) {
+        dynamicVelocity.x = determineDynamicVelocity(scrollIntentions.horizontal, currentCoordinatesOffset.x, scrollableParentBounds.width, threshold);
+    }
+    if (scrollIntentions.vertical && isScrollEndReached(1, scrollIntentions.vertical, scrollableParentBounds)) {
+        scrollIntentions.vertical = 0;
+    }
+    else if (scrollIntentions.vertical) {
+        dynamicVelocity.y = determineDynamicVelocity(scrollIntentions.vertical, currentCoordinatesOffset.y, scrollableParentBounds.height, threshold);
+    }
+    return !!(scrollIntentions.horizontal || scrollIntentions.vertical);
+}
+var scrollBehaviourDragImageTranslateOverride = handleDragImageTranslateOverride;
+
+exports.scrollBehaviourDragImageTranslateOverride = scrollBehaviourDragImageTranslateOverride;
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
+//# sourceMappingURL=scroll-behaviour.js.map

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
assets/mobile-drag-drop/scroll-behaviour.js.map


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
assets/mobile-drag-drop/scroll-behaviour.min.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
assets/mobile-drag-drop/scroll-behaviour.min.js.map


Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác