forked from simonwep/viselect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselection.min.js.map
1 lines (1 loc) · 41.3 KB
/
selection.min.js.map
1
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./src/utils.js","webpack:///./src/selection.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","eventListener","method","elements","events","fn","options","HTMLCollection","NodeList","Array","from","isArray","element","event","_objectSpread","capture","slice","arguments","on","off","unitify","val","unit","css","el","attr","style","prop","dw","document","defaultView","getComputedStyle","currentStyle","intersects","a","b","bxc","left","width","byc","top","height","right","bottom","selectAll","selector","nodes","sel","push","querySelectorAll","eventPath","evt","path","composedPath","target","parentElement","removeElement","arr","index","indexOf","splice","simplifyEvent","tap","touches","x","clientX","y","clientY","isElement","HTMLElement","nodeType","nodeName","abs","max","min","round","Math","doc","preventDefault","e","Selection","that","assign","class","startThreshold","singleClick","disableTouch","validateStart","selectables","scrollSpeedDivider","startareas","boundaries","selectionAreaContainer","_selectedStore","_areaElement","createElement","_clippingElement","_scrollAvailable","_scrollSpeed","_selectionAreaContainer","_init","_","querySelector","appendChild","willChange","position","overflow","transform","pointerEvents","zIndex","enable","_bindStartEvents","type","_onTapStart","passive","targetBoundingClientRect","getBoundingClientRect","startAreas","_boundaries","evtpath","find","includes","_areaX1","_areaY1","_areaX2","_areaY2","_singleClick","_targetContainer","resolveSelectables","_targetBoundary","_touchedElements","_changedElements","added","removed","scrollHeight","scrollWidth","_manualScroll","_selectables","filter","contains","marginTop","marginLeft","margin-top","margin-left","classList","add","_delayedTapMove","_onTapStop","_onSingleTap","_dispatchEvent","_onTapMove","_redrawArea","_updatedTouchingElements","scon","requestAnimationFrame","scroll","scrollTop","scrollLeft","ceil","wheelDeltaY","wheelDeltaX","clientHeight","clientWidth","brect","x3","y3","x4","y4","noevent","touched","changed","areaRect","node","length","_dispatchFilterEvent","eventName","selection","originalEvent","additional","selection_objectSpread","areaElement","selectedElements","concat","changedElements","keepSelection","clearSelection","removeFromSelection","getSelection","cancel","keepEvent","option","disable","destroy","removeChild","utils","version"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OAAA,GAAAH,GACA,iBAAAC,QACAA,QAAA,UAAAD,IAEAD,EAAA,UAAAC,IARA,CASCK,OAAA,WACD,mBCTA,IAAAC,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAP,QAGA,IAAAC,EAAAI,EAAAE,GAAA,CACAC,EAAAD,EACAE,GAAA,EACAT,QAAA,IAUA,OANAU,EAAAH,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAQ,GAAA,EAGAR,EAAAD,QA0DA,OArDAM,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGAC,EAAAQ,EAAA,SAAAd,EAAAe,EAAAC,GACAV,EAAAW,EAAAjB,EAAAe,IACAG,OAAAC,eAAAnB,EAAAe,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CV,EAAAgB,EAAA,SAAAtB,GACA,oBAAAuB,eAAAC,aACAN,OAAAC,eAAAnB,EAAAuB,OAAAC,YAAA,CAAwDC,MAAA,WAExDP,OAAAC,eAAAnB,EAAA,cAAiDyB,OAAA,KAQjDnB,EAAAoB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAAnB,EAAAmB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFAxB,EAAAgB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WA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esContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Selection\"] = factory();\n\telse\n\t\troot[\"Selection\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"dist/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","function eventListener(method, elements, events, fn, options = {}) {\r\n\r\n // Normalize array\r\n if (elements instanceof HTMLCollection || elements instanceof NodeList) {\r\n elements = Array.from(elements);\r\n } else if (!Array.isArray(elements)) {\r\n elements = [elements];\r\n }\r\n\r\n if (!Array.isArray(events)) events = [events];\r\n\r\n for (const element of elements) {\r\n for (const event of events) {\r\n element[method](event, fn, {capture: false, ...options});\r\n }\r\n }\r\n\r\n return Array.prototype.slice.call(arguments, 1);\r\n}\r\n\r\n/**\r\n * Add event(s) to element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const on = eventListener.bind(null, 'addEventListener');\r\n\r\n/**\r\n * Remove event(s) from element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const off = eventListener.bind(null, 'removeEventListener');\r\n\r\nconst unitify = (val, unit = 'px') => typeof val === 'number' ? val + unit : '' + val;\r\n\r\n/**\r\n * Add css to a DOM-Element or returns the current\r\n * value of a property.\r\n *\r\n * @param el The Element.\r\n * @param attr The attribute or a object which holds css key-properties.\r\n * @param val The value for a single attribute.\r\n * @returns {*}\r\n */\r\nexport function css(el, attr, val) {\r\n const style = el && el.style;\r\n if (!style) return;\r\n\r\n if (typeof attr === 'object') {\r\n\r\n for (const prop in attr) {\r\n style[prop] = unitify(attr[prop]);\r\n }\r\n\r\n } else if (val == null) {\r\n\r\n const dw = document.defaultView;\r\n if (dw && dw.getComputedStyle) {\r\n val = dw.getComputedStyle(el, null);\r\n } else if (el.currentStyle) {\r\n val = el.currentStyle;\r\n }\r\n\r\n return attr == null ? val : val[attr];\r\n } else {\r\n style[attr] = unitify(val);\r\n }\r\n}\r\n\r\n/**\r\n * Check if two DOM-Elements intersects each other.\r\n * @param a BoundingClientRect of the first element.\r\n * @param b BoundingClientRect of the second element.\r\n * @param mode Options are center, cover or touch.\r\n * @returns {boolean} If both elements intersects each other.\r\n */\r\nexport function intersects(a, b, mode = 'touch') {\r\n\r\n if (mode === 'center') {\r\n const bxc = b.left + b.width / 2;\r\n const byc = b.top + b.height / 2;\r\n\r\n return bxc >= a.left\r\n && bxc <= a.right\r\n && byc >= a.top\r\n && byc <= a.bottom;\r\n } else if (mode === 'cover') {\r\n return b.left >= a.left\r\n && b.top >= a.top\r\n && b.right <= a.right\r\n && b.bottom <= a.bottom;\r\n } else if (mode === 'touch') {\r\n return a.right >= b.left\r\n && a.left <= b.right\r\n && a.bottom >= b.top\r\n && a.top <= b.bottom;\r\n }\r\n}\r\n\r\n/**\r\n * Takes a selector (or array of selectors) and returns the matched nodes.\r\n * @param selector The selector or an Array of selectors.\r\n * @returns {Array} Array of DOM-Nodes.\r\n */\r\nexport function selectAll(selector) {\r\n if (!Array.isArray(selector)) selector = [selector];\r\n\r\n const nodes = [];\r\n for (const sel of selector) {\r\n nodes.push(...document.querySelectorAll(sel));\r\n }\r\n\r\n return nodes;\r\n}\r\n\r\n/**\r\n * Polyfill for safari & firefox for the eventPath event property.\r\n * @param evt The event object.\r\n * @return [String] event path.\r\n */\r\nexport function eventPath(evt) {\r\n let path = evt.path || (evt.composedPath && evt.composedPath());\r\n if (path) return path;\r\n\r\n let el = evt.target.parentElement;\r\n path = [evt.target, el];\r\n while (el = el.parentElement) path.push(el);\r\n\r\n path.push(document, window);\r\n return path;\r\n}\r\n\r\n/**\r\n * Removes an element from an Array.\r\n */\r\nexport function removeElement(arr, el) {\r\n const index = arr.indexOf(el);\r\n if (~index) arr.splice(index, 1);\r\n}\r\n\r\nexport function simplifyEvent(evt) {\r\n const tap = (evt.touches && evt.touches[0] || evt);\r\n return {\r\n tap,\r\n x: tap.clientX,\r\n y: tap.clientY,\r\n target: tap.target\r\n };\r\n}\r\n\r\n/**\r\n * Checks if value is likely a DOM element.\r\n */\r\nexport function isElement(value) {\r\n return (\r\n typeof HTMLElement === \"object\"\r\n ? value instanceof HTMLElement\r\n : typeof value === \"object\" && value !== null && value.nodeType === 1 && typeof value.nodeName === \"string\"\r\n );\r\n}","/**\r\n * Selection, library to realize visual DOM-Selection like on your Desktop.\r\n *\r\n * @author Simon Reinisch\r\n * @license MIT\r\n */\r\n\r\n// Import utils\r\nimport * as _ from './utils';\r\n\r\n// Some var shorting for better compression and readability\r\nconst {abs, max, min, round} = Math;\r\nconst doc = document;\r\nconst preventDefault = e => e.preventDefault();\r\n\r\nfunction Selection(options = {}) {\r\n\r\n const that = {\r\n\r\n options: Object.assign({\r\n class: 'selection-area',\r\n\r\n mode: 'touch',\r\n startThreshold: 10,\r\n singleClick: true,\r\n disableTouch: false,\r\n\r\n validateStart: () => true,\r\n\r\n selectables: [],\r\n\r\n scrollSpeedDivider: 10,\r\n\r\n startareas: ['html'],\r\n boundaries: ['html'],\r\n\r\n selectionAreaContainer: 'body'\r\n }, options),\r\n\r\n // Store for keepSelection\r\n _selectedStore: [],\r\n\r\n // Create area element\r\n _areaElement: doc.createElement('div'),\r\n _clippingElement: doc.createElement('div'),\r\n\r\n // Is getting set on movement. Varied.\r\n _scrollAvailable: true,\r\n _scrollSpeed: {x: null, y: null},\r\n\r\n // Selection-area parent\r\n _selectionAreaContainer: null,\r\n\r\n _init() {\r\n\r\n // Append area to container\r\n if (_.isElement(that.options.selectionAreaContainer)) {\r\n that._selectionAreaContainer = that.options.selectionAreaContainer;\r\n } else {\r\n that._selectionAreaContainer = doc.querySelector(that.options.selectionAreaContainer);\r\n }\r\n\r\n that._clippingElement.appendChild(that._areaElement);\r\n that._selectionAreaContainer.appendChild(that._clippingElement);\r\n\r\n // Apply basic styles to the area element\r\n _.css(that._areaElement, {\r\n willChange: 'top, left, bottom, right, width, height',\r\n top: 0,\r\n left: 0,\r\n position: 'fixed'\r\n });\r\n\r\n _.css(that._clippingElement, {\r\n overflow: 'hidden',\r\n position: 'fixed',\r\n transform: 'translate3d(0, 0, 0)', // https://stackoverflow.com/a/38268846\r\n pointerEvents: 'none',\r\n zIndex: 1\r\n });\r\n\r\n that.enable();\r\n },\r\n\r\n _bindStartEvents(type) {\r\n _[type](doc, 'mousedown', that._onTapStart);\r\n\r\n if (!that.options.disableTouch) {\r\n _[type](doc, 'touchstart', that._onTapStart, {\r\n passive: false\r\n });\r\n }\r\n },\r\n\r\n _onTapStart(evt) {\r\n const {x, y, target} = _.simplifyEvent(evt);\r\n const targetBoundingClientRect = target.getBoundingClientRect();\r\n\r\n // Check mouse middleware\r\n if (!that.options.validateStart(evt)) {\r\n return;\r\n }\r\n\r\n // Find start-areas and boundaries\r\n const startAreas = _.selectAll(that.options.startareas);\r\n that._boundaries = _.selectAll(that.options.boundaries);\r\n\r\n // Check if area starts in one of the start areas / boundaries\r\n const evtpath = _.eventPath(evt);\r\n if (!startAreas.find(el => evtpath.includes(el)) ||\r\n !that._boundaries.find(el => evtpath.includes(el))) {\r\n return;\r\n }\r\n\r\n // Area start point\r\n that._areaX1 = x;\r\n that._areaY1 = y;\r\n\r\n // Area end point\r\n that._areaX2 = 0;\r\n that._areaY2 = 0;\r\n\r\n that._singleClick = true; // To detect single-click\r\n\r\n // Check in which container the user currently acts\r\n that._targetContainer = that._boundaries.find(el =>\r\n _.intersects(el.getBoundingClientRect(), targetBoundingClientRect)\r\n );\r\n\r\n if (!that._targetContainer) {\r\n return;\r\n }\r\n\r\n that.resolveSelectables();\r\n\r\n // Just saving the boundaries of this container for later\r\n that._targetBoundary = that._targetContainer.getBoundingClientRect();\r\n that._touchedElements = [];\r\n that._changedElements = {\r\n added: [],\r\n removed: []\r\n };\r\n\r\n // Find container and check if it's scrollable\r\n if (round(that._targetContainer.scrollHeight) !== round(that._targetBoundary.height) ||\r\n round(that._targetContainer.scrollWidth) !== round(that._targetBoundary.width)) {\r\n\r\n // Indenticates if the user is currently in a scrollable area\r\n that._scrollAvailable = true;\r\n\r\n // Detect mouse scrolling\r\n _.on(window, 'wheel', that._manualScroll);\r\n\r\n /**\r\n * The selection-area will also cover other element which are\r\n * out of the current scrollable parent. So find all elements\r\n * which are in the current scrollable element. Later these are\r\n * the only selectables instead of all.\r\n */\r\n that._selectables = that._selectables.filter(s => that._targetContainer.contains(s));\r\n\r\n /**\r\n * To clip the area, the selection area has a parent\r\n * which has exact the same dimensions as the scrollable elemeent.\r\n * Now if the area exeeds these boundaries it will be cropped.\r\n */\r\n _.css(that._clippingElement, {\r\n top: that._targetBoundary.top,\r\n left: that._targetBoundary.left,\r\n width: that._targetBoundary.width,\r\n height: that._targetBoundary.height\r\n });\r\n\r\n /**\r\n * The area element is relative to the clipping element,\r\n * but when this is moved or transformed we need to correct\r\n * the positions via a negative margin.\r\n */\r\n _.css(that._areaElement, {\r\n marginTop: -that._targetBoundary.top,\r\n marginLeft: -that._targetBoundary.left\r\n });\r\n } else {\r\n that._scrollAvailable = false;\r\n\r\n /**\r\n * Reset margin and clipping element dimensions.\r\n */\r\n _.css(that._clippingElement, {\r\n top: 0,\r\n left: 0,\r\n width: '100%',\r\n height: '100%'\r\n });\r\n\r\n _.css(that._areaElement, {\r\n 'margin-top': 0,\r\n 'margin-left': 0\r\n });\r\n }\r\n\r\n // Add class to the area element\r\n that._areaElement.classList.add(that.options.class);\r\n\r\n // Prevent default select event\r\n _.on(doc, 'selectstart', preventDefault);\r\n\r\n // Add listener\r\n _.on(doc, 'mousemove', that._delayedTapMove);\r\n _.on(doc, 'touchmove', that._delayedTapMove, {\r\n passive: false\r\n });\r\n\r\n _.on(doc, ['mouseup', 'touchcancel', 'touchend'], that._onTapStop);\r\n evt.preventDefault();\r\n },\r\n\r\n _onSingleTap(evt) {\r\n let {target} = _.simplifyEvent(evt);\r\n\r\n // Traverse dom upwards to check if target is selectable\r\n while (!that._selectables.includes(target)) {\r\n if (target.parentElement) {\r\n target = target.parentElement;\r\n } else {\r\n return;\r\n }\r\n }\r\n\r\n that._touchedElements.push(target);\r\n that._dispatchEvent('onSelect', evt, {\r\n target\r\n });\r\n },\r\n\r\n _delayedTapMove(evt) {\r\n const {x, y} = _.simplifyEvent(evt);\r\n\r\n // Check pixel threshold\r\n if (abs((x + y) - (that._areaX1 + that._areaY1)) >= that.options.startThreshold) {\r\n\r\n _.off(doc, ['mousemove', 'touchmove'], that._delayedTapMove);\r\n _.on(doc, ['mousemove', 'touchmove'], that._onTapMove);\r\n _.css(that._areaElement, 'display', 'block');\r\n\r\n // New start position\r\n that._onTapMove(evt);\r\n\r\n // Fire event\r\n that._dispatchEvent('onStart', evt);\r\n\r\n // An action is recognized as single-select until\r\n // the user performed a mutli-selection\r\n that._singleClick = false;\r\n }\r\n },\r\n\r\n _onTapMove(evt) {\r\n const {x, y} = _.simplifyEvent(evt);\r\n that._areaX2 = x;\r\n that._areaY2 = y;\r\n\r\n if (that._scrollAvailable && (that._scrollSpeed.y !== null || that._scrollSpeed.x !== null)) {\r\n const scon = that._targetContainer;\r\n\r\n // Continous scrolling\r\n requestAnimationFrame(function scroll() {\r\n\r\n // Scrolling is not anymore required\r\n if (that._scrollSpeed.y === null && that._scrollSpeed.x === null) {\r\n return;\r\n }\r\n\r\n /**\r\n * If the value exeeds the scrollable area it will\r\n * be set to the max / min value. So change only\r\n */\r\n const {scrollTop, scrollLeft} = scon;\r\n\r\n // Reduce velocity, use ceil in both directions to scroll at least 1px per frame\r\n if (that._scrollSpeed.y !== null) {\r\n scon.scrollTop += Math.ceil(that._scrollSpeed.y / that.options.scrollSpeedDivider);\r\n that._areaY1 -= scon.scrollTop - scrollTop;\r\n }\r\n\r\n if (that._scrollSpeed.x !== null) {\r\n scon.scrollLeft += Math.ceil(that._scrollSpeed.x / that.options.scrollSpeedDivider);\r\n that._areaX1 -= scon.scrollLeft - scrollLeft;\r\n }\r\n\r\n /**\r\n * We changed the start coordinates -> redraw the selectiona area\r\n * We changed the dimensions of the area element -> re-calc selected elements\r\n * The selected elements array has been changed -> fire event\r\n */\r\n that._redrawArea();\r\n that._updatedTouchingElements();\r\n that._dispatchEvent('onMove', evt);\r\n\r\n // Keep scrolling even if the user stops to move his pointer\r\n requestAnimationFrame(scroll);\r\n });\r\n } else {\r\n\r\n /**\r\n * Perform redraw only if scrolling is not active.\r\n * If scrolling is active this area is getting re-dragwed by the\r\n * anonymized scroll function.\r\n */\r\n that._redrawArea();\r\n that._updatedTouchingElements();\r\n that._dispatchEvent('onMove', evt);\r\n }\r\n },\r\n\r\n _manualScroll(evt) {\r\n that._scrollSpeed.y += that.options.scrollSpeedDivider * (evt.wheelDeltaY * -1);\r\n that._scrollSpeed.x += that.options.scrollSpeedDivider * (evt.wheelDeltaX * -1);\r\n that._onTapMove(evt);\r\n\r\n // Prevent defaul scrolling behaviour, eg. page scrolling\r\n evt.preventDefault();\r\n },\r\n\r\n _redrawArea() {\r\n const {scrollTop, scrollHeight, clientHeight, scrollLeft, scrollWidth, clientWidth} = that._targetContainer;\r\n const brect = that._targetBoundary;\r\n let x = that._areaX2;\r\n let y = that._areaY2;\r\n\r\n if (x < brect.left) {\r\n that._scrollSpeed.x = scrollLeft ? -Math.abs(brect.left - x) : null;\r\n x = brect.left;\r\n } else if (x > brect.left + brect.width) {\r\n that._scrollSpeed.x = scrollWidth - scrollLeft - clientWidth ? Math.abs(brect.left + brect.width - x) : null;\r\n x = brect.left + brect.width;\r\n } else {\r\n that._scrollSpeed.x = null;\r\n }\r\n\r\n if (y < brect.top) {\r\n that._scrollSpeed.y = scrollTop ? -Math.abs(brect.top - y) : null;\r\n y = brect.top;\r\n } else if (y > brect.top + brect.height) {\r\n that._scrollSpeed.y = scrollHeight - scrollTop - clientHeight ? Math.abs(brect.top + brect.height - y) : null;\r\n y = brect.top + brect.height;\r\n } else {\r\n that._scrollSpeed.y = null;\r\n }\r\n\r\n const x3 = min(that._areaX1, x);\r\n const y3 = min(that._areaY1, y);\r\n const x4 = max(that._areaX1, x);\r\n const y4 = max(that._areaY1, y);\r\n\r\n _.css(that._areaElement, {\r\n top: y3,\r\n left: x3,\r\n width: x4 - x3,\r\n height: y4 - y3\r\n });\r\n },\r\n\r\n _onTapStop(evt, noevent) {\r\n\r\n // Remove event handlers\r\n _.off(doc, ['mousemove', 'touchmove'], that._delayedTapMove);\r\n _.off(doc, ['touchmove', 'mousemove'], that._onTapMove);\r\n _.off(doc, ['mouseup', 'touchcancel', 'touchend'], that._onTapStop);\r\n\r\n if (that._singleClick && that.options.singleClick) {\r\n that._onSingleTap(evt);\r\n } else if (!that._singleClick && !noevent) {\r\n that._updatedTouchingElements();\r\n that._dispatchEvent('onStop', evt);\r\n }\r\n\r\n // Reset scroll speed\r\n that._scrollSpeed = {x: null, y: null};\r\n\r\n // Unbind mouse scrolling listener\r\n _.off(window, 'wheel', that._manualScroll);\r\n\r\n // Enable default select event\r\n _.off(doc, 'selectstart', preventDefault);\r\n _.css(that._areaElement, 'display', 'none');\r\n },\r\n\r\n _updatedTouchingElements() {\r\n const touched = [];\r\n const changed = {added: [], removed: []};\r\n\r\n const mode = that.options.mode;\r\n const selectables = that._selectables;\r\n const areaRect = that._areaElement.getBoundingClientRect();\r\n\r\n // Itreate over the selectable elements\r\n for (let i = 0, n = selectables.length, node; node = selectables[i], i < n; i++) {\r\n\r\n // Check if area intersects element\r\n if (_.intersects(areaRect, node.getBoundingClientRect(), mode)) {\r\n\r\n // Fire filter event\r\n if (that._dispatchFilterEvent('selectionFilter', node) !== false) {\r\n\r\n // Check if the element wasn't present in the last selection.\r\n if (!that._touchedElements.includes(node)) {\r\n changed.added.push(node);\r\n }\r\n\r\n touched.push(node);\r\n }\r\n }\r\n }\r\n\r\n // Check which elements where removed since last selection\r\n for (let i = 0, n = that._touchedElements.length, el; el = that._touchedElements[i], i < n; i++) {\r\n if (!touched.includes(el)) {\r\n changed.removed.push(el);\r\n }\r\n }\r\n\r\n // Save\r\n that._touchedElements = touched;\r\n that._changedElements = changed;\r\n },\r\n\r\n _dispatchFilterEvent(eventName, element) {\r\n const event = that.options[eventName];\r\n\r\n // Validate function\r\n if (typeof event === 'function') {\r\n return event.call(that, {selection: that, eventName, element});\r\n }\r\n },\r\n\r\n _dispatchEvent(eventName, originalEvent, additional) {\r\n const event = that.options[eventName];\r\n\r\n // Validate function\r\n if (typeof event === 'function') {\r\n return event.call(that, {\r\n selection: that,\r\n areaElement: that._areaElement,\r\n selectedElements: that._touchedElements.concat(that._selectedStore),\r\n changedElements: that._changedElements,\r\n eventName,\r\n originalEvent,\r\n ...additional\r\n });\r\n }\r\n },\r\n\r\n /**\r\n * Can be used if during a selection elements have been added.\r\n * Will update everything which can be selected.\r\n */\r\n resolveSelectables() {\r\n\r\n // Resolve selectors\r\n that._selectables = _.selectAll(that.options.selectables);\r\n },\r\n\r\n /**\r\n * Saves the current selection for the next selecion.\r\n * Allows multiple selections.\r\n */\r\n keepSelection() {\r\n for (let i = 0, n = that._touchedElements.length, el; el = that._touchedElements[i], i < n; i++) {\r\n if (!that._selectedStore.includes(el)) {\r\n that._selectedStore.push(el);\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * Clear the elements which where saved by 'keepSelection()'.\r\n */\r\n clearSelection() {\r\n that._selectedStore = [];\r\n },\r\n\r\n /**\r\n * Removes an particular element from the selection.\r\n */\r\n removeFromSelection(el) {\r\n _.removeElement(that._selectedStore, el);\r\n _.removeElement(that._touchedElements, el);\r\n },\r\n\r\n /**\r\n * @returns {Array} Selected elements\r\n */\r\n getSelection() {\r\n return that._selectedStore;\r\n },\r\n\r\n /**\r\n * Cancel the current selection process.\r\n * @param keepEvent {boolean} true to fire the onStop listener after cancel.\r\n */\r\n cancel(keepEvent = false) {\r\n that._onTapStop(null, !keepEvent);\r\n },\r\n\r\n /**\r\n * Set or get an option.\r\n * @param {string} name\r\n * @param {*} value\r\n * @return {*} the new value\r\n */\r\n option(name, value) {\r\n const {options} = that;\r\n return value == null ? options[name] : (options[name] = value);\r\n },\r\n\r\n /**\r\n * Disable the selection functinality.\r\n */\r\n disable() {\r\n that._bindStartEvents('off');\r\n },\r\n\r\n /**\r\n * Unbinds all events and removes the area-element\r\n */\r\n destroy() {\r\n that.disable();\r\n that._selectionAreaContainer.removeChild(that._clippingElement);\r\n },\r\n\r\n /**\r\n * Disable the selection functinality.\r\n */\r\n enable() {\r\n that._bindStartEvents('on');\r\n }\r\n };\r\n\r\n // Initialize\r\n that._init();\r\n\r\n return that;\r\n}\r\n\r\n// Export utils\r\nSelection.utils = {\r\n on: _.on,\r\n off: _.off,\r\n css: _.css,\r\n intersects: _.intersects,\r\n selectAll: _.selectAll,\r\n eventPath: _.eventPath,\r\n removeElement: _.removeElement\r\n};\r\n\r\n/**\r\n * Create selection instance\r\n * @param {Object} [options]\r\n */\r\nSelection.create = options => new Selection(options);\r\n\r\n// Set version\r\nSelection.version = '0.2.2';\r\n\r\n// Export API\r\nexport default Selection;\r\n"],"sourceRoot":""}