mobius1-selectable
Advanced tools
Comparing version 0.0.11 to 0.0.12
{ | ||
"name": "mobius1-selectable", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"ignore": [ | ||
@@ -5,0 +5,0 @@ ".gitattributes", |
{ | ||
"name": "mobius1-selectable", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "UI Selectable plugin without the bloat of jQuery and jQuery UI.", | ||
@@ -5,0 +5,0 @@ "main": "selectable.min.js", |
@@ -8,3 +8,3 @@ /*! | ||
* | ||
* Version: 0.0.11 | ||
* Version: 0.0.12 | ||
* | ||
@@ -116,51 +116,73 @@ */ | ||
/** | ||
* Emulate jQuery's css method | ||
* @param {Object} el HTMLElement | ||
* @param {(Object|String)} prop Object of CSS properties and values or CSS propery string | ||
* @param {Object} val CSS property value | ||
* @return {Object|Void} | ||
* Mass assign style properties | ||
* @param {Object} t | ||
* @param {(String|Object)} e | ||
* @param {String|Object} | ||
*/ | ||
var css = function(el, prop, val) { | ||
var style = el && el.style, | ||
isObj = isObject(prop); | ||
var css = function(i, t, e) { | ||
var n = i && i.style, | ||
o = isObject(t); | ||
if (n) { | ||
if (void 0 === e && !o) return e = window.getComputedStyle(i, ""), void 0 === t ? e : e[t]; | ||
o ? each(t, function(i, t) { | ||
t in n || (t = "-webkit-" + t), n[t] = i + ("string" == typeof i ? "" : "opacity" === t ? "" : "px") | ||
}) : (t in n || (t = "-webkit-" + t), n[t] = e + ("string" == typeof e ? "" : "opacity" === t ? "" : "px")) | ||
} | ||
}; | ||
if (style) { | ||
if (val === void 0 && !isObj) { | ||
val = window.getComputedStyle(el, ''); | ||
return prop === void 0 ? val : val[prop]; | ||
} else { | ||
if (isObj) { | ||
each(prop, function(v, p) { | ||
if (!(p in style)) { | ||
p = '-webkit-' + p; | ||
} | ||
style[p] = v + (typeof v === 'string' ? '' : p === "opacity" ? "" : "px"); | ||
}); | ||
} else { | ||
if (!(prop in style)) { | ||
prop = '-webkit-' + prop; | ||
} | ||
style[prop] = val + (typeof val === 'string' ? '' : prop === "opacity" ? "" : "px"); | ||
} | ||
} | ||
/** | ||
* Get an element's DOMRect relative to the document instead of the viewport. | ||
* @param {Object} t HTMLElement | ||
* @param {Boolean} e Include margins | ||
* @return {Object} Formatted DOMRect copy | ||
*/ | ||
var rect = function(e) { | ||
var w = window, | ||
o = e.getBoundingClientRect(), | ||
b = document.documentElement || document.body.parentNode || document.body, | ||
d = (void 0 !== w.pageXOffset) ? w.pageXOffset : b.scrollLeft, | ||
n = (void 0 !== w.pageYOffset) ? w.pageYOffset : b.scrollTop; | ||
return { | ||
x1: o.left + d, | ||
x2: o.left + o.width + d, | ||
y1: o.top + n, | ||
y2: o.top + o.height + n, | ||
height: o.height, | ||
width: o.width | ||
} | ||
} | ||
}; | ||
var debounce = function(a, b, c) { | ||
var d; | ||
/** | ||
* Returns a function, that, as long as it continues to be invoked, will not be triggered. | ||
* @param {Function} fn | ||
* @param {Number} wait | ||
* @param {Boolean} now | ||
* @return {Function} | ||
*/ | ||
var debounce = function(n, t, u) { | ||
var e; | ||
return function() { | ||
var e = this, | ||
f = arguments, | ||
g = function() { | ||
d = null, c || a.apply(e, f) | ||
}, | ||
h = c && !d; | ||
clearTimeout(d), d = setTimeout(g, b), h && a.apply(e, f) | ||
var i = this, | ||
o = arguments, | ||
a = u && !e; | ||
clearTimeout(e), e = setTimeout(function() { | ||
e = null, u || n.apply(i, o) | ||
}, t), a && n.apply(i, o) | ||
} | ||
}; | ||
} | ||
var preventDefault = function(a) { | ||
return a = a || window.event, a.preventDefault ? a.preventDefault() : a.returnValue = !1 | ||
/** | ||
* preventDefault | ||
* @param {Object} e Event interface | ||
* @return {Boolean} | ||
*/ | ||
var preventDefault = function(e) { | ||
return e = e || window.event, e.preventDefault ? e.preventDefault() : e.returnValue = !1 | ||
}; | ||
/** | ||
* Detect CTRL or META key press | ||
* @param {Object} e Event interface | ||
* @return {Boolean} | ||
*/ | ||
var isCmdKey = function(e) { | ||
@@ -170,2 +192,7 @@ return !!e.ctrlKey || !!e.metaKey | ||
/** | ||
* Detect SHIFT key press | ||
* @param {Object} e Event interface | ||
* @return {Boolean} | ||
*/ | ||
var isShiftKey = function(e) { | ||
@@ -217,12 +244,10 @@ return !!e.shiftKey; | ||
/* lasso */ | ||
var lasso = document.createElement('div'); | ||
lasso.className = 'ui-lasso'; | ||
lasso.style.position = "fixed"; | ||
this.lasso = document.createElement('div'); | ||
this.lasso.className = 'ui-lasso'; | ||
each(this.config.lasso, function(val, prop) { | ||
lasso.style[prop] = val; | ||
}); | ||
css(this.lasso, extend({ | ||
position: "fixed", | ||
opacity: 0, // border will show event at zero width / height | ||
}, this.config.lasso)); | ||
this.lasso = lasso; | ||
if (typeof this.config.appendTo === 'string' || this.config.appendTo instanceof String) { | ||
@@ -252,3 +277,3 @@ this.container = document.querySelector(this.config.appendTo); | ||
element: elem, | ||
rect: elem.getBoundingClientRect(), | ||
rect: rect(elem), | ||
startselected: false, | ||
@@ -297,23 +322,22 @@ selected: elem.classList.contains("ui-selected"), | ||
if (isShiftKey(e)) { | ||
var item = false; | ||
var items = []; | ||
for (var i = 0; i < this.items.length; i++) { | ||
var found = false; | ||
// Look back over the items until we find the on we've clicked | ||
for (var i = this.items.length - 1; i >= 0; i--) { | ||
// found the item we clicked | ||
if (this.items[i].element === e.target) { | ||
item = this.items[i]; | ||
break; | ||
found = true; | ||
} | ||
}; | ||
var found = false; | ||
for (var i = item.index; i >= 0; i--) { | ||
// found a selected item so stop | ||
if (this.items[i].selected) { | ||
found = true; | ||
break; | ||
} | ||
if (found && !this.items[i].selected) { | ||
break; | ||
// continue selecting items until we find a selected item | ||
// or the first item if there aren't any | ||
if (found) { | ||
this.items[i].selecting = true; | ||
} | ||
this.items[i].selecting = true; | ||
}; | ||
} | ||
} | ||
@@ -375,2 +399,3 @@ | ||
css(this.lasso, { | ||
opacity: 1, | ||
left: c.x1, | ||
@@ -387,5 +412,5 @@ width: c.x2 - c.x1, | ||
if (o.tolerance == 'touch') { | ||
over = !(item.rect.left > c.x2 || (item.rect.right < c.x1 || (item.rect.top > c.y2 || item.rect.bottom < c.y1))); | ||
over = !(item.rect.x1 > c.x2 || (item.rect.x2 < c.x1 || (item.rect.y1 > c.y2 || item.rect.y2 < c.y1))); | ||
} else if (o.tolerance == 'fit') { | ||
over = item.rect.left > c.x1 && (item.rect.right < c.x2 && (item.rect.top > c.y1 && item.rect.bottom < c.y2)); | ||
over = item.rect.x1 > c.x1 && (item.rect.x2 < c.x2 && (item.rect.y1 > c.y1 && item.rect.y2 < c.y2)); | ||
} | ||
@@ -460,2 +485,3 @@ if (over) { | ||
css(this.lasso, { | ||
opacity: 0, | ||
left: 0, | ||
@@ -533,3 +559,3 @@ width: 0, | ||
each(this.nodes, function(el, i) { | ||
this.items[i].rect = el.getBoundingClientRect(); | ||
this.items[i].rect = rect(el); | ||
}, this); | ||
@@ -536,0 +562,0 @@ }; |
@@ -8,5 +8,5 @@ /*! | ||
* | ||
* Version: 0.0.11 | ||
* Version: 0.0.12 | ||
* | ||
*/ | ||
!function(e,t){"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define([],t):e.Selectable=t()}("undefined"!=typeof global?global:this.window||this.global,function(){"use strict";function e(e,t,s,i){e.addEventListener(t,s,!1)}function t(e,t,s){e.removeEventListener(t,s)}function s(e){this.config=o(i,e),h.mixin(this),this.init()}var i={appendTo:document.body,autoRefresh:!0,filter:"*",tolerance:"touch",lasso:{border:"1px solid #3498db",backgroundColor:"rgba(52, 152, 219, 0.2)"}},n=function(e){return"[object Object]"===Object.prototype.toString.call(e)},o=function(e,t){for(var s in t)if(t.hasOwnProperty(s)){var i=t[s];i&&n(i)?(e[s]=e[s]||{},o(e[s],i)):e[s]=i}return e},c=function(e,t,s){var i;if(n(e))for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(s,e[i],i);else for(i=0;i<e.length;i++)t.call(s,e[i],i)},l=function(e,t,s){var i=e&&e.style,o=n(t);if(i){if(void 0===s&&!o)return s=window.getComputedStyle(e,""),void 0===t?s:s[t];o?c(t,function(e,t){t in i||(t="-webkit-"+t),i[t]=e+("string"==typeof e?"":"opacity"===t?"":"px")}):(t in i||(t="-webkit-"+t),i[t]=s+("string"==typeof s?"":"opacity"===t?"":"px"))}},r=function(e,t,s){var i;return function(){var n=this,o=arguments,c=s&&!i;clearTimeout(i),i=setTimeout(function(){i=null,s||e.apply(n,o)},t),c&&e.apply(n,o)}},a=function(e){return e=e||window.event,e.preventDefault?e.preventDefault():e.returnValue=!1},u=function(e){return!!e.ctrlKey||!!e.metaKey},d=function(e){return!!e.shiftKey},h=function(){};return h.prototype={on:function(e,t){this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(t)},off:function(e,t){this._events=this._events||{},e in this._events!=0&&this._events[e].splice(this._events[e].indexOf(t),1)},emit:function(e){if(this._events=this._events||{},e in this._events!=0)for(var t=0;t<this._events[e].length;t++)this._events[e][t].apply(this,Array.prototype.slice.call(arguments,1))}},h.mixin=function(e){for(var t=["on","off","emit"],s=t.length;s--;)"function"==typeof e?e.prototype[t[s]]=h.prototype[t[s]]:e[t[s]]=h.prototype[t[s]];return e},s.prototype.init=function(){var e=document.createElement("div");e.className="ui-lasso",e.style.position="fixed",c(this.config.lasso,function(t,s){e.style[s]=t}),this.lasso=e,"string"==typeof this.config.appendTo||this.config.appendTo instanceof String?this.container=document.querySelector(this.config.appendTo):this.config.appendTo.nodeName&&(this.container=this.config.appendTo),this.update(),this.enable()},s.prototype.update=function(){var e=this;this.nodes=this.container.querySelectorAll(this.config.filter),this.items=this.selectedItems=[],c(this.nodes,function(t,s){e.items[s]={index:s,element:t,rect:t.getBoundingClientRect(),startselected:!1,selected:t.classList.contains("ui-selected"),selecting:t.classList.contains("ui-selecting"),unselecting:t.classList.contains("ui-unselecting")},t.ondragstart=function(e){a(e)}})},s.prototype.mousedown=function(e){a(e);var t,s=this.config,i=e.target,n=i.classList.contains(s.filter.replace(".",""));if(this.container.appendChild(this.lasso),this.origin={x:e.pageX,y:e.pageY},!s.disabled){if(n&&i.classList.add("ui-selecting"),s.autoRefresh&&this.update(),d(e)){for(var o=!1,l=0;l<this.items.length;l++)if(this.items[l].element===e.target){o=this.items[l];break}for(var r=!1,l=o.index;l>=0&&(this.items[l].selected&&(r=!0),!r||this.items[l].selected);l--)this.items[l].selecting=!0}c(this.items,function(s){var n=s.element;s.selected&&(s.startselected=!0,u(e)||d(e)||(n.classList.remove("ui-selected"),s.selected=!1,n.classList.add("ui-unselecting"),s.unselecting=!0)),n===i&&(t=s)}),this.dragging=!0,n&&this.emit("selectable.down",t)}},s.prototype.mousemove=function(e){if(this.dragging){var t=this.config;if(!t.disabled){var s,i={x1:this.origin.x,y1:this.origin.y,x2:e.pageX,y2:e.pageY};i.x1>i.x2&&(s=i.x2,i.x2=i.x1,i.x1=s),i.y1>i.y2&&(s=i.y2,i.y2=i.y1,i.y1=s),l(this.lasso,{left:i.x1,width:i.x2-i.x1,top:i.y1,height:i.y2-i.y1}),c(this.items,function(s){var n=s.element,o=!1;"touch"==t.tolerance?o=!(s.rect.left>i.x2||s.rect.right<i.x1||s.rect.top>i.y2||s.rect.bottom<i.y1):"fit"==t.tolerance&&(o=s.rect.left>i.x1&&s.rect.right<i.x2&&s.rect.top>i.y1&&s.rect.bottom<i.y2),o?(s.selected&&(n.classList.remove("ui-selected"),s.selected=!1),s.unselecting&&(n.classList.remove("ui-unselecting"),s.unselecting=!1),s.selecting||(n.classList.add("ui-selecting"),s.selecting=!0)):(s.selecting&&(u(e)&&s.startselected?(n.classList.remove("ui-selecting"),s.selecting=!1,n.classList.add("ui-selected"),s.selected=!0):(n.classList.remove("ui-selecting"),s.selecting=!1,s.startselected&&(n.classList.add("ui-unselecting"),s.unselecting=!0))),n.selected&&(u(e)||s.startselected||(n.classList.remove("ui-selected"),s.selected=!1,n.classList.add("ui-unselecting"),s.unselecting=!0)))}),this.emit("selectable.drag",i)}}},s.prototype.mouseup=function(e){if(this.dragging&&(this.dragging=!1),this.container.contains(e.target)){var t=this;this.selectedItems=[],l(this.lasso,{left:0,width:0,top:0,height:0}),c(this.items,function(e){var s=e.element;e.unselecting&&(s.classList.remove("ui-unselecting"),e.unselecting=!1,e.startselected=!1),e.selecting&&t.selectItem(e)}),this.container.removeChild(this.lasso),this.emit("selectable.up",this.selectedItems)}},s.prototype.selectItem=function(e){return this.items.indexOf(e)>=0&&(e.element.classList.remove("ui-selecting"),e.element.classList.add("ui-selected"),e.selecting=!1,e.selected=e.startselected=!0,this.selectedItems.push(e),this.emit("selectable.selected",e))},s.prototype.deselectItem=function(e){return this.items.indexOf(e)>=0&&(e.selecting=e.selected=e.unselecting=e.startselected=!1,e.element.classList.remove("ui-unselecting"),e.element.classList.remove("ui-selecting"),e.element.classList.remove("ui-selected"),this.selectedItems.splice(this.selectedItems.indexOf(e),1),this.emit("selectable.deselected",e))},s.prototype.recalculate=function(){c(this.nodes,function(e,t){this.items[t].rect=e.getBoundingClientRect()},this)},s.prototype.selectAll=function(){this.selectedItems=[],c(this.items,function(e){this.selectItem(e)},this)},s.prototype.clear=function(){c(this.items,function(e){this.deselectItem(e)},this)},s.prototype.enable=function(){return this.enabled||(this.enabled=!0,this.events={mousedown:this.mousedown.bind(this),mousemove:this.mousemove.bind(this),mouseup:this.mouseup.bind(this),recalculate:r(this.recalculate,50).bind(this)},e(this.container,"mousedown",this.events.mousedown),e(document,"mousemove",this.events.mousemove),e(document,"mouseup",this.events.mouseup),e(window,"resize",this.events.recalculate),e(window,"scroll",this.events.recalculate)),this.enabled},s.prototype.disable=function(){return this.enabled&&(this.enabled=!1,t(this.container,"mousedown",this.events.mousedown),t(document,"mousemove",this.events.mousemove),t(document,"mouseup",this.events.mouseup),t(window,"resize",this.events.recalculate),t(window,"scroll",this.events.recalculate)),this.enabled},s.prototype.destroy=function(){c(this.items,function(e){var t=e.element;t.classList.remove("ui-unselecting"),t.classList.remove("ui-selecting"),t.classList.remove("ui-selected")}),this.disable()},s}); | ||
!function(e,t){"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define([],t):e.Selectable=t()}("undefined"!=typeof global?global:this.window||this.global,function(){"use strict";function e(e,t,s,i){e.addEventListener(t,s,!1)}function t(e,t,s){e.removeEventListener(t,s)}function s(e){this.config=o(i,e),f.mixin(this),this.init()}var i={appendTo:document.body,autoRefresh:!0,filter:"*",tolerance:"touch",lasso:{border:"1px solid #3498db",backgroundColor:"rgba(52, 152, 219, 0.2)"}},n=function(e){return"[object Object]"===Object.prototype.toString.call(e)},o=function(e,t){for(var s in t)if(t.hasOwnProperty(s)){var i=t[s];i&&n(i)?(e[s]=e[s]||{},o(e[s],i)):e[s]=i}return e},c=function(e,t,s){var i;if(n(e))for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(s,e[i],i);else for(i=0;i<e.length;i++)t.call(s,e[i],i)},l=function(e,t,s){var i=e&&e.style,o=n(t);if(i){if(void 0===s&&!o)return s=window.getComputedStyle(e,""),void 0===t?s:s[t];o?c(t,function(e,t){t in i||(t="-webkit-"+t),i[t]=e+("string"==typeof e?"":"opacity"===t?"":"px")}):(t in i||(t="-webkit-"+t),i[t]=s+("string"==typeof s?"":"opacity"===t?"":"px"))}},r=function(e){var t=window,s=e.getBoundingClientRect(),i=document.documentElement||document.body.parentNode||document.body,n=void 0!==t.pageXOffset?t.pageXOffset:i.scrollLeft,o=void 0!==t.pageYOffset?t.pageYOffset:i.scrollTop;return{x1:s.left+n,x2:s.left+s.width+n,y1:s.top+o,y2:s.top+s.height+o,height:s.height,width:s.width}},a=function(e,t,s){var i;return function(){var n=this,o=arguments,c=s&&!i;clearTimeout(i),i=setTimeout(function(){i=null,s||e.apply(n,o)},t),c&&e.apply(n,o)}},u=function(e){return e=e||window.event,e.preventDefault?e.preventDefault():e.returnValue=!1},d=function(e){return!!e.ctrlKey||!!e.metaKey},h=function(e){return!!e.shiftKey},f=function(){};return f.prototype={on:function(e,t){this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(t)},off:function(e,t){this._events=this._events||{},e in this._events!=0&&this._events[e].splice(this._events[e].indexOf(t),1)},emit:function(e){if(this._events=this._events||{},e in this._events!=0)for(var t=0;t<this._events[e].length;t++)this._events[e][t].apply(this,Array.prototype.slice.call(arguments,1))}},f.mixin=function(e){for(var t=["on","off","emit"],s=t.length;s--;)"function"==typeof e?e.prototype[t[s]]=f.prototype[t[s]]:e[t[s]]=f.prototype[t[s]];return e},s.prototype.init=function(){this.lasso=document.createElement("div"),this.lasso.className="ui-lasso",l(this.lasso,o({position:"fixed",opacity:0},this.config.lasso)),"string"==typeof this.config.appendTo||this.config.appendTo instanceof String?this.container=document.querySelector(this.config.appendTo):this.config.appendTo.nodeName&&(this.container=this.config.appendTo),this.update(),this.enable()},s.prototype.update=function(){var e=this;this.nodes=this.container.querySelectorAll(this.config.filter),this.items=this.selectedItems=[],c(this.nodes,function(t,s){e.items[s]={index:s,element:t,rect:r(t),startselected:!1,selected:t.classList.contains("ui-selected"),selecting:t.classList.contains("ui-selecting"),unselecting:t.classList.contains("ui-unselecting")},t.ondragstart=function(e){u(e)}})},s.prototype.mousedown=function(e){u(e);var t,s=this.config,i=e.target,n=i.classList.contains(s.filter.replace(".",""));if(this.container.appendChild(this.lasso),this.origin={x:e.pageX,y:e.pageY},!s.disabled){if(n&&i.classList.add("ui-selecting"),s.autoRefresh&&this.update(),h(e))for(var o=!1,l=this.items.length-1;l>=0&&(this.items[l].element===e.target&&(o=!0),!this.items[l].selected);l--)o&&(this.items[l].selecting=!0);c(this.items,function(s){var n=s.element;s.selected&&(s.startselected=!0,d(e)||h(e)||(n.classList.remove("ui-selected"),s.selected=!1,n.classList.add("ui-unselecting"),s.unselecting=!0)),n===i&&(t=s)}),this.dragging=!0,n&&this.emit("selectable.down",t)}},s.prototype.mousemove=function(e){if(this.dragging){var t=this.config;if(!t.disabled){var s,i={x1:this.origin.x,y1:this.origin.y,x2:e.pageX,y2:e.pageY};i.x1>i.x2&&(s=i.x2,i.x2=i.x1,i.x1=s),i.y1>i.y2&&(s=i.y2,i.y2=i.y1,i.y1=s),l(this.lasso,{opacity:1,left:i.x1,width:i.x2-i.x1,top:i.y1,height:i.y2-i.y1}),c(this.items,function(s){var n=s.element,o=!1;"touch"==t.tolerance?o=!(s.rect.x1>i.x2||s.rect.x2<i.x1||s.rect.y1>i.y2||s.rect.y2<i.y1):"fit"==t.tolerance&&(o=s.rect.x1>i.x1&&s.rect.x2<i.x2&&s.rect.y1>i.y1&&s.rect.y2<i.y2),o?(s.selected&&(n.classList.remove("ui-selected"),s.selected=!1),s.unselecting&&(n.classList.remove("ui-unselecting"),s.unselecting=!1),s.selecting||(n.classList.add("ui-selecting"),s.selecting=!0)):(s.selecting&&(d(e)&&s.startselected?(n.classList.remove("ui-selecting"),s.selecting=!1,n.classList.add("ui-selected"),s.selected=!0):(n.classList.remove("ui-selecting"),s.selecting=!1,s.startselected&&(n.classList.add("ui-unselecting"),s.unselecting=!0))),n.selected&&(d(e)||s.startselected||(n.classList.remove("ui-selected"),s.selected=!1,n.classList.add("ui-unselecting"),s.unselecting=!0)))}),this.emit("selectable.drag",i)}}},s.prototype.mouseup=function(e){if(this.dragging&&(this.dragging=!1),this.container.contains(e.target)){var t=this;this.selectedItems=[],l(this.lasso,{opacity:0,left:0,width:0,top:0,height:0}),c(this.items,function(e){var s=e.element;e.unselecting&&(s.classList.remove("ui-unselecting"),e.unselecting=!1,e.startselected=!1),e.selecting&&t.selectItem(e)}),this.container.removeChild(this.lasso),this.emit("selectable.up",this.selectedItems)}},s.prototype.selectItem=function(e){return this.items.indexOf(e)>=0&&(e.element.classList.remove("ui-selecting"),e.element.classList.add("ui-selected"),e.selecting=!1,e.selected=e.startselected=!0,this.selectedItems.push(e),this.emit("selectable.selected",e))},s.prototype.deselectItem=function(e){return this.items.indexOf(e)>=0&&(e.selecting=e.selected=e.unselecting=e.startselected=!1,e.element.classList.remove("ui-unselecting"),e.element.classList.remove("ui-selecting"),e.element.classList.remove("ui-selected"),this.selectedItems.splice(this.selectedItems.indexOf(e),1),this.emit("selectable.deselected",e))},s.prototype.recalculate=function(){c(this.nodes,function(e,t){this.items[t].rect=r(e)},this)},s.prototype.selectAll=function(){this.selectedItems=[],c(this.items,function(e){this.selectItem(e)},this)},s.prototype.clear=function(){c(this.items,function(e){this.deselectItem(e)},this)},s.prototype.enable=function(){return this.enabled||(this.enabled=!0,this.events={mousedown:this.mousedown.bind(this),mousemove:this.mousemove.bind(this),mouseup:this.mouseup.bind(this),recalculate:a(this.recalculate,50).bind(this)},e(this.container,"mousedown",this.events.mousedown),e(document,"mousemove",this.events.mousemove),e(document,"mouseup",this.events.mouseup),e(window,"resize",this.events.recalculate),e(window,"scroll",this.events.recalculate)),this.enabled},s.prototype.disable=function(){return this.enabled&&(this.enabled=!1,t(this.container,"mousedown",this.events.mousedown),t(document,"mousemove",this.events.mousemove),t(document,"mouseup",this.events.mouseup),t(window,"resize",this.events.recalculate),t(window,"scroll",this.events.recalculate)),this.enabled},s.prototype.destroy=function(){c(this.items,function(e){var t=e.element;t.classList.remove("ui-unselecting"),t.classList.remove("ui-selecting"),t.classList.remove("ui-selected")}),this.disable()},s}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35073
574