From a013972e55c396d1dc0195903666aea6e56dd107 Mon Sep 17 00:00:00 2001 From: Nathan Cahill Date: Mon, 15 Oct 2018 12:37:04 -0700 Subject: [PATCH] v1.5.4 --- bower.json | 2 +- docs/split.min.js | 4 ++-- package.json | 2 +- split.js | 52 +++++++++++++++++++++++++---------------------- split.min.js | 4 ++-- 5 files changed, 34 insertions(+), 30 deletions(-) diff --git a/bower.json b/bower.json index 25140f19..26c3fc2b 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "Split.js", "main": "split.js", - "version": "1.5.3", + "version": "1.5.4", "homepage": "https://github.com/nathancahill/Split.js", "authors": [ "Nathan Cahill " diff --git a/docs/split.min.js b/docs/split.min.js index 925787db..86f5538c 100644 --- a/docs/split.min.js +++ b/docs/split.min.js @@ -1,2 +1,2 @@ -/*! Split.js - v1.5.3 */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Split=t()}(this,function(){"use strict";var O=window,j=O.document,C="addEventListener",B="removeEventListener",L="getBoundingClientRect",N="horizontal",T=function(){return!1},q=O.attachEvent&&!O[C],i=["","-webkit-","-moz-","-o-"].filter(function(e){var t=j.createElement("div");return t.style.cssText="width:"+e+"calc(9px)",!!t.style.length}).shift()+"calc",s=function(e){return"string"==typeof e||e instanceof String},I=function(e){if(s(e)){var t=j.querySelector(e);if(!t)throw new Error("Selector "+e+" did match a DOM element");return t}return e},R=function(e,t,n){var r=e[t];return void 0!==r?r:n},X=function(e,t,n,r){if(t){if("end"===r)return 0;if("center"===r)return e/2}else if(n){if("start"===r)return 0;if("center"===r)return e/2}return e},Y=function(e,t){var n=j.createElement("div");return n.className="gutter gutter-"+t,n},F=function(e,t,n){var r={};return s(t)?r[e]=t:r[e]=q?t+"%":i+"("+t+"% - "+n+"px)",r},G=function(e,t){var n;return(n={})[e]=t+"px",n};return function(e,i){void 0===i&&(i={});var a,s,o,c,l=e;Array.from&&(l=Array.from(l));var u=I(l[0]).parentNode,f=O.getComputedStyle(u).flexDirection,m=R(i,"sizes")||l.map(function(){return 100/l.length}),t=R(i,"minSize",100),h=Array.isArray(t)?t:l.map(function(){return t}),n=R(i,"expandToMin",!1),d=R(i,"gutterSize",10),v=R(i,"gutterAlign","center"),g=R(i,"snapOffset",30),y=R(i,"dragInterval",0),z=R(i,"direction",N),p=R(i,"cursor",z===N?"ew-resize":"ns-resize"),S=R(i,"gutter",Y),b=R(i,"elementStyle",F),_=R(i,"gutterStyle",G);function E(t,e,n){var r=b(a,e,n);Object.keys(r).forEach(function(e){t.style[e]=r[e]})}function w(){return c.map(function(e){return e.size})}function k(e){var t=c[this.a],n=c[this.b],r=t.size+n.size;t.size=e/this.size*r,n.size=r-e/this.size*r,E(t.element,t.size,this._b),E(n.element,n.size,this._c)}function x(){var e=c[this.a].element,t=c[this.b].element,n=e[L](),r=t[L]();this.size=n[a]+r[a]+this._b+this._c,this.start=n[o]}function U(e){if(0===e.button){var t=this,n=c[t.a].element,r=c[t.b].element;t.dragging||R(i,"onDragStart",T)(w()),e.preventDefault(),t.dragging=!0,t.move=function(e){var t,n=c[this.a],r=c[this.b];this.dragging&&(t="touches"in e?e.touches[0][s]-this.start:e[s]-this.start,0=this.size-(r.minSize+g+this._c)&&(t=this.size-(r.minSize+this._c)),k.call(this,t),R(i,"onDrag",T)())}.bind(t),t.stop=function(){var e=this,t=c[e.a].element,n=c[e.b].element;e.dragging&&R(i,"onDragEnd",T)(w()),e.dragging=!1,O[B]("mouseup",e.stop),O[B]("touchend",e.stop),O[B]("touchcancel",e.stop),O[B]("mousemove",e.move),O[B]("touchmove",e.move),e.stop=null,e.move=null,t[B]("selectstart",T),t[B]("dragstart",T),n[B]("selectstart",T),n[B]("dragstart",T),t.style.userSelect="",t.style.webkitUserSelect="",t.style.MozUserSelect="",t.style.pointerEvents="",n.style.userSelect="",n.style.webkitUserSelect="",n.style.MozUserSelect="",n.style.pointerEvents="",e.gutter.style.cursor="",e.parent.style.cursor="",j.body.style.cursor=""}.bind(t),O[C]("mouseup",t.stop),O[C]("touchend",t.stop),O[C]("touchcancel",t.stop),O[C]("mousemove",t.move),O[C]("touchmove",t.move),n[C]("selectstart",T),n[C]("dragstart",T),r[C]("selectstart",T),r[C]("dragstart",T),n.style.userSelect="none",n.style.webkitUserSelect="none",n.style.MozUserSelect="none",n.style.pointerEvents="none",r.style.userSelect="none",r.style.webkitUserSelect="none",r.style.MozUserSelect="none",r.style.pointerEvents="none",t.gutter.style.cursor=p,t.parent.style.cursor=p,j.body.style.cursor=p,x.call(t)}}z===N?(a="width",s="clientX",o="left"):"vertical"===z&&(a="height",s="clientY",o="top");var M=[];function r(e){var t=e.i===M.length,n=t?M[e.i-1]:M[e.i];x.call(n);var r=t?n.size-e.minSize-n._c:e.minSize+n._b;k.call(n,r)}function D(s){s.forEach(function(e,t){if(0=this.size-(r.minSize+v+this._c)&&(t=this.size-(r.minSize+this._c)),x.call(this,t),Y(i,"onDrag",I)())}.bind(t),t.stop=function(){var e=this,t=c[e.a].element,n=c[e.b].element;e.dragging&&Y(i,"onDragEnd",I)(w()),e.dragging=!1,C[N]("mouseup",e.stop),C[N]("touchend",e.stop),C[N]("touchcancel",e.stop),C[N]("mousemove",e.move),C[N]("touchmove",e.move),e.stop=null,e.move=null,t[N]("selectstart",I),t[N]("dragstart",I),n[N]("selectstart",I),n[N]("dragstart",I),t.style.userSelect="",t.style.webkitUserSelect="",t.style.MozUserSelect="",t.style.pointerEvents="",n.style.userSelect="",n.style.webkitUserSelect="",n.style.MozUserSelect="",n.style.pointerEvents="",e.gutter.style.cursor="",e.parent.style.cursor="",B.body.style.cursor=""}.bind(t),C[L]("mouseup",t.stop),C[L]("touchend",t.stop),C[L]("touchcancel",t.stop),C[L]("mousemove",t.move),C[L]("touchmove",t.move),n[L]("selectstart",I),n[L]("dragstart",I),r[L]("selectstart",I),r[L]("dragstart",I),n.style.userSelect="none",n.style.webkitUserSelect="none",n.style.MozUserSelect="none",n.style.pointerEvents="none",r.style.userSelect="none",r.style.webkitUserSelect="none",r.style.MozUserSelect="none",r.style.pointerEvents="none",t.gutter.style.cursor=p,t.parent.style.cursor=p,B.body.style.cursor=p,U.call(t),t.dragOffset=k(e)-t.end}}z===q?(a="width",t="clientX",s="left",o="right"):"vertical"===z&&(a="height",t="clientY",s="top",o="bottom");var O=[];function D(e){var t=e.i===O.length,n=t?O[e.i-1]:O[e.i];U.call(n);var r=t?n.size-e.minSize-n._c:e.minSize+n._b;x.call(n,r)}function A(s){s.forEach(function(e,t){if(0 0) { + if (dragInterval > 1) { offset = Math.round(offset / dragInterval) * dragInterval; } - // if (gutterAlign === 'start') { - // offset -= this[aGutterSize] - // } else if (gutterAlign === 'end') { - // offset += this[bGutterSize] - // } - // If within snapOffset of min or max, set offset to min or max. // snapOffset buffers a.minSize and b.minSize, so logic is opposite for both. // Include the appropriate gutter sizes to prevent overflows. @@ -330,6 +330,7 @@ this.size = aBounds[dimension] + bBounds[dimension] + this[aGutterSize] + this[bGutterSize]; this.start = aBounds[position]; + this.end = aBounds[positionEnd]; } // stopDragging is very similar to startDragging in reverse. @@ -435,6 +436,9 @@ // Cache the initial sizes of the pair. calculateSizes.call(self); + + // Determine the position of the mouse compared to the gutter + self.dragOffset = getMousePosition(e) - self.end; } // 5. Create pair and element objects. Each pair has an index reference to @@ -499,7 +503,7 @@ // Create gutter elements for each pair. if (i > 0) { var gutterElement = gutter(i, direction, element.element); - setGutterSize(gutterElement, gutterSize); + setGutterSize(gutterElement, gutterSize, i); // Save bound event listener for removal later pair[gutterStartDragging] = startDragging.bind(pair); diff --git a/split.min.js b/split.min.js index 925787db..86f5538c 100644 --- a/split.min.js +++ b/split.min.js @@ -1,2 +1,2 @@ -/*! Split.js - v1.5.3 */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Split=t()}(this,function(){"use strict";var O=window,j=O.document,C="addEventListener",B="removeEventListener",L="getBoundingClientRect",N="horizontal",T=function(){return!1},q=O.attachEvent&&!O[C],i=["","-webkit-","-moz-","-o-"].filter(function(e){var t=j.createElement("div");return t.style.cssText="width:"+e+"calc(9px)",!!t.style.length}).shift()+"calc",s=function(e){return"string"==typeof e||e instanceof String},I=function(e){if(s(e)){var t=j.querySelector(e);if(!t)throw new Error("Selector "+e+" did match a DOM element");return t}return e},R=function(e,t,n){var r=e[t];return void 0!==r?r:n},X=function(e,t,n,r){if(t){if("end"===r)return 0;if("center"===r)return e/2}else if(n){if("start"===r)return 0;if("center"===r)return e/2}return e},Y=function(e,t){var n=j.createElement("div");return n.className="gutter gutter-"+t,n},F=function(e,t,n){var r={};return s(t)?r[e]=t:r[e]=q?t+"%":i+"("+t+"% - "+n+"px)",r},G=function(e,t){var n;return(n={})[e]=t+"px",n};return function(e,i){void 0===i&&(i={});var a,s,o,c,l=e;Array.from&&(l=Array.from(l));var u=I(l[0]).parentNode,f=O.getComputedStyle(u).flexDirection,m=R(i,"sizes")||l.map(function(){return 100/l.length}),t=R(i,"minSize",100),h=Array.isArray(t)?t:l.map(function(){return t}),n=R(i,"expandToMin",!1),d=R(i,"gutterSize",10),v=R(i,"gutterAlign","center"),g=R(i,"snapOffset",30),y=R(i,"dragInterval",0),z=R(i,"direction",N),p=R(i,"cursor",z===N?"ew-resize":"ns-resize"),S=R(i,"gutter",Y),b=R(i,"elementStyle",F),_=R(i,"gutterStyle",G);function E(t,e,n){var r=b(a,e,n);Object.keys(r).forEach(function(e){t.style[e]=r[e]})}function w(){return c.map(function(e){return e.size})}function k(e){var t=c[this.a],n=c[this.b],r=t.size+n.size;t.size=e/this.size*r,n.size=r-e/this.size*r,E(t.element,t.size,this._b),E(n.element,n.size,this._c)}function x(){var e=c[this.a].element,t=c[this.b].element,n=e[L](),r=t[L]();this.size=n[a]+r[a]+this._b+this._c,this.start=n[o]}function U(e){if(0===e.button){var t=this,n=c[t.a].element,r=c[t.b].element;t.dragging||R(i,"onDragStart",T)(w()),e.preventDefault(),t.dragging=!0,t.move=function(e){var t,n=c[this.a],r=c[this.b];this.dragging&&(t="touches"in e?e.touches[0][s]-this.start:e[s]-this.start,0=this.size-(r.minSize+g+this._c)&&(t=this.size-(r.minSize+this._c)),k.call(this,t),R(i,"onDrag",T)())}.bind(t),t.stop=function(){var e=this,t=c[e.a].element,n=c[e.b].element;e.dragging&&R(i,"onDragEnd",T)(w()),e.dragging=!1,O[B]("mouseup",e.stop),O[B]("touchend",e.stop),O[B]("touchcancel",e.stop),O[B]("mousemove",e.move),O[B]("touchmove",e.move),e.stop=null,e.move=null,t[B]("selectstart",T),t[B]("dragstart",T),n[B]("selectstart",T),n[B]("dragstart",T),t.style.userSelect="",t.style.webkitUserSelect="",t.style.MozUserSelect="",t.style.pointerEvents="",n.style.userSelect="",n.style.webkitUserSelect="",n.style.MozUserSelect="",n.style.pointerEvents="",e.gutter.style.cursor="",e.parent.style.cursor="",j.body.style.cursor=""}.bind(t),O[C]("mouseup",t.stop),O[C]("touchend",t.stop),O[C]("touchcancel",t.stop),O[C]("mousemove",t.move),O[C]("touchmove",t.move),n[C]("selectstart",T),n[C]("dragstart",T),r[C]("selectstart",T),r[C]("dragstart",T),n.style.userSelect="none",n.style.webkitUserSelect="none",n.style.MozUserSelect="none",n.style.pointerEvents="none",r.style.userSelect="none",r.style.webkitUserSelect="none",r.style.MozUserSelect="none",r.style.pointerEvents="none",t.gutter.style.cursor=p,t.parent.style.cursor=p,j.body.style.cursor=p,x.call(t)}}z===N?(a="width",s="clientX",o="left"):"vertical"===z&&(a="height",s="clientY",o="top");var M=[];function r(e){var t=e.i===M.length,n=t?M[e.i-1]:M[e.i];x.call(n);var r=t?n.size-e.minSize-n._c:e.minSize+n._b;k.call(n,r)}function D(s){s.forEach(function(e,t){if(0=this.size-(r.minSize+v+this._c)&&(t=this.size-(r.minSize+this._c)),x.call(this,t),Y(i,"onDrag",I)())}.bind(t),t.stop=function(){var e=this,t=c[e.a].element,n=c[e.b].element;e.dragging&&Y(i,"onDragEnd",I)(w()),e.dragging=!1,C[N]("mouseup",e.stop),C[N]("touchend",e.stop),C[N]("touchcancel",e.stop),C[N]("mousemove",e.move),C[N]("touchmove",e.move),e.stop=null,e.move=null,t[N]("selectstart",I),t[N]("dragstart",I),n[N]("selectstart",I),n[N]("dragstart",I),t.style.userSelect="",t.style.webkitUserSelect="",t.style.MozUserSelect="",t.style.pointerEvents="",n.style.userSelect="",n.style.webkitUserSelect="",n.style.MozUserSelect="",n.style.pointerEvents="",e.gutter.style.cursor="",e.parent.style.cursor="",B.body.style.cursor=""}.bind(t),C[L]("mouseup",t.stop),C[L]("touchend",t.stop),C[L]("touchcancel",t.stop),C[L]("mousemove",t.move),C[L]("touchmove",t.move),n[L]("selectstart",I),n[L]("dragstart",I),r[L]("selectstart",I),r[L]("dragstart",I),n.style.userSelect="none",n.style.webkitUserSelect="none",n.style.MozUserSelect="none",n.style.pointerEvents="none",r.style.userSelect="none",r.style.webkitUserSelect="none",r.style.MozUserSelect="none",r.style.pointerEvents="none",t.gutter.style.cursor=p,t.parent.style.cursor=p,B.body.style.cursor=p,U.call(t),t.dragOffset=k(e)-t.end}}z===q?(a="width",t="clientX",s="left",o="right"):"vertical"===z&&(a="height",t="clientY",s="top",o="bottom");var O=[];function D(e){var t=e.i===O.length,n=t?O[e.i-1]:O[e.i];U.call(n);var r=t?n.size-e.minSize-n._c:e.minSize+n._b;x.call(n,r)}function A(s){s.forEach(function(e,t){if(0