@leafer-in/flow 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flow.cjs +738 -1
- package/dist/flow.esm.js +731 -1
- package/dist/flow.esm.min.js +1 -1
- package/dist/flow.js +742 -1
- package/dist/flow.min.cjs +1 -1
- package/dist/flow.min.js +1 -1
- package/package.json +13 -6
- package/src/Flow.ts +23 -0
- package/src/data/FlowData.ts +7 -0
- package/src/decorate.ts +14 -0
- package/src/index.ts +53 -0
- package/src/layout/common/align.ts +44 -0
- package/src/layout/common/bounds.ts +6 -0
- package/src/layout/common/data.ts +51 -0
- package/src/layout/common/gap.ts +10 -0
- package/src/layout/common/wrap.ts +10 -0
- package/src/layout/flowX.ts +110 -0
- package/src/layout/flowY.ts +97 -0
- package/src/layout/x/align.ts +27 -0
- package/src/layout/x/grow.ts +59 -0
- package/src/layout/x/layout.ts +39 -0
- package/src/layout/y/align.ts +28 -0
- package/src/layout/y/grow.ts +59 -0
- package/src/layout/y/layout.ts +38 -0
package/dist/flow.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"@leafer-in/resize";import{BoxData as t,dataProcessor as o,autoLayoutType as e,registerUI as n,Box as i,AlignHelper as h,PointHelper as r,MathHelper as s,decorateLeafAttr as c,attr as a,doBoundsType as l,UI as _,BoundsHelper as g}from"@leafer-ui/draw";function u(t,o,e,n){var i,h=arguments.length,r=h<3?o:null===n?n=Object.getOwnPropertyDescriptor(o,e):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,o,e,n);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(r=(h<3?i(r):h>3?i(o,e,r):i(o,e))||r);return h>3&&r&&Object.defineProperty(o,e,r),r}"function"==typeof SuppressedError&&SuppressedError;let f=class extends i{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};u([o(class extends t{})],f.prototype,"__",void 0),u([e("x")],f.prototype,"flow",void 0),f=u([n()],f);const w={},p={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},d={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function y(t,o,e){h.toPoint(e,o,t.__layout.contentBounds,w);const n=t.__;o.x=n.__autoWidth?0:w.x,o.y=n.__autoHeight?0:w.y}const{move:x}=r;function G(t,o,e,n,i,h){const{children:r}=t;let s,c,{x:a,start:l}=o,_=n;a+=e;for(let t=0,e=o.count;t<e;t++)s=r[h?l-t:l+t],s.__.inFlow&&0!==s.__.visible?(c=s.__flowBounds,"from"!==i&&(_=n+(o.height-c.height)/("center"===i?2:1)),x(s,a-c.x,_-c.y),a+=c.width+o.gap):e++}function m(t,o,e){const n="width"===e?"height":"width";t[e]=Math.max(t[e],o[e]),t[n]+=t.count?o[n]+t.gap:o[n],t.list.push(o),t.count++}const b={};function A(t,o){const{gap:e,flowAlign:n,flowWrap:i,__autoWidth:h,__autoHeight:r}=t.__,s=i&&(o?!h:!r);return"object"==typeof e?(b.xGap=e.x||0,b.yGap=e.y||0):b.xGap=b.yGap=e,b.isAutoXGap="string"==typeof b.xGap&&!h,b.isAutoYGap="string"==typeof b.yGap&&!r,b.complex=s||"top-left"!==n||t.__hasGrow||b.isAutoXGap||b.isAutoYGap,b.wrap=s,b.complex&&(b.isFitXGap="fit"===b.xGap&&!h,b.isFitYGap="fit"===b.yGap&&!r,"object"==typeof n?(b.contentAlign=n.content||"top-left",b.rowXAlign=n.x||"from",b.rowYAlign=n.y||"from"):(b.contentAlign=n,b.rowXAlign=p[n],b.rowYAlign=d[n])),b}function v(t,o){return{x:0,y:0,width:0,height:0,gap:o,start:t,count:0,grow:0}}function B(t,o,e,n){const{count:i}=t;i>1&&(e>t[o]||n)&&(t.gap=(e-t[o])/(i-1),t[o]=e)}function R(t,o){return"box"===o?t.__local:t.__layout.localStrokeBounds}const{within:F}=s;function X(t,o,e,n){let i,h,r,s=0,c=o.hasRangeSize&&[],{grow:a,start:l}=o;const _=o.width<e?(e-o.width)/a:0,{children:g}=t;_&&(o.width=e);for(let t=0,e=o.count;t<e;t++)i=g[n?l-t:l+t],i.__.inFlow&&0!==i.__.visible?(h=i.__widthGrow)&&(r=Y(i,i.__flowBounds,_*h),r?(s+=r,a-=h):c&&(i.__.widthRange?c.unshift(i):c.push(i))):e++;s&&function(t,o,e){let n,i,h,r;t.forEach((t=>{n=t.__widthGrow,i=o/e*n,r=Y(t,h=t.__flowBounds,h.width+i),o-=i-r,e-=n}))}(c,s,a)}function Y(t,o,e){const{widthRange:n,lockRatio:i}=t.__,h=n?F(e,n.min,n.max):e,r=h/o.width;return t.scaleResize(r,i?r:1),o.width=h,e-h}const{within:k}=s;function S(t,o,e,n){let i,h,r,s=0,c=o.hasRangeSize&&[],{grow:a,start:l}=o;const _=o.height<e?(e-o.height)/a:0,{children:g}=t;_&&(o.height=e);for(let t=0,e=o.count;t<e;t++)i=g[n?l-t:l+t],i.__.inFlow&&0!==i.__.visible?(h=i.__heightGrow)&&(r=z(i,i.__flowBounds,_*h),r?(s+=r,a-=h):c&&(i.__.heightRange?c.unshift(i):c.push(i))):e++;s&&function(t,o,e){let n,i,h,r;t.forEach((t=>{n=t.__heightGrow,i=o/e*n,r=z(t,h=t.__flowBounds,h.height+i),o-=i-r,e-=n}))}(c,s,a)}function z(t,o,e){const{heightRange:n,lockRatio:i}=t.__,h=n?k(e,n.min,n.max):e,r=h/o.height;return t.scaleResize(i?r:1,r),o.height=h,e-h}const{move:W}=r;const{move:j}=r;function C(t,o,e,n,i,h){const{children:r}=t;let s,c,{y:a,start:l}=o,_=e;a+=n;for(let t=0,n=o.count;t<n;t++)s=r[h?l-t:l+t],s.__.inFlow&&0!==s.__.visible?(c=s.__flowBounds,"from"!==i&&(_=e+(o.width-c.width)/("center"===i?2:1)),j(s,_-c.x,a-c.y),a+=c.height+o.gap):n++}const{move:E}=r;function P(t){return c(t,(t=>a({set(o){const e="number"==typeof o?o:0;"autoWidth"===t?this.__widthGrow=e:this.__heightGrow=e,!e||this.parent&&this.parent.__hasGrow||this.waitParent((()=>{this.parent.__hasGrow=!0})),this.__setAttr(t,o)&&l(this)}})))}const{copyAndSpread:H}=g;let M=function(t,o){const e="width",{children:n,itemBox:i}=t,h=A(t,!0),{complex:r,wrap:s,xGap:c,yGap:a,isAutoXGap:l,isFitXGap:_}=h;if(!n.length)return;const g=s&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},u=l?0:c;let f,w,d,x,b,{x:F,y:Y,width:k,height:S}=t.__layout.contentBounds;for(let h=0,c=n.length;h<c;h++)f=n[x=o?c-1-h:h],f.__.inFlow&&0!==f.__.visible&&(w=R(f,i),r?(f.__flowBounds=w,b||(b=v(x,u)),s&&b.count&&b.width+w.width>k&&(b.grow?X(t,b,k,o):l&&B(b,e,k,_),m(g,b,e),b=v(x,u)),d=w.width,f.__widthGrow&&(b.grow+=f.__widthGrow,d=0,f.__.widthRange&&(b.hasRangeSize=!0)),f.__heightGrow&&z(f,w,S),b.width+=b.count?d+u:d,b.height=Math.max(b.height,w.height),b.count++):(W(f,F-w.x,Y-w.y),F+=w.width+u));if(r){const{isAutoYGap:n,isFitYGap:i,contentAlign:r,rowXAlign:c,rowYAlign:u}=h;b.count&&(b.grow?X(t,b,k,o):l&&B(b,e,k,_),s&&m(g,b,e)),s?(n?B(g,"height",S,i):g.gap=a,function(t,o,e,n){y(t,o,e);const{list:i}=o;if(i.length>1&&(n||(n=p[e]),"from"!==n)){let t;for(let e=0,h=i.length;e<h;e++)t=i[e],t.x=o.width-t.width,"center"===n&&(t.x/=2)}}(t,g,r,c),function(t,o,e,n){const{list:i}=o,h="reverse"===t.__.flowWrap;let r,{x:s,y:c}=o;for(let a=0,l=i.length;a<l;a++)r=i[h?l-1-a:a],G(t,r,s,c,e,n),c+=r.height+o.gap}(t,g,u,o)):(y(t,b,r),G(t,b,0,b.y,u,o))}},O=function(t,o){const e="height",{children:n,itemBox:i}=t,h=A(t,!1),{complex:r,wrap:s,xGap:c,yGap:a,isAutoYGap:l,isFitYGap:_}=h;if(!n.length)return;const g=s&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},u=l?0:a;let f,w,p,x,G,{x:b,y:F,width:X,height:k}=t.__layout.contentBounds;for(let h=0,c=n.length;h<c;h++)f=n[x=o?c-1-h:h],f.__.inFlow&&0!==f.__.visible&&(w=R(f,i),r?(f.__flowBounds=w,G||(G=v(x,u)),s&&G.count&&G.height+w.height>k&&(G.grow&&S(t,G,k,o),l&&B(G,e,k,_),m(g,G,e),G=v(x,u)),p=w.height,f.__heightGrow&&(G.grow+=f.__heightGrow,p=0,f.__.heightRange&&(G.hasRangeSize=!0)),f.__widthGrow&&Y(f,w,X),G.height+=G.count?p+u:p,G.width=Math.max(G.width,w.width),G.count++):(E(f,b-w.x,F-w.y),F+=w.height+u));if(r){const{isAutoXGap:n,isFitXGap:i,contentAlign:r,rowXAlign:a,rowYAlign:u}=h;G.count&&(G.grow&&S(t,G,k,o),l&&B(G,e,k,_),s&&m(g,G,e)),s?(n?B(g,"width",X,i):g.gap=c,function(t,o,e,n){y(t,o,e);const{list:i}=o;if(i.length>1&&(n||(n=d[e]),"from"!==n)){let t;for(let e=0,h=i.length;e<h;e++)t=i[e],t.y=o.height-t.height,"center"===n&&(t.y/=2)}}(t,g,r,u),function(t,o,e,n){const{list:i}=o,h="reverse"===t.__.flowWrap;let r,{x:s,y:c}=o;for(let a=0,l=i.length;a<l;a++)r=i[h?l-1-a:a],C(t,r,s,c,e,n),s+=r.width+o.gap}(t,g,a,o)):(y(t,G,r),C(t,G,G.x,0,a,o))}};_.changeAttr("autoWidth",void 0,P),_.changeAttr("autoHeight",void 0,P),i.prototype.__updateFlowLayout=function(){this.leafer.created=!1;const{flow:t}=this.__;switch(t){case"x":case!0:M(this);break;case"y":O(this);break;case"x-reverse":M(this,!0);break;case"y-reverse":O(this,!0)}this.leafer.created=!0},i.prototype.__updateContentBounds=function(){const{padding:t}=this.__,o=this.__layout,e=o.contentBounds===o.boxBounds;t?(e&&o.shrinkContent(),H(o.contentBounds,o.boxBounds,t,!0)):e||o.shrinkContentCancel()};export{f as Flow};
|
|
1
|
+
import{PathCommandMap as t,MatrixHelper as e,Direction9 as o,Leaf as i,Text as n,Path as s,Line as h,Polygon as c,Group as r,Box as a,BoxData as l,dataProcessor as _,autoLayoutType as f,registerUI as u,AlignHelper as g,PointHelper as p,MathHelper as d,decorateLeafAttr as w,attr as y,doBoundsType as b,UI as x,BoundsHelper as G}from"@leafer-ui/draw";const{M:m,L:R,C:z,Q:A,Z:k,N:B,D:v,X:S,G:F,F:X,O:Y,P:C,U:O}=t,P={scale(t,e,o){if(!t)return;let i,n=0,s=t.length;for(;n<s;)switch(i=t[n],i){case m:case R:W(t,e,o,n,1),n+=3;break;case z:W(t,e,o,n,3),n+=7;break;case A:W(t,e,o,n,2),n+=5;break;case k:n+=1;break;case B:W(t,e,o,n,2),n+=5;break;case v:W(t,e,o,n,2),n+=9;break;case S:W(t,e,o,n,2),n+=6;break;case F:W(t,e,o,n,2),n+=9;break;case X:W(t,e,o,n,2),n+=5;break;case Y:t[n]=F,t.splice(n+4,0,t[n+3],0),W(t,e,o,n,2),n+=9,s+=2;break;case C:t[n]=X,t.splice(n+4,0,t[n+3]),W(t,e,o,n,2),n+=5,s+=1;break;case O:W(t,e,o,n,2),n+=6}},scalePoints(t,e,o,i,n){for(let s=n?i+1:0,h=n?s+2*n:t.length;s<h;s+=2)t[s]*=e,t[s+1]*=o}},{scalePoints:W}=P,I=e.get(),{topLeft:j,top:E,topRight:H,right:L,bottom:M,left:D}=o;function N(t,e,o){t.pathInputed?U(t,e,o):(1!==e&&(t.width*=e),1!==o&&(t.height*=o))}function Q(t,e,o){const{app:i}=t,n=i&&i.editor;if(n.editing){const i=t.__layout;let{width:s,height:h}=i.boxBounds;switch(s*=(o-e)*(t.scaleX<0?-1:1),h*=(e-o)*(t.scaleY<0?-1:1),n.resizeDirection){case E:case M:t.fontSize*=o,i.affectScaleOrRotation?t.moveInner(-s/2,0):t.x-=s/2;break;case D:case L:t.fontSize*=e,i.affectScaleOrRotation?t.moveInner(0,-h/2):t.y-=h/2;break;case j:case H:t.fontSize*=e,i.affectScaleOrRotation?t.moveInner(0,-h):t.y-=h;break;default:t.fontSize*=e}}else t.fontSize*=e}function U(t,e,o){P.scale(t.__.path,e,o),t.path=t.__.path}function Z(t,e,o){P.scalePoints(t.__.points,e,o),t.points=t.__.points}function q(t,e,o){const{children:i}=t;for(let t=0;t<i.length;t++)I.a=e,I.d=o,i[t].transform(I,!0)}const J=i.prototype;function K(t,e,o,i){var n,s=arguments.length,h=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)h=Reflect.decorate(t,e,o,i);else for(var c=t.length-1;c>=0;c--)(n=t[c])&&(h=(s<3?n(h):s>3?n(e,o,h):n(e,o))||h);return s>3&&h&&Object.defineProperty(e,o,h),h}J.scaleResize=function(t,e=t,o){const i=this;o||i.editConfig&&"scale"===i.editConfig.editSize?(i.scaleX*=t,i.scaleY*=e):(t<0&&(i.scaleX*=-1,t=-t),e<0&&(i.scaleY*=-1,e=-e),this.__scaleResize(t,e))},J.__scaleResize=function(t,e){N(this,t,e)},J.resizeWidth=function(t){const e=t/this.getBounds("box","local").width;this.scaleOf(this.__layout.boxBounds,e,this.__.lockRatio?e:1,!0)},J.resizeHeight=function(t){const e=t/this.getBounds("box","local").height;this.scaleOf(this.__layout.boxBounds,this.__.lockRatio?e:1,e,!0)},n.prototype.__scaleResize=function(t,e){this.__.__autoSize&&(this.__.resizeFontSize||this.editConfig&&"font-size"===this.editConfig.editSize)?Q(this,t,e):N(this,t,e)},s.prototype.__scaleResize=function(t,e){U(this,t,e)},h.prototype.__scaleResize=function(t,e){this.pathInputed?U(this,t,e):this.points?Z(this,t,e):this.width*=t},c.prototype.__scaleResize=function(t,e){this.pathInputed?U(this,t,e):this.points?Z(this,t,e):N(this,t,e)},r.prototype.__scaleResize=function(t,e){q(this,t,e)},a.prototype.__scaleResize=function(t,e){this.__.__autoSize&&this.children.length?q(this,t,e):(N(this,t,e),this.__.resizeChildren&&q(this,t,e))},"function"==typeof SuppressedError&&SuppressedError;let T=class extends a{get __tag(){return"Flow"}constructor(t){super(t),this.__hasAutoLayout=!0}};K([_(class extends l{})],T.prototype,"__",void 0),K([f("x")],T.prototype,"flow",void 0),T=K([u()],T);const V={},$={"top-left":"from",top:"center","top-right":"to",right:"to","bottom-right":"to",bottom:"center","bottom-left":"from",left:"from",center:"center","baseline-left":"from","baseline-center":"center","baseline-right":"to"},tt={"top-left":"from",top:"from","top-right":"from",right:"center","bottom-right":"to",bottom:"to","bottom-left":"to",left:"center",center:"center","baseline-left":"to","baseline-center":"to","baseline-right":"to"};function et(t,e,o){g.toPoint(o,e,t.__layout.contentBounds,V);const i=t.__;e.x=i.__autoWidth?0:V.x,e.y=i.__autoHeight?0:V.y}const{move:ot}=p;function it(t,e,o,i,n,s){const{children:h}=t;let c,r,{x:a,start:l}=e,_=i;a+=o;for(let t=0,o=e.count;t<o;t++)c=h[s?l-t:l+t],c.__.inFlow&&0!==c.__.visible?(r=c.__flowBounds,"from"!==n&&(_=i+(e.height-r.height)/("center"===n?2:1)),ot(c,a-r.x,_-r.y),a+=r.width+e.gap):o++}function nt(t,e,o){const i="width"===o?"height":"width";t[o]=Math.max(t[o],e[o]),t[i]+=t.count?e[i]+t.gap:e[i],t.list.push(e),t.count++}const st={};function ht(t,e){const{gap:o,flowAlign:i,flowWrap:n,__autoWidth:s,__autoHeight:h}=t.__,c=n&&(e?!s:!h);return"object"==typeof o?(st.xGap=o.x||0,st.yGap=o.y||0):st.xGap=st.yGap=o,st.isAutoXGap="string"==typeof st.xGap&&!s,st.isAutoYGap="string"==typeof st.yGap&&!h,st.complex=c||"top-left"!==i||t.__hasGrow||st.isAutoXGap||st.isAutoYGap,st.wrap=c,st.complex&&(st.isFitXGap="fit"===st.xGap&&!s,st.isFitYGap="fit"===st.yGap&&!h,"object"==typeof i?(st.contentAlign=i.content||"top-left",st.rowXAlign=i.x||"from",st.rowYAlign=i.y||"from"):(st.contentAlign=i,st.rowXAlign=$[i],st.rowYAlign=tt[i])),st}function ct(t,e){return{x:0,y:0,width:0,height:0,gap:e,start:t,count:0,grow:0}}function rt(t,e,o,i){const{count:n}=t;n>1&&(o>t[e]||i)&&(t.gap=(o-t[e])/(n-1),t[e]=o)}function at(t,e){return"box"===e?t.__local:t.__layout.localStrokeBounds}const{within:lt}=d;function _t(t,e,o,i){let n,s,h,c=0,r=e.hasRangeSize&&[],{grow:a,start:l}=e;const _=e.width<o?(o-e.width)/a:0,{children:f}=t;_&&(e.width=o);for(let t=0,o=e.count;t<o;t++)n=f[i?l-t:l+t],n.__.inFlow&&0!==n.__.visible?(s=n.__widthGrow)&&(h=ft(n,n.__flowBounds,_*s),h?(c+=h,a-=s):r&&(n.__.widthRange?r.unshift(n):r.push(n))):o++;c&&function(t,e,o){let i,n,s,h;t.forEach((t=>{i=t.__widthGrow,n=e/o*i,h=ft(t,s=t.__flowBounds,s.width+n),e-=n-h,o-=i}))}(r,c,a)}function ft(t,e,o){const{widthRange:i,lockRatio:n}=t.__,s=i?lt(o,i):o,h=s/e.width;return t.scaleResize(h,n?h:1),e.width=s,o-s}const{within:ut}=d;function gt(t,e,o,i){let n,s,h,c=0,r=e.hasRangeSize&&[],{grow:a,start:l}=e;const _=e.height<o?(o-e.height)/a:0,{children:f}=t;_&&(e.height=o);for(let t=0,o=e.count;t<o;t++)n=f[i?l-t:l+t],n.__.inFlow&&0!==n.__.visible?(s=n.__heightGrow)&&(h=pt(n,n.__flowBounds,_*s),h?(c+=h,a-=s):r&&(n.__.heightRange?r.unshift(n):r.push(n))):o++;c&&function(t,e,o){let i,n,s,h;t.forEach((t=>{i=t.__heightGrow,n=e/o*i,h=pt(t,s=t.__flowBounds,s.height+n),e-=n-h,o-=i}))}(r,c,a)}function pt(t,e,o){const{heightRange:i,lockRatio:n}=t.__,s=i?ut(o,i):o,h=s/e.height;return t.scaleResize(n?h:1,h),e.height=s,o-s}const{move:dt}=p;const{move:wt}=p;function yt(t,e,o,i,n,s){const{children:h}=t;let c,r,{y:a,start:l}=e,_=o;a+=i;for(let t=0,i=e.count;t<i;t++)c=h[s?l-t:l+t],c.__.inFlow&&0!==c.__.visible?(r=c.__flowBounds,"from"!==n&&(_=o+(e.width-r.width)/("center"===n?2:1)),wt(c,_-r.x,a-r.y),a+=r.height+e.gap):i++}const{move:bt}=p;function xt(t){return w(t,(t=>y({set(e){const o="number"==typeof e?e:0;"autoWidth"===t?this.__widthGrow=o:this.__heightGrow=o,!o||this.parent&&this.parent.__hasGrow||this.waitParent((()=>{this.parent.__hasGrow=!0})),this.__setAttr(t,e)&&b(this)}})))}const{copyAndSpread:Gt}=G;let mt=function(t,e){const o="width",{children:i,itemBox:n}=t,s=ht(t,!0),{complex:h,wrap:c,xGap:r,yGap:a,isAutoXGap:l,isFitXGap:_}=s;if(!i.length)return;const f=c&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},u=l?0:r;let g,p,d,w,y,{x:b,y:x,width:G,height:m}=t.__layout.contentBounds;for(let s=0,r=i.length;s<r;s++)g=i[w=e?r-1-s:s],g.__.inFlow&&0!==g.__.visible&&(p=at(g,n),h?(g.__flowBounds=p,y||(y=ct(w,u)),c&&y.count&&y.width+p.width>G&&(y.grow?_t(t,y,G,e):l&&rt(y,o,G,_),nt(f,y,o),y=ct(w,u)),d=p.width,g.__widthGrow&&(y.grow+=g.__widthGrow,d=0,g.__.widthRange&&(y.hasRangeSize=!0)),g.__heightGrow&&pt(g,p,m),y.width+=y.count?d+u:d,y.height=Math.max(y.height,p.height),y.count++):(dt(g,b-p.x,x-p.y),b+=p.width+u));if(h){const{isAutoYGap:i,isFitYGap:n,contentAlign:h,rowXAlign:r,rowYAlign:u}=s;y.count&&(y.grow?_t(t,y,G,e):l&&rt(y,o,G,_),c&&nt(f,y,o)),c?(i?rt(f,"height",m,n):f.gap=a,function(t,e,o,i){et(t,e,o);const{list:n}=e;if(n.length>1&&(i||(i=$[o]),"from"!==i)){let t;for(let o=0,s=n.length;o<s;o++)t=n[o],t.x=e.width-t.width,"center"===i&&(t.x/=2)}}(t,f,h,r),function(t,e,o,i){const{list:n}=e,s="reverse"===t.__.flowWrap;let h,{x:c,y:r}=e;for(let a=0,l=n.length;a<l;a++)h=n[s?l-1-a:a],it(t,h,c,r,o,i),r+=h.height+e.gap}(t,f,u,e)):(et(t,y,h),it(t,y,0,y.y,u,e))}},Rt=function(t,e){const o="height",{children:i,itemBox:n}=t,s=ht(t,!1),{complex:h,wrap:c,xGap:r,yGap:a,isAutoYGap:l,isFitYGap:_}=s;if(!i.length)return;const f=c&&{x:0,y:0,width:0,height:0,gap:0,count:0,list:[]},u=l?0:a;let g,p,d,w,y,{x:b,y:x,width:G,height:m}=t.__layout.contentBounds;for(let s=0,r=i.length;s<r;s++)g=i[w=e?r-1-s:s],g.__.inFlow&&0!==g.__.visible&&(p=at(g,n),h?(g.__flowBounds=p,y||(y=ct(w,u)),c&&y.count&&y.height+p.height>m&&(y.grow&>(t,y,m,e),l&&rt(y,o,m,_),nt(f,y,o),y=ct(w,u)),d=p.height,g.__heightGrow&&(y.grow+=g.__heightGrow,d=0,g.__.heightRange&&(y.hasRangeSize=!0)),g.__widthGrow&&ft(g,p,G),y.height+=y.count?d+u:d,y.width=Math.max(y.width,p.width),y.count++):(bt(g,b-p.x,x-p.y),x+=p.height+u));if(h){const{isAutoXGap:i,isFitXGap:n,contentAlign:h,rowXAlign:a,rowYAlign:u}=s;y.count&&(y.grow&>(t,y,m,e),l&&rt(y,o,m,_),c&&nt(f,y,o)),c?(i?rt(f,"width",G,n):f.gap=r,function(t,e,o,i){et(t,e,o);const{list:n}=e;if(n.length>1&&(i||(i=tt[o]),"from"!==i)){let t;for(let o=0,s=n.length;o<s;o++)t=n[o],t.y=e.height-t.height,"center"===i&&(t.y/=2)}}(t,f,h,u),function(t,e,o,i){const{list:n}=e,s="reverse"===t.__.flowWrap;let h,{x:c,y:r}=e;for(let a=0,l=n.length;a<l;a++)h=n[s?l-1-a:a],yt(t,h,c,r,o,i),c+=h.width+e.gap}(t,f,a,e)):(et(t,y,h),yt(t,y,y.x,0,a,e))}};x.changeAttr("autoWidth",void 0,xt),x.changeAttr("autoHeight",void 0,xt),a.prototype.__updateFlowLayout=function(){this.leafer.created=!1;const{flow:t}=this.__;switch(t){case"x":case!0:mt(this);break;case"y":Rt(this);break;case"x-reverse":mt(this,!0);break;case"y-reverse":Rt(this,!0)}this.leafer.created=!0},a.prototype.__updateContentBounds=function(){const{padding:t}=this.__,e=this.__layout,o=e.contentBounds===e.boxBounds;t?(o&&e.shrinkContent(),Gt(e.contentBounds,e.boxBounds,t,!0)):o||e.shrinkContentCancel()};export{T as Flow,P as PathScaler,N as scaleResize,Q as scaleResizeFontSize,q as scaleResizeGroup,U as scaleResizePath,Z as scaleResizePoints};
|