draggable-helper
Advanced tools
Comparing version 1.0.8 to 1.0.9
/*! | ||
* draggable-helper v1.0.8 | ||
* draggable-helper v1.0.9 | ||
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* draggable-helper v1.0.8 | ||
* draggable-helper v1.0.9 | ||
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -4,0 +4,0 @@ * Released under the MIT License. |
/*! | ||
* draggable-helper v1.0.8 | ||
* draggable-helper v1.0.9 | ||
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -13,4 +13,4 @@ * Released under the MIT License. | ||
/*! | ||
* helper-js v1.0.52 | ||
* (c) 2017-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* helper-js v1.0.53 | ||
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
@@ -156,12 +156,11 @@ */ | ||
function offsetToPosition(el, of) { | ||
var parent = el.offsetParent; | ||
var p = { | ||
x: el.offsetLeft, | ||
y: el.offsetTop // position | ||
if (!parent) { | ||
return Object.assign({}, of); | ||
} | ||
var pof = getOffset(parent); | ||
}; | ||
var elOf = getOffset(el); | ||
return { | ||
x: of.x - pof.x, | ||
y: of.y - pof.y | ||
x: of.x - (elOf.x - p.x), | ||
y: of.y - (elOf.y - p.y) | ||
}; | ||
@@ -168,0 +167,0 @@ } |
/*! | ||
* draggable-helper v1.0.8 | ||
* draggable-helper v1.0.9 | ||
* (c) 2018-present phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.draggableHelper=t()}(this,function(){"use strict";var e;try{e=global}catch(t){e=window}function t(e){var t=e.getBoundingClientRect(),n=function(){if("undefined"!=typeof pageYOffset)return{top:pageYOffset,left:pageXOffset};var e=document.body,t=document.documentElement;return{top:(t=t.clientHeight?t:e).scrollTop,left:t.scrollLeft}}();return{x:t.left+n.left,y:t.top+n.top}}function n(e,t){e["original_".concat(t)]=e.getAttribute(t)}function o(e,t){var n="original_".concat(t);e.setAttribute(t,e[n])}function i(e,t){(function(e,t){return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)})(e,t)||(e.classList?e.classList.add(t):e.className+=" "+t)}function a(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent&&e.attachEvent("on".concat(t),n)}function r(e,t,n){e.removeEventListener?e.removeEventListener(t,n):e.detachEvent&&e.detachEvent("on".concat(t),n)}function s(e){return{storage:e,set:function(e,t,n){null==t?this.storage.removeItem(e):this.storage.setItem(e,JSON.stringify({value:t,expired_at:n&&(new Date).getTime()/1e3+60*n}))},get:function(e){var t=this.storage.getItem(e);if(t){if(!(t=JSON.parse(t)).expired_at||t.expired_at>(new Date).getTime())return t.value;this.storage.removeItem(e)}return null},clear:function(){this.storage.clear()}}}s(e.localStorage),s(e.sessionStorage);return function(e){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null==s.minTranslate&&(s.minTranslate=10);var l={movedCount:0},u=function(){r(e,"mousedown",e._draggbleEventHandler),delete e._draggbleEventHandler};return e._draggbleEventHandler&&u(),e._draggbleEventHandler=c,a(e,"mousedown",c),u;function c(e){1===e.which&&(e.stopPropagation(),a(document.body,"selectstart",m),l.mouse={x:e.pageX,y:e.pageY},l.initialMouse=Object.assign({},l.mouse),a(document,"mousemove",f),a(window,"mouseup",g))}function d(o){var a=function(){var n=s.getEl?s.getEl(e,s):e,o=n;return s.clone&&(l.triggerEl=n,o=n.cloneNode(!0),n.parentElement.appendChild(o)),{position:function(e,n){var o=e.offsetParent;if(!o)return Object.assign({},n);var i=t(o);return{x:n.x-i.x,y:n.y-i.y}}(o,t(n)),el:o}}(),u=a.el,c=a.position;if(l.el=u,l.initialPosition=Object.assign({},c),!1===(s.drag&&s.drag(o,s,l)))return r(document.body,"selectstart",m),!1;var d=function(e){var t=e.style.display;e.style.display="block";var n={width:e.offsetWidth,height:e.offsetHeight};return e.style.display=t,n}(u),f=Object.assign({width:"".concat(d.width,"px"),height:"".concat(d.height,"px"),zIndex:9999,opacity:.6,position:"fixed",left:c.x+"px",top:c.y+"px"},s.style||s.getStyle&&s.getStyle(s)||{});for(var g in n(u,"style"),f)u.style[g]=f[g];n(u,"class"),i(u,s.draggingClass);var v=document.body,p=(v.getAttribute("style")||"").trim();p.length&&!p.endsWith(";")&&(p+=";"),n(v,"style"),v.style=p+"cursor: move;"}function f(e){l.mouse={x:e.pageX,y:e.pageY};var t=l.move={x:l.mouse.x-l.initialMouse.x,y:l.mouse.y-l.initialMouse.y};if(0===l.movedCount&&s.minTranslate){var n=Math.pow(l.move.x,2),o=Math.pow(l.move.y,2);if(Math.pow(n+o,.5)<s.minTranslate)return}var i=!0;if(0===l.movedCount&&!1===d(e)&&(i=!1),i&&s.moving&&!1===s.moving(e,s,l)&&(i=!1),i){if(!l||!l.el)return;Object.assign(l.el.style,{left:l.initialPosition.x+t.x+"px",top:l.initialPosition.y+t.y+"px"}),l.movedCount++}}function g(e){if(r(document,"mousemove",f),r(window,"mouseup",g),l.movedCount>0){l.movedCount=0;var t=l.el;s.clone?t.parentElement.removeChild(t):(o(t,"style"),o(t,"class")),o(document.body,"style"),r(document.body,"selectstart",m),s.drop&&s.drop(e,s,l)}l={movedCount:0}}function m(e){e.preventDefault()}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.draggableHelper=t()}(this,function(){"use strict";var e;try{e=global}catch(t){e=window}function t(e){var t=e.getBoundingClientRect(),n=function(){if("undefined"!=typeof pageYOffset)return{top:pageYOffset,left:pageXOffset};var e=document.body,t=document.documentElement;return{top:(t=t.clientHeight?t:e).scrollTop,left:t.scrollLeft}}();return{x:t.left+n.left,y:t.top+n.top}}function n(e,t){e["original_".concat(t)]=e.getAttribute(t)}function o(e,t){var n="original_".concat(t);e.setAttribute(t,e[n])}function i(e,t){(function(e,t){return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)})(e,t)||(e.classList?e.classList.add(t):e.className+=" "+t)}function a(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent&&e.attachEvent("on".concat(t),n)}function s(e,t,n){e.removeEventListener?e.removeEventListener(t,n):e.detachEvent&&e.detachEvent("on".concat(t),n)}function r(e){return{storage:e,set:function(e,t,n){null==t?this.storage.removeItem(e):this.storage.setItem(e,JSON.stringify({value:t,expired_at:n&&(new Date).getTime()/1e3+60*n}))},get:function(e){var t=this.storage.getItem(e);if(t){if(!(t=JSON.parse(t)).expired_at||t.expired_at>(new Date).getTime())return t.value;this.storage.removeItem(e)}return null},clear:function(){this.storage.clear()}}}r(e.localStorage),r(e.sessionStorage);return function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null==r.minTranslate&&(r.minTranslate=10);var l={movedCount:0},u=function(){s(e,"mousedown",e._draggbleEventHandler),delete e._draggbleEventHandler};return e._draggbleEventHandler&&u(),e._draggbleEventHandler=c,a(e,"mousedown",c),u;function c(e){1===e.which&&(e.stopPropagation(),a(document.body,"selectstart",m),l.mouse={x:e.pageX,y:e.pageY},l.initialMouse=Object.assign({},l.mouse),a(document,"mousemove",f),a(window,"mouseup",g))}function d(o){var a=function(){var n=r.getEl?r.getEl(e,r):e,o=n;return r.clone&&(l.triggerEl=n,o=n.cloneNode(!0),n.parentElement.appendChild(o)),{position:function(e,n){var o=e.offsetLeft,i=e.offsetTop,a=t(e);return{x:n.x-(a.x-o),y:n.y-(a.y-i)}}(o,t(n)),el:o}}(),u=a.el,c=a.position;if(l.el=u,l.initialPosition=Object.assign({},c),!1===(r.drag&&r.drag(o,r,l)))return s(document.body,"selectstart",m),!1;var d=function(e){var t=e.style.display;e.style.display="block";var n={width:e.offsetWidth,height:e.offsetHeight};return e.style.display=t,n}(u),f=Object.assign({width:"".concat(d.width,"px"),height:"".concat(d.height,"px"),zIndex:9999,opacity:.6,position:"fixed",left:c.x+"px",top:c.y+"px"},r.style||r.getStyle&&r.getStyle(r)||{});for(var g in n(u,"style"),f)u.style[g]=f[g];n(u,"class"),i(u,r.draggingClass);var v=document.body,p=(v.getAttribute("style")||"").trim();p.length&&!p.endsWith(";")&&(p+=";"),n(v,"style"),v.style=p+"cursor: move;"}function f(e){l.mouse={x:e.pageX,y:e.pageY};var t=l.move={x:l.mouse.x-l.initialMouse.x,y:l.mouse.y-l.initialMouse.y};if(0===l.movedCount&&r.minTranslate){var n=Math.pow(l.move.x,2),o=Math.pow(l.move.y,2);if(Math.pow(n+o,.5)<r.minTranslate)return}var i=!0;if(0===l.movedCount&&!1===d(e)&&(i=!1),i&&r.moving&&!1===r.moving(e,r,l)&&(i=!1),i){if(!l||!l.el)return;Object.assign(l.el.style,{left:l.initialPosition.x+t.x+"px",top:l.initialPosition.y+t.y+"px"}),l.movedCount++}}function g(e){if(s(document,"mousemove",f),s(window,"mouseup",g),l.movedCount>0){l.movedCount=0;var t=l.el;r.clone?t.parentElement.removeChild(t):(o(t,"style"),o(t,"class")),o(document.body,"style"),s(document.body,"selectstart",m),r.drop&&r.drop(e,r,l)}l={movedCount:0}}function m(e){e.preventDefault()}}}); | ||
//# sourceMappingURL=draggable-helper.min.js.map |
{ | ||
"name": "draggable-helper", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "", | ||
@@ -24,5 +24,5 @@ "main": "dist/draggable-helper.cjs.js", | ||
"dependencies": { | ||
"helper-js": "^1.0.52" | ||
"helper-js": "^1.0.53" | ||
}, | ||
"license": "MIT" | ||
} |
Sorry, the diff of this file is not supported yet
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
92476
Updatedhelper-js@^1.0.53