Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dragselect

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dragselect - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

6

dist/dragSelect.js

@@ -509,3 +509,7 @@ /*

if(area === document) {
return { top: 0, left: 0, bottom: 0, right: 0, width: area.body.offsetWidth, height: area.body.offsetHeight };
var size = {
y: area.documentElement.clientHeight > 0 ? area.documentElement.clientHeight : window.innerHeight,
x: area.documentElement.clientWidth > 0 ? area.documentElement.clientWidth : window.innerWidth,
};
return { top: 0, left: 0, bottom: 0, right: 0, width: size.x, height: size.y };
}

@@ -512,0 +516,0 @@

2

dist/ds.min.js

@@ -1,1 +0,1 @@

var dragSelect=function(e){function t(){H.addEventListener("mousedown",n)}function n(e){L.style.display="block",o(e),r(),H.removeEventListener("mousedown",n),H.addEventListener("mousemove",i),document.addEventListener("mouseup",f)}function o(e){T=v(e),M=w(H);var t={};t.x=T.x+M.x,t.y=T.y+M.y,t.w=0,t.h=0,E(L,t)}function i(e){var t=l(e);E(L,t),r(),s(e)}function l(e){var t=v(e),n=w(H),o={x:n.x-M.x,y:n.y-M.y},i={};return t.x>T.x-o.x?(i.x=T.x+M.x,i.w=t.x-T.x+o.x):(i.x=t.x+n.x,i.w=T.x-t.x-o.x),t.y>T.y-o.y?(i.y=T.y+M.y,i.h=t.y-T.y+o.y):(i.y=t.y+n.y,i.h=T.y-t.y-o.y),i}function r(){for(var e=0,t=C.length;e<t;e++){var n=C[e],o=O.indexOf(n);c(n,L)?o<0&&(O.push(n),h(n,"selected"),B(n)):o>-1&&(O.splice(o,1),g(n,"selected"),R(n))}}function c(e,t){var n=w(H),o={y:t.getBoundingClientRect().top+n.y,x:t.getBoundingClientRect().left+n.x,h:t.offsetHeight,w:t.offsetWidth},i={y:e.getBoundingClientRect().top+n.y,x:e.getBoundingClientRect().left+n.x,h:e.offsetHeight,w:e.offsetWidth};return o.x<i.x+i.w&&o.x+o.w>i.x&&o.y<i.y+i.h&&o.h+o.y>i.y}function s(e){var t=u(e),n=H===document?H.body:H;"top"===t&&n.scrollTop>0?n.scrollTop-=1:"bottom"===t?n.scrollTop+=1:"left"===t&&n.scrollLeft>0?n.scrollLeft-=1:"right"===t&&(n.scrollLeft+=1)}function u(e){var t=v(e),n=b(H),o={x:Math.max(n.width/10,20),y:Math.max(n.height/10,20)},i=H===document?w(document.body):{x:0,y:0};return t.y<o.y+i.y?"top":n.height-t.y+i.y<o.y?"bottom":n.width-t.x+i.x<o.x?"right":t.x<o.x+i.x&&"left"}function f(){L.style.width="0",L.style.height="0",L.style.display="none",S(O),H.removeEventListener("mousemove",i),H.addEventListener("mousedown",n)}function d(){f(),H.removeEventListener("mousedown",n),document.removeEventListener("mouseup",f)}function y(){return O}function a(e){for(var t=m(e),n=0,o=t.length;n<o;n++){var i=t[n];C.indexOf(i)<0&&C.push(i)}}function x(e){for(var t=m(e),n=0,o=t.length;n<o;n++){var i=t[n];C.indexOf(i)>0&&(g(i,"selected"),C.splice(C.indexOf(i),1))}}function h(e,t){var n=e.className;return-1!==n.indexOf(t)?e:(""!==n&&(t=" "+t),e.className=n+t,e)}function g(e,t){var n=e.className,o=new RegExp(t+"\\b","g");n=n.replace(o,""),e.className=n}function m(e){if(!e)return!1;if(!e.length&&p(e))return[e];for(var t=[],n=e.length-1;n>=0;n--)t[n]=e[n];return t}function p(e){try{return e instanceof HTMLElement}catch(t){return"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument}}function v(e){var t={x:e.pageX||e.clientX,y:e.pageY||e.clientY},n=b(H);return{x:t.x-n.left,y:t.y-n.top}}function w(e){return{y:e&&e.scrollTop>=0?e.scrollTop:0,x:e&&e.scrollLeft>=0?e.scrollLeft:0}}function b(e){return e===document?{top:0,left:0,bottom:0,right:0,width:e.body.offsetWidth,height:e.body.offsetHeight}:{top:e.getBoundingClientRect().top,left:e.getBoundingClientRect().left,bottom:e.getBoundingClientRect().bottom,right:e.getBoundingClientRect().right,width:e.offsetWidth,height:e.offsetHeight}}function E(e,t){return e.style.left=t.x+"px",e.style.top=t.y+"px",e.style.width=t.w+"px",e.style.height=t.h+"px",e}var L,C,B,R,S,T,H,O,M;return function(){L=e.selector||document.getElementById("rectangle"),C=m(e.selectables)||[],B=e.onElementSelect||function(){},R=e.onElementUnselect||function(){},S=e.callback||function(){},H=e.area||document,O=[]}(),t(),{_updatePos:E,isElement:p,toArray:m,removeClass:g,addClass:h,stop:d,isElementTouching:c,reset:f,checkIfInsideSelection:r,handleMove:i,_startUp:n,start:t,getSelection:y,removeSelectables:x,addSelectables:a}};"undefined"!=typeof module&&null!==module?module.exports=dragSelect:window.dragSelect=dragSelect;
var dragSelect=function(e){function t(){H.addEventListener("mousedown",n)}function n(e){L.style.display="block",o(e),r(),H.removeEventListener("mousedown",n),H.addEventListener("mousemove",i),document.addEventListener("mouseup",d)}function o(e){T=v(e),O=w(H);var t={};t.x=T.x+O.x,t.y=T.y+O.y,t.w=0,t.h=0,b(L,t)}function i(e){var t=l(e);b(L,t),r(),u(e)}function l(e){var t=v(e),n=w(H),o={x:n.x-O.x,y:n.y-O.y},i={};return t.x>T.x-o.x?(i.x=T.x+O.x,i.w=t.x-T.x+o.x):(i.x=t.x+n.x,i.w=T.x-t.x-o.x),t.y>T.y-o.y?(i.y=T.y+O.y,i.h=t.y-T.y+o.y):(i.y=t.y+n.y,i.h=T.y-t.y-o.y),i}function r(){for(var e=0,t=C.length;e<t;e++){var n=C[e],o=W.indexOf(n);c(n,L)?o<0&&(W.push(n),h(n,"selected"),B(n)):o>-1&&(W.splice(o,1),m(n,"selected"),R(n))}}function c(e,t){var n=w(H),o={y:t.getBoundingClientRect().top+n.y,x:t.getBoundingClientRect().left+n.x,h:t.offsetHeight,w:t.offsetWidth},i={y:e.getBoundingClientRect().top+n.y,x:e.getBoundingClientRect().left+n.x,h:e.offsetHeight,w:e.offsetWidth};return o.x<i.x+i.w&&o.x+o.w>i.x&&o.y<i.y+i.h&&o.h+o.y>i.y}function u(e){var t=s(e),n=H===document?H.body:H;"top"===t&&n.scrollTop>0?n.scrollTop-=1:"bottom"===t?n.scrollTop+=1:"left"===t&&n.scrollLeft>0?n.scrollLeft-=1:"right"===t&&(n.scrollLeft+=1)}function s(e){var t=v(e),n=E(H),o={x:Math.max(n.width/10,20),y:Math.max(n.height/10,20)},i=H===document?w(document.body):{x:0,y:0};return t.y<o.y+i.y?"top":n.height-t.y+i.y<o.y?"bottom":n.width-t.x+i.x<o.x?"right":t.x<o.x+i.x&&"left"}function d(){L.style.width="0",L.style.height="0",L.style.display="none",S(W),H.removeEventListener("mousemove",i),H.addEventListener("mousedown",n)}function f(){d(),H.removeEventListener("mousedown",n),document.removeEventListener("mouseup",d)}function y(){return W}function a(e){for(var t=g(e),n=0,o=t.length;n<o;n++){var i=t[n];C.indexOf(i)<0&&C.push(i)}}function x(e){for(var t=g(e),n=0,o=t.length;n<o;n++){var i=t[n];C.indexOf(i)>0&&(m(i,"selected"),C.splice(C.indexOf(i),1))}}function h(e,t){var n=e.className;return-1!==n.indexOf(t)?e:(""!==n&&(t=" "+t),e.className=n+t,e)}function m(e,t){var n=e.className,o=new RegExp(t+"\\b","g");n=n.replace(o,""),e.className=n}function g(e){if(!e)return!1;if(!e.length&&p(e))return[e];for(var t=[],n=e.length-1;n>=0;n--)t[n]=e[n];return t}function p(e){try{return e instanceof HTMLElement}catch(t){return"object"==typeof e&&1===e.nodeType&&"object"==typeof e.style&&"object"==typeof e.ownerDocument}}function v(e){var t={x:e.pageX||e.clientX,y:e.pageY||e.clientY},n=E(H);return{x:t.x-n.left,y:t.y-n.top}}function w(e){return{y:e&&e.scrollTop>=0?e.scrollTop:0,x:e&&e.scrollLeft>=0?e.scrollLeft:0}}function E(e){if(e===document){var t={y:e.documentElement.clientHeight>0?e.documentElement.clientHeight:window.innerHeight,x:e.documentElement.clientWidth>0?e.documentElement.clientWidth:window.innerWidth};return{top:0,left:0,bottom:0,right:0,width:t.x,height:t.y}}return{top:e.getBoundingClientRect().top,left:e.getBoundingClientRect().left,bottom:e.getBoundingClientRect().bottom,right:e.getBoundingClientRect().right,width:e.offsetWidth,height:e.offsetHeight}}function b(e,t){return e.style.left=t.x+"px",e.style.top=t.y+"px",e.style.width=t.w+"px",e.style.height=t.h+"px",e}var L,C,B,R,S,T,H,W,O;return function(){L=e.selector||document.getElementById("rectangle"),C=g(e.selectables)||[],B=e.onElementSelect||function(){},R=e.onElementUnselect||function(){},S=e.callback||function(){},H=e.area||document,W=[]}(),t(),{_updatePos:b,isElement:p,toArray:g,removeClass:m,addClass:h,stop:f,isElementTouching:c,reset:d,checkIfInsideSelection:r,handleMove:i,_startUp:n,start:t,getSelection:y,removeSelectables:x,addSelectables:a}};"undefined"!=typeof module&&null!==module?module.exports=dragSelect:window.dragSelect=dragSelect;
{
"name": "dragselect",
"version": "1.4.1",
"version": "1.4.2",
"description": "easy javascript drag select functionality to your projects",

@@ -5,0 +5,0 @@ "main": "./dist/ds.min.js",

@@ -509,3 +509,7 @@ /*

if(area === document) {
return { top: 0, left: 0, bottom: 0, right: 0, width: area.body.offsetWidth, height: area.body.offsetHeight };
var size = {
y: area.documentElement.clientHeight > 0 ? area.documentElement.clientHeight : window.innerHeight,
x: area.documentElement.clientWidth > 0 ? area.documentElement.clientWidth : window.innerWidth,
};
return { top: 0, left: 0, bottom: 0, right: 0, width: size.x, height: size.y };
}

@@ -512,0 +516,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc