@leafer-ui/miniapp 1.0.0-rc.8 → 1.0.0-rc.9
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/miniapp.esm.js +32 -15
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.module.js +73 -43
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +6 -6
package/dist/miniapp.esm.js
CHANGED
|
@@ -1141,6 +1141,7 @@ Platform.name = 'miniapp';
|
|
|
1141
1141
|
Platform.requestRender = function (render) { Platform.canvas.view.requestAnimationFrame(render); };
|
|
1142
1142
|
Platform.devicePixelRatio = wx.getSystemInfoSync().pixelRatio;
|
|
1143
1143
|
|
|
1144
|
+
let origin = {};
|
|
1144
1145
|
const { get: get$4, rotateOfOuter: rotateOfOuter$2, translate: translate$1, scaleOfOuter: scaleOfOuter$2, scale: scaleHelper, rotate } = MatrixHelper;
|
|
1145
1146
|
function fillOrFitMode(data, mode, box, width, height, rotation) {
|
|
1146
1147
|
const transform = get$4();
|
|
@@ -1157,13 +1158,13 @@ function fillOrFitMode(data, mode, box, width, height, rotation) {
|
|
|
1157
1158
|
data.scaleX = data.scaleY = scale;
|
|
1158
1159
|
data.transform = transform;
|
|
1159
1160
|
}
|
|
1160
|
-
function clipMode(data, box,
|
|
1161
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
1161
1162
|
const transform = get$4();
|
|
1162
1163
|
translate$1(transform, box.x, box.y);
|
|
1163
|
-
if (
|
|
1164
|
-
translate$1(transform,
|
|
1165
|
-
if (
|
|
1166
|
-
|
|
1164
|
+
if (x || y)
|
|
1165
|
+
translate$1(transform, x, y);
|
|
1166
|
+
if (scaleX) {
|
|
1167
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
1167
1168
|
data.scaleX = transform.a;
|
|
1168
1169
|
data.scaleY = transform.d;
|
|
1169
1170
|
}
|
|
@@ -1171,7 +1172,7 @@ function clipMode(data, box, offset, scale, rotation) {
|
|
|
1171
1172
|
rotate(transform, rotation);
|
|
1172
1173
|
data.transform = transform;
|
|
1173
1174
|
}
|
|
1174
|
-
function repeatMode(data, box, width, height,
|
|
1175
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation) {
|
|
1175
1176
|
const transform = get$4();
|
|
1176
1177
|
if (rotation) {
|
|
1177
1178
|
rotate(transform, rotation);
|
|
@@ -1187,10 +1188,15 @@ function repeatMode(data, box, width, height, scale, rotation) {
|
|
|
1187
1188
|
break;
|
|
1188
1189
|
}
|
|
1189
1190
|
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1191
|
+
origin.x = box.x;
|
|
1192
|
+
origin.y = box.y;
|
|
1193
|
+
if (x || y)
|
|
1194
|
+
origin.x += x, origin.y += y;
|
|
1195
|
+
translate$1(transform, origin.x, origin.y);
|
|
1196
|
+
if (scaleX) {
|
|
1197
|
+
scaleOfOuter$2(transform, origin, scaleX, scaleY);
|
|
1198
|
+
data.scaleX = scaleX;
|
|
1199
|
+
data.scaleY = scaleY;
|
|
1194
1200
|
}
|
|
1195
1201
|
data.transform = transform;
|
|
1196
1202
|
}
|
|
@@ -1198,11 +1204,22 @@ function repeatMode(data, box, width, height, scale, rotation) {
|
|
|
1198
1204
|
const { get: get$3, translate } = MatrixHelper;
|
|
1199
1205
|
function createData(leafPaint, image, paint, box) {
|
|
1200
1206
|
let { width, height } = image;
|
|
1201
|
-
const { opacity, mode, offset, scale, rotation, blendMode, repeat } = paint;
|
|
1207
|
+
const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
1202
1208
|
const sameBox = box.width === width && box.height === height;
|
|
1203
1209
|
if (blendMode)
|
|
1204
1210
|
leafPaint.blendMode = blendMode;
|
|
1205
1211
|
const data = leafPaint.data = { mode };
|
|
1212
|
+
let x, y, scaleX, scaleY;
|
|
1213
|
+
if (offset)
|
|
1214
|
+
x = offset.x, y = offset.y;
|
|
1215
|
+
if (size) {
|
|
1216
|
+
scaleX = (typeof size === 'number' ? size : size.width) / width;
|
|
1217
|
+
scaleY = (typeof size === 'number' ? size : size.height) / height;
|
|
1218
|
+
}
|
|
1219
|
+
else if (scale) {
|
|
1220
|
+
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
1221
|
+
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
1222
|
+
}
|
|
1206
1223
|
switch (mode) {
|
|
1207
1224
|
case 'strench':
|
|
1208
1225
|
if (!sameBox)
|
|
@@ -1213,12 +1230,12 @@ function createData(leafPaint, image, paint, box) {
|
|
|
1213
1230
|
}
|
|
1214
1231
|
break;
|
|
1215
1232
|
case 'clip':
|
|
1216
|
-
if (offset ||
|
|
1217
|
-
clipMode(data, box,
|
|
1233
|
+
if (offset || scaleX || rotation)
|
|
1234
|
+
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
1218
1235
|
break;
|
|
1219
1236
|
case 'repeat':
|
|
1220
|
-
if (!sameBox ||
|
|
1221
|
-
repeatMode(data, box, width, height,
|
|
1237
|
+
if (!sameBox || scaleX || rotation)
|
|
1238
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation);
|
|
1222
1239
|
if (!repeat)
|
|
1223
1240
|
data.repeat = 'repeat';
|
|
1224
1241
|
break;
|
package/dist/miniapp.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LeafList as t,DataHelper as e,RenderEvent as i,ChildEvent as s,WatchEvent as n,PropertyEvent as o,LeafHelper as a,BranchHelper as r,Bounds as h,LeafBoundsHelper as d,Debug as l,LeafLevelList as c,LayoutEvent as u,Run as g,ImageManager as f,Platform as p,AnimateEvent as _,ResizeEvent as w,BoundsHelper as y,Creator as m,LeaferCanvasBase as v,canvasPatch as x,canvasSizeAttrs as b,InteractionHelper as B,InteractionBase as R,LeaferImage as E,FileHelper as S,MatrixHelper as k,ImageEvent as L,PointHelper as T,Direction4 as A,TaskProcessor as M}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{ColorConvert as C,ImageManager as O,Paint as I,Effect as P,TextConvert as W,Export as D,Platform as F}from"@leafer-ui/core";export*from"@leafer-ui/core";class z{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(i,s){this.totalTimes=0,this.config={},this.__updatedList=new t,this.target=i,s&&(this.config=e.default(s,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(i.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===s.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new n(n.DATA,{updatedList:this.updatedList})),this.__updatedList=new t,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(o.CHANGE,this.__onAttrChange,this),t.on_([s.ADD,s.REMOVE],this.__onChildEvent,this),t.on_(n.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:N,updateBounds:Y,updateAllWorldOpacity:V}=a,{pushAllChildBranch:U,pushAllParent:H}=r;const{worldBounds:j}=d,X={x:0,y:0,width:1e5,height:1e5};class q{constructor(e){this.updatedBounds=new h,this.beforeBounds=new h,this.afterBounds=new h,e instanceof Array&&(e=new t(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,j)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(X):this.afterBounds.setListWithFn(t,j),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:G,updateAllChange:Q}=a,K=l.get("Layouter");class Z{constructor(t,i){this.totalTimes=0,this.config={},this.__levelList=new c,this.target=t,i&&(this.config=e.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0;try{t.emit(u.START),this.layoutOnce(),t.emitEvent(new u(u.END,this.layoutedBlocks,this.times))}catch(t){K.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?K.warn("layouting"):this.times>3?K.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(n.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=g.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:a}=u,r=this.getBlocks(s);r.forEach((t=>t.setBefore())),i.emitEvent(new u(n,r,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(N(t,!0),e.add(t),t.isBranch&&U(t,e),H(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),H(t,e)))}))}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach((n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Y(s[t])}Y(i)}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&V(t),t.__updateChange()}))}(s),this.extraBlock&&r.push(this.extraBlock),r.forEach((t=>t.setAfter())),i.emitEvent(new u(o,r,this.times)),i.emitEvent(new u(a,r,this.times)),this.addBlocks(r),this.__levelList.reset(),this.__updatedList=null,g.end(e)}fullLayout(){const e=g.start("FullLayout"),{target:i}=this,{BEFORE:s,LAYOUT:n,AFTER:o}=u,a=this.getBlocks(new t(i));i.emitEvent(new u(s,a,this.times)),Z.fullLayout(i),a.forEach((t=>{t.setAfter()})),i.emitEvent(new u(n,a,this.times)),i.emitEvent(new u(o,a,this.times)),this.addBlocks(a),g.end(e)}static fullLayout(t){G(t,!0),t.isBranch?r.updateBounds(t):a.updateBounds(t),Q(t)}addExtra(t){const e=this.extraBlock||(this.extraBlock=new q([]));e.updatedList.add(t),e.beforeBounds.add(t.__world)}createBlock(t){return new q(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(u.REQUEST,this.layout,this),t.on_(u.AGAIN,this.layoutAgain,this),t.on_(n.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const $=l.get("Renderer");class J{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,i,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=i,s&&(this.config=e.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(u.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new h,$.log(e.innerName,"---\x3e");try{this.emitRender(i.START),this.renderOnce(t),this.emitRender(i.END,this.totalBounds),f.clearRecycled()}catch(t){this.rendering=!1,$.error(t)}$.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?$.warn("rendering"):this.times>3?$.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new h,this.renderOptions={},t?(this.emitRender(i.BEFORE),t()):(this.requestLayout(),this.emitRender(i.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(i.RENDER,this.renderBounds,this.renderOptions),this.emitRender(i.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return $.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=g.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=t.includes(this.target.__world),o=new h(s);i.save(),n&&!l.showRepaint?i.clear():(s.spread(1+1/this.canvas.pixelRatio).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0)),this.__render(s,n,o),i.restore(),g.end(e)}fullRender(){const t=g.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds,!0),e.restore(),g.end(t)}__render(t,e,i){const s=t.includes(this.target.__world)?{includes:e}:{bounds:t,includes:e};this.needFill&&this.canvas.fillWorld(t,this.config.fill),l.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=i||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),l.showHitView&&this.renderHitView(s),l.showBoundsView&&this.renderBoundsView(s),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new h;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=Date.now();p.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(_.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:i}=t.old;new h(0,0,e,i).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||$.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new i(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(i.REQUEST,this.update,this),t.on_(u.END,this.__onLayoutEnd,this),t.on_(i.AGAIN,this.renderAgain,this),t.on_(w.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}var tt;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(tt||(tt={}));const{hitRadiusPoint:et}=y;class it{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const o=this.findList,a=this.getBestMatchLeaf(),r=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:r,leaf:a,throughPath:o.length?this.getThroughPath(o):r}:{path:r,leaf:a}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:i,y:s}=this.point,n={x:i,y:s,radiusX:0,radiusY:0};for(let i=0,s=t.length;i<s;i++)if(e=t[i],a.worldHittable(e)&&(this.hitChild(e,n),this.findList.length))return this.findList[0]}return t[0]}getPath(e){const i=new t;for(;e;)i.add(e),e=e.parent;return i.add(this.target),i}getHitablePath(e){const i=this.getPath(e);let s,n=new t;for(let t=i.list.length-1;t>-1&&(s=i.list[t],s.__.hittable)&&(n.addAt(s,0),s.__.hitChildren);t--);return n}getThroughPath(e){const i=new t,s=[];for(let t=e.length-1;t>-1;t--)s.push(this.getPath(e[t]));let n,o,a;for(let t=0,e=s.length;t<e;t++){n=s[t],o=s[t+1];for(let t=0,e=n.length;t<e&&(a=n.list[t],!o||!o.has(a));t++)i.add(a)}return i}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.isMask||(s=!!i.__.hitRadius||et(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&!this.findList.length&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}const{Yes:st,NoAndSkip:nt,YesAndSkip:ot}=tt;class at{constructor(t,i){this.config={},this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.idMap[e]=t,1):0,innerId:(t,e)=>t.innerId===e?(this.innerIdMap[e]=t,1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0},this.target=t,i&&(this.config=e.default(i,this.config)),this.pather=new it(t,this),this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":const s=this.getById(t.substring(1),e);return i?s:s?[s]:[];case".":return this.getByMethod(this.methods.className,e,i,t.substring(1));default:return this.getByMethod(this.methods.tag,e,i,t)}case"function":return this.getByMethod(t,e,i,s)}}getByPoint(t,e,i){return"node"===p.name&&this.target.emit(u.CHECK_UPDATE),this.pather.getByPoint(t,e,i)}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&a.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,o;for(let a=0,r=t.length;a<r;a++){if(n=t[a],o=e(n,s),o===st||o===ot){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<nt&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(s.REMOVE,this.__onRemoveChild,this),this.target.on_(o.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.pather.destroy(),this.findLeaf=null,this.innerIdMap={},this.idMap={})}}Object.assign(m,{watcher:(t,e)=>new z(t,e),layouter:(t,e)=>new Z(t,e),renderer:(t,e,i)=>new J(t,e,i),selector:(t,e)=>new at(t,e)}),p.layout=Z.fullLayout;class rt extends v{get allowBackgroundColor(){return!1}init(){let{view:t}=this.config;t?("string"==typeof t?("#"!==t[0]&&(t="#"+t),this.viewSelect=p.miniapp.select(t)):t.fields?this.viewSelect=t:this.initView(t),this.viewSelect&&p.miniapp.getSizeView(this.viewSelect).then((t=>{this.initView(t)}))):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.__createContext();const{width:e,height:i,pixelRatio:s}=this.config,n={width:e||t.width,height:i||t.height,pixelRatio:s};this.resize(n),this.context.roundRect&&(this.roundRect=function(t,e,i,s,n){this.context.roundRect(t,e,i,s,"number"==typeof n?[n]:n)}),x(this.context.__proto__)}__createView(){this.view=p.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=t*i,this.view.height=e*i}updateClientBounds(t){this.viewSelect&&p.miniapp.getBounds(this.viewSelect).then((e=>{this.clientBounds=e,t&&t()}))}startAutoLayout(t,e){this.resizeListener=e,this.checkSize=this.checkSize.bind(this),p.miniapp.onWindowResize(this.checkSize)}checkSize(){this.viewSelect&&setTimeout((()=>{this.updateClientBounds((()=>{const{width:t,height:i}=this.clientBounds,{pixelRatio:s}=this,n={width:t,height:i,pixelRatio:s};if(!this.isSameSize(n)){const t={};e.copyAttrs(t,this,b),this.resize(n),void 0!==this.width&&this.resizeListener(new w(n,t))}}))}),500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,p.miniapp.offWindowResize(this.checkSize)}}const ht={convertTouch(t,e){const i=ht.getTouch(t),s=B.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class dt extends R{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){if(e&&this.canvas.updateClientBounds(),void 0!==t.x)return{x:t.x,y:t.y};{const{clientBounds:e}=this.canvas;return{x:t.clientX-e.x,y:t.clientY-e.y}}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=ht.getTouch(t);this.pointerDown(ht.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=ht.getTouch(t);this.pointerMove(ht.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=ht.getTouch(t);this.pointerUp(ht.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>=2,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(B.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach((t=>{i=e.find((e=>e.identifier===t.identifier)),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})})),s}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}destroy(){super.destroy(),this.touches=null}}const{mineType:lt,fileType:ct}=S;function ut(t,e){p.origin||(p.origin={createCanvas:(t,i,s)=>e.createOffscreenCanvas({type:"2d",width:t,height:i}),canvasToDataURL:(t,e,i)=>t.toDataURL(lt(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,i,s)=>new Promise(((n,o)=>{let a,r=t.toDataURL(lt(ct(i)),s);r=r.substring(r.indexOf("64,")+3),i.includes("/")||(i=`${e.env.USER_DATA_PATH}/`+i,a=!0);const h=e.getFileSystemManager();h.writeFile({filePath:i,data:r,encoding:"base64",success(){a&&p.miniapp.saveToAlbum(i).then((()=>{h.unlink({filePath:i})})),n()},fail(t){o(t)}})})),loadImage:t=>new Promise(((e,i)=>{const s=p.canvas.view.createImage();s.onload=()=>{e(s)},s.onerror=t=>{i(t)},s.src=t})),noRepeat:"repeat-x"},p.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise((e=>{t.boundingClientRect().exec((t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})}))})),getSizeView:t=>new Promise((e=>{t.fields({node:!0,size:!0}).exec((t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})}))})),saveToAlbum:t=>new Promise((i=>{e.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}})},fail:()=>{}})}})})),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},p.event={stopDefault(t){},stopNow(t){},stop(t){}},p.canvas=m.canvas(),p.conicGradientSupport=!!p.canvas.context.createConicGradient)}Object.assign(m,{canvas:(t,e)=>new rt(t,e),image:t=>new E(t),hitCanvas:(t,e)=>new rt(t,e),interaction:(t,e,i,s)=>new dt(t,e,i,s)}),p.name="miniapp",p.requestRender=function(t){p.canvas.view.requestAnimationFrame(t)},p.devicePixelRatio=wx.getSystemInfoSync().pixelRatio;const{get:gt,rotateOfOuter:ft,translate:pt,scaleOfOuter:_t,scale:wt,rotate:yt}=k;const{get:mt,translate:vt}=k;function xt(t,e,i,s){let{width:n,height:o}=e;const{opacity:a,mode:r,offset:h,scale:d,rotation:l,blendMode:c,repeat:u}=i,g=s.width===n&&s.height===o;c&&(t.blendMode=c);const f=t.data={mode:r};switch(r){case"strench":g||(n=s.width,o=s.height),(s.x||s.y)&&(f.transform=mt(),vt(f.transform,s.x,s.y));break;case"clip":(h||d||l)&&function(t,e,i,s,n){const o=gt();pt(o,e.x,e.y),i&&pt(o,i.x,i.y),s&&("number"==typeof s?wt(o,s):wt(o,s.x,s.y),t.scaleX=o.a,t.scaleY=o.d),n&&yt(o,n),t.transform=o}(f,s,h,d,l);break;case"repeat":(!g||d||l)&&function(t,e,i,s,n,o){const a=gt();if(o)switch(yt(a,o),o){case 90:pt(a,s,0);break;case 180:pt(a,i,s);break;case 270:pt(a,0,i)}pt(a,e.x,e.y),n&&(_t(a,e,n),t.scaleX=t.scaleY=n),t.transform=a}(f,s,n,o,d,l),u||(f.repeat="repeat");break;default:g&&!l||function(t,e,i,s,n,o){const a=gt(),r=o&&180!==o,h=i.width/(r?n:s),d=i.height/(r?s:n),l="fit"===e?Math.min(h,d):Math.max(h,d),c=i.x+(i.width-s*l)/2,u=i.y+(i.height-n*l)/2;pt(a,c,u),wt(a,l),o&&ft(a,{x:i.x+i.width/2,y:i.y+i.height/2},o),t.scaleX=t.scaleY=l,t.transform=a}(f,r,s,n,o,l)}f.width=n,f.height=o,a&&(f.opacity=a),u&&(f.repeat="string"==typeof u?"x"===u?"repeat-x":"repeat-y":"repeat")}function bt(t,e,i){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=i.width,e.__naturalHeight=i.height,!e.__getInput("width")||!e.__getInput("height"))return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",t.__.width),t.setProxyAttr("height",t.__.height)),!1}return!0}function Bt(t,e){e.target.hasEvent(t)&&e.target.emitEvent(new L(t,e))}function Rt(t,e,i,s){return new(i||(i=Promise))((function(n,o){function a(t){try{h(s.next(t))}catch(t){o(t)}}function r(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,r)}h((s=s.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const Et={},{get:St,scale:kt,copy:Lt}=k;function Tt(t,e,i){let{scaleX:s,scaleY:n}=t.__world;const o=s+"-"+n;if(e.patternId===o||t.destroyed)return!1;{s=Math.abs(s),n=Math.abs(n);const{image:t,data:a}=e;let r,h,{width:d,height:l,scaleX:c,scaleY:u,opacity:g,transform:f,repeat:_}=a;c&&(h=St(),Lt(h,f),kt(h,1/c,1/u),s*=c,n*=u),s*=i,n*=i,d*=s,l*=n;const w=d*l;if(!_&&w>p.image.maxCacheSize)return!1;let y=p.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;y>e&&(y=e)}w>y&&(r=Math.sqrt(w/y)),r&&(s/=r,n/=r,d/=r,l/=r),c&&(s/=c,n/=u),(f||1!==s||1!==n)&&(h||(h=St(),f&&Lt(h,f)),kt(h,1/s,1/n));const m=p.canvas.createPattern(t.getCanvas(d<1?1:d,l<1?1:l,g),_||p.origin.noRepeat||"no-repeat");try{e.transform&&(e.transform=null),h&&(m.setTransform?m.setTransform(h):e.transform=h)}catch(t){e.transform=h}return e.style=m,e.patternId=o,!0}}const{abs:At}=Math;function Mt(t,e,i,s){const{scaleX:n,scaleY:o}=t.__world;if(i.data&&i.patternId!==n+"-"+o){const{data:a}=i;if(s)if(a.repeat)s=!1;else{let{width:t,height:i}=a;t*=At(n)*e.pixelRatio,i*=At(o)*e.pixelRatio,a.scaleX&&(t*=a.scaleX,i*=a.scaleY),s=t*i>p.image.maxCacheSize}return s?(e.save(),e.clip(),i.blendMode&&(e.blendMode=i.blendMode),a.opacity&&(e.opacity*=a.opacity),a.transform&&e.transform(a.transform),e.drawImage(i.image.view,0,0,a.width,a.height),e.restore(),!0):(!i.style||Et.running?Tt(t,i,e.pixelRatio):i.patternTask||(i.patternTask=f.patternTasker.add((()=>Rt(this,void 0,void 0,(function*(){i.patternTask=null,e.bounds.hit(t.__world)&&Tt(t,i,e.pixelRatio),t.forceUpdate("surface")}))),300)),!1)}return!1}function Ct(t,e){const i=e["_"+t];if(i instanceof Array){let s,n,o,a;for(let r=0,h=i.length;r<h;r++)s=i[r].image,a=s&&s.url,a&&(n||(n={}),n[a]=!0,f.recycle(s),s.loading&&(o||(o=e.__input&&e.__input[t]||[],o instanceof Array||(o=[o])),s.unload(i[r].loadId,!o.some((t=>t.url===a)))));return n}return null}function Ot(t,e){let i;const{rows:s,decorationY:n,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=s.length;t<a;t++)i=s[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)})),n&&e.fillRect(i.x,i.y+n,i.width,o)}function It(t,e,i,s){const{strokeAlign:n}=e.__,o="string"!=typeof t;switch(n){case"center":i.setStroke(o?void 0:t,e.__.strokeWidth,e.__),o?Dt(t,!0,e,i):Wt(e,i);break;case"inside":Pt("inside",t,o,e,i,s);break;case"outside":Pt("outside",t,o,e,i,s)}}function Pt(t,e,i,s,n,o){const{strokeWidth:a,__font:r}=s.__,h=n.getSameCanvas(!0);h.setStroke(i?void 0:e,2*a,s.__),h.font=r,i?Dt(e,!0,s,h):Wt(s,h),h.blendMode="outside"===t?"destination-out":"destination-in",Ot(s,h),h.blendMode="normal",s.__worldFlipped||o.matrix?n.copyWorldByReset(h):n.copyWorldToInner(h,s.__world,s.__layout.renderBounds),h.recycle()}function Wt(t,e){let i;const{rows:s,decorationY:n,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=s.length;t<a;t++)i=s[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)})),n&&e.strokeRect(i.x,i.y+n,i.width,o)}function Dt(t,e,i,s){let n;for(let o=0,a=t.length;o<a;o++)n=t[o],n.image&&Mt(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?Wt(i,s):s.stroke(),s.restoreBlendMode()):e?Wt(i,s):s.stroke())}const{getSpread:Ft,getOuterOf:zt,getByMove:Nt,getIntersectData:Yt}=y;const Vt={x:.5,y:0},Ut={x:.5,y:1};function Ht(t,e,i){let s;for(let n=0,o=e.length;n<o;n++)s=e[n],t.addColorStop(s.offset,C.string(s.color,i))}const{set:jt,getAngle:Xt,getDistance:qt}=T,{get:Gt,rotateOfOuter:Qt,scaleOfOuter:Kt}=k,Zt={x:.5,y:.5},$t={x:.5,y:1},Jt={},te={};const{set:ee,getAngle:ie,getDistance:se}=T,{get:ne,rotateOfOuter:oe,scaleOfOuter:ae}=k,re={x:.5,y:.5},he={x:.5,y:1},de={},le={};let ce;function ue(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:s}=i.__layout;switch(e.type){case"solid":let{type:n,blendMode:o,color:a,opacity:r}=e;return{type:n,blendMode:o,style:C.string(a,r)};case"image":return function(t,e,i,s,n){const o={type:i.type},a=o.image=f.get(i),r=(n||a.loading)&&{target:t,image:a,attrName:e,attrValue:i};return a.ready?(bt(t,e,a)&&xt(o,a,i,s),n&&(Bt(L.LOAD,r),Bt(L.LOADED,r))):a.error?n&&(t.forceUpdate("surface"),r.error=a.error,Bt(L.ERROR,r)):(n&&Bt(L.LOAD,r),o.loadId=a.load((()=>{t.destroyed||(bt(t,e,a)&&(xt(o,a,i,s),t.forceUpdate("surface")),Bt(L.LOADED,r))}),(e=>{t.forceUpdate("surface"),r.error=e,Bt(L.ERROR,r)}))),o}(i,t,e,s,!ce||!ce[e.url]);case"linear":return function(t,e){let{from:i,to:s,type:n,blendMode:o,opacity:a}=t;i||(i=Vt),s||(s=Ut);const r=p.canvas.createLinearGradient(e.x+i.x*e.width,e.y+i.y*e.height,e.x+s.x*e.width,e.y+s.y*e.height);Ht(r,t.stops,a);const h={type:n,style:r};return o&&(h.blendMode=o),h}(e,s);case"radial":return function(t,e){let{from:i,to:s,type:n,opacity:o,blendMode:a,stretch:r}=t;i||(i=Zt),s||(s=$t);const{x:h,y:d,width:l,height:c}=e;let u;jt(Jt,h+i.x*l,d+i.y*c),jt(te,h+s.x*l,d+s.y*c),(l!==c||r)&&(u=Gt(),Kt(u,Jt,l/c*(r||1),1),Qt(u,Jt,Xt(Jt,te)+90));const g=p.canvas.createRadialGradient(Jt.x,Jt.y,0,Jt.x,Jt.y,qt(Jt,te));Ht(g,t.stops,o);const f={type:n,style:g,transform:u};return a&&(f.blendMode=a),f}(e,s);case"angular":return function(t,e){let{from:i,to:s,type:n,opacity:o,blendMode:a,stretch:r}=t;i||(i=re),s||(s=he);const{x:h,y:d,width:l,height:c}=e;ee(de,h+i.x*l,d+i.y*c),ee(le,h+s.x*l,d+s.y*c);const u=ne(),g=ie(de,le);p.conicGradientRotate90?(ae(u,de,l/c*(r||1),1),oe(u,de,g+90)):(ae(u,de,1,l/c*(r||1)),oe(u,de,g));const f=p.conicGradientSupport?p.canvas.createConicGradient(0,de.x,de.y):p.canvas.createRadialGradient(de.x,de.y,0,de.x,de.y,se(de,le));Ht(f,t.stops,o);const _={type:n,style:f,transform:u};return a&&(_.blendMode=a),_}(e,s);default:return e.r?{type:"solid",style:C.string(e)}:void 0}}var ge=Object.freeze({__proto__:null,compute:function(t,e){const i=[],s=e.__;let n,o,a=s.__input[t];a instanceof Array||(a=[a]),ce=Ct(t,s);for(let s=0,o=a.length;s<o;s++)n=ue(t,a[s],e),n&&i.push(n);if(s["_"+t]=i.length?i:void 0,1===a.length){const t=a[0];"image"===t.type&&(o=O.isPixel(t))}"fill"===t?s.__pixelFill=o:s.__pixelStroke=o},drawTextStroke:Wt,fill:function(t,e,i){i.fillStyle=t,e.__.__font?Ot(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fillText:Ot,fills:function(t,e,i){let s;const{windingRule:n,__font:o}=e.__;for(let a=0,r=t.length;a<r;a++)s=t[a],s.image&&Mt(e,i,s,!o)||s.style&&(i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),o?Ot(e,i):n?i.fill(n):i.fill(),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),o?Ot(e,i):n?i.fill(n):i.fill(),i.restoreBlendMode()):o?Ot(e,i):n?i.fill(n):i.fill())},recycleImage:Ct,shape:function(t,e,i){const s=e.getSameCanvas();let n,o,a,r;const{__world:h}=t;let{scaleX:d,scaleY:l}=h;if(d<0&&(d=-d),l<0&&(l=-l),e.bounds.includes(h,i.matrix))i.matrix?(d*=i.matrix.a,l*=i.matrix.d,n=a=zt(h,i.matrix)):n=a=h,r=s;else{const{renderShapeSpread:s}=t.__layout,c=Yt(s?Ft(e.bounds,s*d,s*l):e.bounds,h,i.matrix);o=e.bounds.getFitMatrix(c),o.a<1&&(r=e.getSameCanvas(),t.__renderShape(r,i),d*=o.a,l*=o.d),a=zt(h,o),n=Nt(a,-o.e,-o.f),i.matrix&&o.multiply(i.matrix),i=Object.assign(Object.assign({},i),{matrix:o})}return t.__renderShape(s,i),{canvas:s,matrix:o,bounds:n,worldCanvas:r,shapeBounds:a,scaleX:d,scaleY:l}},stroke:function(t,e,i,s){const n=e.__,{strokeWidth:o,strokeAlign:a,__font:r}=n;if(o)if(r)It(t,e,i,s);else switch(a){case"center":i.setStroke(t,o,n),i.stroke();break;case"inside":i.save(),i.setStroke(t,2*o,n),n.windingRule?i.clip(n.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const a=i.getSameCanvas(!0);a.setStroke(t,2*o,e.__),e.__drawRenderPath(a),a.stroke(),n.windingRule?a.clip(n.windingRule):a.clip(),a.clearWorld(e.__layout.renderBounds),e.__worldFlipped||s.matrix?i.copyWorldByReset(a):i.copyWorldToInner(a,e.__world,e.__layout.renderBounds),a.recycle()}},strokeText:It,strokes:function(t,e,i,s){const n=e.__,{strokeWidth:o,strokeAlign:a,__font:r}=n;if(o)if(r)It(t,e,i,s);else switch(a){case"center":i.setStroke(void 0,o,n),Dt(t,!1,e,i);break;case"inside":i.save(),i.setStroke(void 0,2*o,n),n.windingRule?i.clip(n.windingRule):i.clip(),Dt(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:a}=e.__layout,r=i.getSameCanvas(!0);e.__drawRenderPath(r),r.setStroke(void 0,2*o,e.__),Dt(t,!1,e,r),n.windingRule?r.clip(n.windingRule):r.clip(),r.clearWorld(a),e.__worldFlipped||s.matrix?i.copyWorldByReset(r):i.copyWorldToInner(r,e.__world,a),r.recycle()}}});const{copy:fe,toOffsetOutBounds:pe}=y,_e={},we={};function ye(t,e,i,s){const{bounds:n,shapeBounds:o}=s;if(p.fullImageShadow){if(fe(_e,t.bounds),_e.x+=e.x-o.x,_e.y+=e.y-o.y,i){const{matrix:t}=s;_e.x-=(n.x+(t?t.e:0)+n.width/2)*(i-1),_e.y-=(n.y+(t?t.f:0)+n.height/2)*(i-1),_e.width*=i,_e.height*=i}t.copyWorld(s.canvas,t.bounds,_e)}else i&&(fe(_e,e),_e.x-=e.width/2*(i-1),_e.y-=e.height/2*(i-1),_e.width*=i,_e.height*=i),t.copyWorld(s.canvas,o,i?_e:e)}const{toOffsetOutBounds:me}=y,ve={};var xe=Object.freeze({__proto__:null,blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__world.a),i.copyWorldToInner(e,t.__world,t.__layout.renderBounds),i.filter="none"},innerShadow:function(t,e,i,s){let n,o;const{__world:a,__layout:r}=t,{innerShadow:h}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:u,scaleY:g}=i,f=e.getSameCanvas(),p=h.length-1;me(l,ve),h.forEach(((h,_)=>{f.save(),f.setWorldShadow(ve.offsetX+h.x*u,ve.offsetY+h.y*g,h.blur*u),o=h.spread?1-2*h.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,ye(f,ve,o,i),f.restore(),d?(f.copyWorld(f,l,a,"copy"),f.copyWorld(d,a,a,"source-out"),n=a):(f.copyWorld(i.canvas,c,l,"source-out"),n=l),f.fillWorld(n,h.color,"source-in"),t.__worldFlipped||s.matrix?e.copyWorldByReset(f,n,a,h.blendMode):e.copyWorldToInner(f,n,r.renderBounds,h.blendMode),p&&_<p&&f.clear()})),f.recycle()},shadow:function(t,e,i,s){let n,o;const{__world:a,__layout:r}=t,{shadow:h}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:u,scaleY:g}=i,f=e.getSameCanvas(),p=h.length-1;pe(l,we),h.forEach(((h,_)=>{f.setWorldShadow(we.offsetX+h.x*u,we.offsetY+h.y*g,h.blur*u,h.color),o=h.spread?1+2*h.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,ye(f,we,o,i),n=l,h.box&&(f.restore(),f.save(),d&&(f.copyWorld(f,l,a,"copy"),n=a),d?f.copyWorld(d,a,a,"destination-out"):f.copyWorld(i.canvas,c,l,"destination-out")),t.__worldFlipped||s.matrix?e.copyWorldByReset(f,n,a,h.blendMode):e.copyWorldToInner(f,n,r.renderBounds,h.blendMode),p&&_<p&&f.clear()})),f.recycle()}});const be=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Be=be+"_#~&*+\\=|≮≯≈≠=…",Re=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function Ee(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const Se=Ee("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),ke=Ee("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Le=Ee(be),Te=Ee(Be),Ae=Ee("- —/~|┆·");var Me;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Me||(Me={}));const{Letter:Ce,Single:Oe,Before:Ie,After:Pe,Symbol:We,Break:De}=Me;function Fe(t){return Se[t]?Ce:Ae[t]?De:ke[t]?Ie:Le[t]?Pe:Te[t]?We:Re.test(t)?Oe:Ce}const ze={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Ne(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Ye}=ze,{Letter:Ve,Single:Ue,Before:He,After:je,Symbol:Xe,Break:qe}=Me;let Ge,Qe,Ke,Ze,$e,Je,ti,ei,ii,si,ni,oi,ai,ri,hi,di,li=[];function ci(t,e){ii&&!ei&&(ei=ii),Ge.data.push({char:t,width:e}),Ke+=e}function ui(){Ze+=Ke,Ge.width=Ke,Qe.words.push(Ge),Ge={data:[]},Ke=0}function gi(){ri&&(hi.paraNumber++,Qe.paraStart=!0,ri=!1),ii&&(Qe.startCharSize=ei,Qe.endCharSize=ii,ei=0),Qe.width=Ze,di.width&&Ye(Qe),li.push(Qe),Qe={words:[]},Ze=0}const{top:fi,right:pi,bottom:_i,left:wi}=A,yi={getDrawData(t,e){"string"!=typeof t&&(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,o=e.__getInput("height")||0;const{textDecoration:a,__font:r,__padding:h}=e;h&&(n&&(i=h[wi],n-=h[pi]+h[wi]),o&&(s=h[fi],o-=h[fi]+h[_i]));const d={bounds:{x:i,y:s,width:n,height:o},rows:[],paraNumber:0,font:p.canvas.font=r};return function(t,e,i){hi=t,li=t.rows,di=t.bounds;const{__letterSpacing:s,paraIndent:n,textCase:o}=i,{canvas:a}=p,{width:r,height:h}=di;if(r||h||s||"none"!==o){const t="none"!==i.textWrap,h="break"===i.textWrap;ri=!0,ni=null,ei=ti=ii=Ke=Ze=0,Ge={data:[]},Qe={words:[]};for(let i=0,d=e.length;i<d;i++)Je=e[i],"\n"===Je?(Ke&&ui(),Qe.paraEnd=!0,gi(),ri=!0):(si=Fe(Je),si===Ve&&"none"!==o&&(Je=Ne(Je,o,!Ke)),ti=a.measureText(Je).width,s&&(s<0&&(ii=ti),ti+=s),oi=si===Ue&&(ni===Ue||ni===Ve)||ni===Ue&&si!==je,ai=!(si!==He&&si!==Ue||ni!==Xe&&ni!==je),$e=ri&&n?r-n:r,t&&r&&Ze+Ke+ti>$e&&(h?(Ke&&ui(),gi()):(ai||(ai=si===Ve&&ni==je),oi||ai||si===qe||si===He||si===Ue||Ke+ti>$e?(Ke&&ui(),gi()):gi()))," "===Je&&!0!==ri&&Ze+Ke===0||(si===qe?(" "===Je&&Ke&&ui(),ci(Je,ti),ui()):oi||ai?(Ke&&ui(),ci(Je,ti)):ci(Je,ti)),ni=si);Ke&&ui(),Ze&&gi(),li.length>0&&(li[li.length-1].paraEnd=!0)}else e.split("\n").forEach((t=>{hi.paraNumber++,li.push({x:n||0,text:t,width:a.measureText(t).width,paraStart:!0})}))}(d,t,e),h&&function(t,e,i,s,n){if(!s)switch(i.textAlign){case"left":mi(e,"x",t[wi]);break;case"right":mi(e,"x",-t[pi])}if(!n)switch(i.verticalAlign){case"top":mi(e,"y",t[fi]);break;case"bottom":mi(e,"y",-t[_i])}}(h,d,e,n,o),function(t,e){const{rows:i,bounds:s}=t,{__lineHeight:n,__baseLine:o,__letterSpacing:a,__clipText:r,textAlign:h,verticalAlign:d,paraSpacing:l}=e;let c,u,g,{x:f,y:p,width:_,height:w}=s,y=n*i.length+(l?l*(t.paraNumber-1):0),m=o;if(r&&y>w)y=Math.max(w,n),t.overflow=i.length;else switch(d){case"middle":p+=(w-y)/2;break;case"bottom":p+=w-y}m+=p;for(let o=0,d=i.length;o<d;o++){switch(c=i[o],c.x=f,h){case"center":c.x+=(_-c.width)/2;break;case"right":c.x+=_-c.width}c.paraStart&&l&&o>0&&(m+=l),c.y=m,m+=n,t.overflow>o&&m>y&&(c.isOverflow=!0,t.overflow=o+1),u=c.x,g=c.width,a<0&&(c.width<0?(g=-c.width+e.fontSize+a,u-=g,g+=e.fontSize):g-=a),u<s.x&&(s.x=u),g>s.width&&(s.width=g),r&&_&&_<g&&(c.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(d,e),function(t,e,i,s){const{rows:n}=t,{textAlign:o,paraIndent:a,letterSpacing:r}=e;let h,d,l,c,u;n.forEach((t=>{t.words&&(l=a&&t.paraStart?a:0,d=i&&"justify"===o&&t.words.length>1?(i-t.width-l)/(t.words.length-1):0,c=r||t.isOverflow?0:d>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===c?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,h=t.x,t.data=[],t.words.forEach((e=>{1===c?(u={char:"",x:h},h=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,h,u)," "!==u.char&&t.data.push(u)):h=function(t,e,i){return t.forEach((t=>{" "!==t.char&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&d&&(h+=d,t.width+=d)}))),t.words=null)}))}(d,e,n),d.overflow&&function(t,e){const{rows:i,overflow:s}=t;let{textOverflow:n}=e;if(i.splice(s),"hide"!==n){let t,o;"ellipsis"===n&&(n="...");const a=p.canvas.measureText(n).width,r=e.x+e.width-a;("none"===e.textWrap?i:[i[s-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],o=t.x+t.width,!(s===i&&o<r));s--){if(o<r&&" "!==t.char){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=a,e.data.push({char:n,x:o}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(d,e),"none"!==a&&function(t,e){const{fontSize:i}=e;switch(t.decorationHeight=i/11,e.textDecoration){case"under":t.decorationY=.15*i;break;case"delete":t.decorationY=.35*-i}}(d,e),d}};function mi(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const vi={string(t,e){if("string"==typeof t)return t;let i=void 0===t.a?1:t.a;e&&(i*=e);const s=t.r+","+t.g+","+t.b;return 1===i?"rgb("+s+")":"rgba("+s+","+i+")"}},xi={export(t,e,i){return xi.running=!0,function(t){bi||(bi=new M);return new Promise((e=>{bi.add((()=>Rt(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((s=>new Promise((n=>{const{leafer:o}=t;o?o.waitViewCompleted((()=>Rt(this,void 0,void 0,(function*(){let t,a,r,{canvas:h}=o,{unreal:d}=h;switch(d&&(h=h.getSameCanvas(),h.backgroundColor=o.config.fill,o.__render(h,{})),typeof i){case"object":i.quality&&(t=i.quality),i.blob&&(a=!0);break;case"number":t=i;break;case"boolean":a=i}r=e.includes(".")?yield h.saveAs(e,t):a?yield h.toBlob(e,t):yield h.toDataURL(e,t),s({data:r}),n(),xi.running=!1,d&&h.recycle()})))):(s({data:!1}),n(),xi.running=!1)}))))}};let bi;Object.assign(I,ge),Object.assign(P,xe),Object.assign(W,yi),Object.assign(C,vi),Object.assign(D,xi);try{ut(0,wx)}catch(t){}rt.prototype.__createContext=function(){if(this.viewSelect){const t=F.origin.createCanvas(1,1),e=this.view.getContext("2d");this.testView=this.view,this.testContext=e,this.view=t}this.context=this.view.getContext("2d"),this.__bindContext()},rt.prototype.updateRender=function(){if(this.testView){let t=this.context.createPattern(this.view,F.origin.noRepeat);this.testContext.clearRect(0,0,this.view.width,this.view.height),this.testContext.fillStyle=t,this.testContext.fillRect(0,0,this.view.width,this.view.height),this.testContext.fillStyle=t=null}},rt.prototype.updateViewSize=function(){const{width:t,height:e,pixelRatio:i,view:s,testView:n}=this;s.width=t*i,s.height=e*i,n&&(n.width=s.width,n.height=s.height)};export{dt as Interaction,Z as Layouter,rt as LeaferCanvas,J as Renderer,at as Selector,z as Watcher,ut as useCanvas};
|
|
1
|
+
import{LeafList as t,DataHelper as e,RenderEvent as i,ChildEvent as s,WatchEvent as n,PropertyEvent as o,LeafHelper as a,BranchHelper as r,Bounds as h,LeafBoundsHelper as d,Debug as l,LeafLevelList as c,LayoutEvent as u,Run as f,ImageManager as g,Platform as p,AnimateEvent as _,ResizeEvent as w,BoundsHelper as y,Creator as m,LeaferCanvasBase as v,canvasPatch as x,canvasSizeAttrs as b,InteractionHelper as B,InteractionBase as R,LeaferImage as E,FileHelper as S,MatrixHelper as k,ImageEvent as L,PointHelper as T,Direction4 as A,TaskProcessor as M}from"@leafer/core";export*from"@leafer/core";export{LeaferImage}from"@leafer/core";import{ColorConvert as C,ImageManager as O,Paint as I,Effect as P,TextConvert as W,Export as D,Platform as z}from"@leafer-ui/core";export*from"@leafer-ui/core";class F{get childrenChanged(){return this.hasAdd||this.hasRemove||this.hasVisible}get updatedList(){if(this.hasRemove){const e=new t;return this.__updatedList.list.forEach((t=>{t.leafer&&e.add(t)})),e}return this.__updatedList}constructor(i,s){this.totalTimes=0,this.config={},this.__updatedList=new t,this.target=i,s&&(this.config=e.default(s,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}update(){this.changed=!0,this.running&&this.target.emit(i.REQUEST)}__onAttrChange(t){this.__updatedList.add(t.target),this.update()}__onChildEvent(t){t.type===s.ADD?(this.hasAdd=!0,this.__pushChild(t.child)):(this.hasRemove=!0,this.__updatedList.add(t.parent)),this.update()}__pushChild(t){this.__updatedList.add(t),t.isBranch&&this.__loopChildren(t)}__loopChildren(t){const{children:e}=t;for(let t=0,i=e.length;t<i;t++)this.__pushChild(e[t])}__onRquestData(){this.target.emitEvent(new n(n.DATA,{updatedList:this.updatedList})),this.__updatedList=new t,this.totalTimes++,this.changed=!1,this.hasVisible=!1,this.hasRemove=!1,this.hasAdd=!1}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(o.CHANGE,this.__onAttrChange,this),t.on_([s.ADD,s.REMOVE],this.__onChildEvent,this),t.on_(n.REQUEST,this.__onRquestData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.__updatedList=null)}}const{updateAllMatrix:N,updateBounds:Y,updateAllWorldOpacity:V}=a,{pushAllChildBranch:U,pushAllParent:H}=r;const{worldBounds:j}=d,X={x:0,y:0,width:1e5,height:1e5};class q{constructor(e){this.updatedBounds=new h,this.beforeBounds=new h,this.afterBounds=new h,e instanceof Array&&(e=new t(e)),this.updatedList=e}setBefore(){this.beforeBounds.setListWithFn(this.updatedList.list,j)}setAfter(){const{list:t}=this.updatedList;t.some((t=>t.noBounds))?this.afterBounds.set(X):this.afterBounds.setListWithFn(t,j),this.updatedBounds.setList([this.beforeBounds,this.afterBounds])}merge(t){this.updatedList.addList(t.updatedList.list),this.beforeBounds.add(t.beforeBounds),this.afterBounds.add(t.afterBounds),this.updatedBounds.add(t.updatedBounds)}destroy(){this.updatedList=null}}const{updateAllMatrix:G,updateAllChange:Q}=a,K=l.get("Layouter");class Z{constructor(t,i){this.totalTimes=0,this.config={},this.__levelList=new c,this.target=t,i&&(this.config=e.default(i,this.config)),this.__listenEvents()}start(){this.disabled||(this.running=!0)}stop(){this.running=!1}disable(){this.stop(),this.__removeListenEvents(),this.disabled=!0}layout(){if(!this.running)return;const{target:t}=this;this.times=0;try{t.emit(u.START),this.layoutOnce(),t.emitEvent(new u(u.END,this.layoutedBlocks,this.times))}catch(t){K.error(t)}this.layoutedBlocks=null}layoutAgain(){this.layouting?this.waitAgain=!0:this.layoutOnce()}layoutOnce(){return this.layouting?K.warn("layouting"):this.times>3?K.warn("layout max times"):(this.times++,this.totalTimes++,this.layouting=!0,this.target.emit(n.REQUEST),this.totalTimes>1?this.partLayout():this.fullLayout(),this.layouting=!1,void(this.waitAgain&&(this.waitAgain=!1,this.layoutOnce())))}partLayout(){var t;if(!(null===(t=this.__updatedList)||void 0===t?void 0:t.length))return;const e=f.start("PartLayout"),{target:i,__updatedList:s}=this,{BEFORE:n,LAYOUT:o,AFTER:a}=u,r=this.getBlocks(s);r.forEach((t=>t.setBefore())),i.emitEvent(new u(n,r,this.times)),this.extraBlock=null,s.sort(),function(t,e){let i;t.list.forEach((t=>{i=t.__layout,e.without(t)&&!i.proxyZoom&&(i.matrixChanged?(N(t,!0),e.add(t),t.isBranch&&U(t,e),H(t,e)):i.boundsChanged&&(e.add(t),t.isBranch&&(t.__tempNumber=0),H(t,e)))}))}(s,this.__levelList),function(t){let e,i,s;t.sort(!0),t.levels.forEach((n=>{e=t.levelMap[n];for(let t=0,n=e.length;t<n;t++){if(i=e[t],i.isBranch&&i.__tempNumber){s=i.children;for(let t=0,e=s.length;t<e;t++)s[t].isBranch||Y(s[t])}Y(i)}}))}(this.__levelList),function(t){t.list.forEach((t=>{t.__layout.opacityChanged&&V(t),t.__updateChange()}))}(s),this.extraBlock&&r.push(this.extraBlock),r.forEach((t=>t.setAfter())),i.emitEvent(new u(o,r,this.times)),i.emitEvent(new u(a,r,this.times)),this.addBlocks(r),this.__levelList.reset(),this.__updatedList=null,f.end(e)}fullLayout(){const e=f.start("FullLayout"),{target:i}=this,{BEFORE:s,LAYOUT:n,AFTER:o}=u,a=this.getBlocks(new t(i));i.emitEvent(new u(s,a,this.times)),Z.fullLayout(i),a.forEach((t=>{t.setAfter()})),i.emitEvent(new u(n,a,this.times)),i.emitEvent(new u(o,a,this.times)),this.addBlocks(a),f.end(e)}static fullLayout(t){G(t,!0),t.isBranch?r.updateBounds(t):a.updateBounds(t),Q(t)}addExtra(t){const e=this.extraBlock||(this.extraBlock=new q([]));e.updatedList.add(t),e.beforeBounds.add(t.__world)}createBlock(t){return new q(t)}getBlocks(t){return[this.createBlock(t)]}addBlocks(t){this.layoutedBlocks?this.layoutedBlocks.push(...t):this.layoutedBlocks=t}__onReceiveWatchData(t){this.__updatedList=t.data.updatedList}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(u.REQUEST,this.layout,this),t.on_(u.AGAIN,this.layoutAgain,this),t.on_(n.DATA,this.__onReceiveWatchData,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=this.config=null)}}const $=l.get("Renderer");class J{get needFill(){return!(this.canvas.allowBackgroundColor||!this.config.fill)}constructor(t,i,s){this.FPS=60,this.totalTimes=0,this.times=0,this.config={usePartRender:!0,maxFPS:60},this.target=t,this.canvas=i,s&&(this.config=e.default(s,this.config)),this.__listenEvents(),this.__requestRender()}start(){this.running=!0}stop(){this.running=!1}update(){this.changed=!0}requestLayout(){this.target.emit(u.REQUEST)}render(t){if(!this.running||!this.canvas.view)return void(this.changed=!0);const{target:e}=this;this.times=0,this.totalBounds=new h,$.log(e.innerName,"---\x3e");try{this.emitRender(i.START),this.renderOnce(t),this.emitRender(i.END,this.totalBounds),g.clearRecycled()}catch(t){this.rendering=!1,$.error(t)}$.log("-------------|")}renderAgain(){this.rendering?this.waitAgain=!0:this.renderOnce()}renderOnce(t){return this.rendering?$.warn("rendering"):this.times>3?$.warn("render max times"):(this.times++,this.totalTimes++,this.rendering=!0,this.changed=!1,this.renderBounds=new h,this.renderOptions={},t?(this.emitRender(i.BEFORE),t()):(this.requestLayout(),this.emitRender(i.BEFORE),this.config.usePartRender&&this.totalTimes>1?this.partRender():this.fullRender()),this.emitRender(i.RENDER,this.renderBounds,this.renderOptions),this.emitRender(i.AFTER,this.renderBounds,this.renderOptions),this.updateBlocks=null,this.rendering=!1,void(this.waitAgain&&(this.waitAgain=!1,this.renderOnce())))}partRender(){const{canvas:t,updateBlocks:e}=this;if(!e)return $.warn("PartRender: need update attr");this.mergeBlocks(),e.forEach((e=>{t.bounds.hit(e)&&!e.isEmpty()&&this.clipRender(e)}))}clipRender(t){const e=f.start("PartRender"),{canvas:i}=this,s=t.getIntersect(i.bounds),n=t.includes(this.target.__world),o=new h(s);i.save(),n&&!l.showRepaint?i.clear():(s.spread(1+1/this.canvas.pixelRatio).ceil(),i.clearWorld(s,!0),i.clipWorld(s,!0)),this.__render(s,n,o),i.restore(),f.end(e)}fullRender(){const t=f.start("FullRender"),{canvas:e}=this;e.save(),e.clear(),this.__render(e.bounds,!0),e.restore(),f.end(t)}__render(t,e,i){const s=t.includes(this.target.__world)?{includes:e}:{bounds:t,includes:e};this.needFill&&this.canvas.fillWorld(t,this.config.fill),l.showRepaint&&this.canvas.strokeWorld(t,"red"),this.target.__render(this.canvas,s),this.renderBounds=i||t,this.renderOptions=s,this.totalBounds.isEmpty()?this.totalBounds=this.renderBounds:this.totalBounds.add(this.renderBounds),l.showHitView&&this.renderHitView(s),l.showBoundsView&&this.renderBoundsView(s),this.canvas.updateRender()}renderHitView(t){}renderBoundsView(t){}addBlock(t){this.updateBlocks||(this.updateBlocks=[]),this.updateBlocks.push(t)}mergeBlocks(){const{updateBlocks:t}=this;if(t){const e=new h;e.setList(t),t.length=0,t.push(e)}}__requestRender(){const t=Date.now();p.requestRender((()=>{this.FPS=Math.min(60,Math.ceil(1e3/(Date.now()-t))),this.changed&&this.running&&this.canvas.view&&this.render(),this.running&&this.target.emit(_.FRAME),this.target&&this.__requestRender()}))}__onResize(t){if(!this.canvas.unreal&&(t.bigger||!t.samePixelRatio)){const{width:e,height:i}=t.old;new h(0,0,e,i).includes(this.target.__world)&&!this.needFill&&t.samePixelRatio||(this.addBlock(this.canvas.bounds),this.target.forceUpdate("blendMode"))}}__onLayoutEnd(t){t.data&&t.data.map((t=>{let e;t.updatedList&&t.updatedList.list.some((t=>(e=!t.__world.width||!t.__world.height,e&&(t.isLeafer||$.tip(t.innerName,": empty"),e=!t.isBranch||t.isBranchLeaf),e))),this.addBlock(e?this.canvas.bounds:t.updatedBounds)}))}emitRender(t,e,s){this.target.emitEvent(new i(t,this.times,e,s))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(i.REQUEST,this.update,this),t.on_(u.END,this.__onLayoutEnd,this),t.on_(i.AGAIN,this.renderAgain,this),t.on_(w.RESIZE,this.__onResize,this)]}__removeListenEvents(){this.target.off_(this.__eventIds)}destroy(){this.target&&(this.stop(),this.__removeListenEvents(),this.target=null,this.canvas=null,this.config=null)}}var tt;!function(t){t[t.No=0]="No",t[t.Yes=1]="Yes",t[t.NoAndSkip=2]="NoAndSkip",t[t.YesAndSkip=3]="YesAndSkip"}(tt||(tt={}));const{hitRadiusPoint:et}=y;class it{constructor(t,e){this.target=t,this.selector=e}getByPoint(t,e,i){e||(e=0),i||(i={});const s=i.through||!1,n=i.ignoreHittable||!1;this.exclude=i.exclude||null,this.point={x:t.x,y:t.y,radiusX:e,radiusY:e},this.findList=[],this.eachFind(this.target.children,this.target.__onlyHitMask);const o=this.findList,a=this.getBestMatchLeaf(),r=n?this.getPath(a):this.getHitablePath(a);return this.clear(),s?{path:r,leaf:a,throughPath:o.length?this.getThroughPath(o):r}:{path:r,leaf:a}}getBestMatchLeaf(){const{findList:t}=this;if(t.length>1){let e;this.findList=[];const{x:i,y:s}=this.point,n={x:i,y:s,radiusX:0,radiusY:0};for(let i=0,s=t.length;i<s;i++)if(e=t[i],a.worldHittable(e)&&(this.hitChild(e,n),this.findList.length))return this.findList[0]}return t[0]}getPath(e){const i=new t;for(;e;)i.add(e),e=e.parent;return i.add(this.target),i}getHitablePath(e){const i=this.getPath(e);let s,n=new t;for(let t=i.list.length-1;t>-1&&(s=i.list[t],s.__.hittable)&&(n.addAt(s,0),s.__.hitChildren);t--);return n}getThroughPath(e){const i=new t,s=[];for(let t=e.length-1;t>-1;t--)s.push(this.getPath(e[t]));let n,o,a;for(let t=0,e=s.length;t<e;t++){n=s[t],o=s[t+1];for(let t=0,e=n.length;t<e&&(a=n.list[t],!o||!o.has(a));t++)i.add(a)}return i}eachFind(t,e){let i,s;const{point:n}=this;for(let o=t.length-1;o>-1;o--)i=t[o],!i.__.visible||e&&!i.__.isMask||(s=!!i.__.hitRadius||et(i.__world,n),i.isBranch?(s||i.__ignoreHitWorld)&&(this.eachFind(i.children,i.__onlyHitMask),i.isBranchLeaf&&!this.findList.length&&this.hitChild(i,n)):s&&this.hitChild(i,n))}hitChild(t,e){this.exclude&&this.exclude.has(t)||t.__hitWorld(e)&&this.findList.push(t)}clear(){this.point=null,this.findList=null,this.exclude=null}destroy(){this.clear()}}const{Yes:st,NoAndSkip:nt,YesAndSkip:ot}=tt;class at{constructor(t,i){this.config={},this.innerIdMap={},this.idMap={},this.methods={id:(t,e)=>t.id===e?(this.idMap[e]=t,1):0,innerId:(t,e)=>t.innerId===e?(this.innerIdMap[e]=t,1):0,className:(t,e)=>t.className===e?1:0,tag:(t,e)=>t.__tag===e?1:0},this.target=t,i&&(this.config=e.default(i,this.config)),this.pather=new it(t,this),this.__listenEvents()}getBy(t,e,i,s){switch(typeof t){case"number":const n=this.getByInnerId(t,e);return i?n:n?[n]:[];case"string":switch(t[0]){case"#":const s=this.getById(t.substring(1),e);return i?s:s?[s]:[];case".":return this.getByMethod(this.methods.className,e,i,t.substring(1));default:return this.getByMethod(this.methods.tag,e,i,t)}case"function":return this.getByMethod(t,e,i,s)}}getByPoint(t,e,i){return"node"===p.name&&this.target.emit(u.CHECK_UPDATE),this.pather.getByPoint(t,e,i)}getByInnerId(t,e){const i=this.innerIdMap[t];return i||(this.eachFind(this.toChildren(e),this.methods.innerId,null,t),this.findLeaf)}getById(t,e){const i=this.idMap[t];return i&&a.hasParent(i,e||this.target)?i:(this.eachFind(this.toChildren(e),this.methods.id,null,t),this.findLeaf)}getByClassName(t,e){return this.getByMethod(this.methods.className,e,!1,t)}getByTag(t,e){return this.getByMethod(this.methods.tag,e,!1,t)}getByMethod(t,e,i,s){const n=i?null:[];return this.eachFind(this.toChildren(e),t,n,s),n||this.findLeaf}eachFind(t,e,i,s){let n,o;for(let a=0,r=t.length;a<r;a++){if(n=t[a],o=e(n,s),o===st||o===ot){if(!i)return void(this.findLeaf=n);i.push(n)}n.isBranch&&o<nt&&this.eachFind(n.children,e,i,s)}}toChildren(t){return this.findLeaf=null,[t||this.target]}__onRemoveChild(t){const{id:e,innerId:i}=t.child;this.idMap[e]&&delete this.idMap[e],this.innerIdMap[i]&&delete this.innerIdMap[i]}__checkIdChange(t){if("id"===t.attrName){const e=t.oldValue;this.idMap[e]&&delete this.idMap[e]}}__listenEvents(){this.__eventIds=[this.target.on_(s.REMOVE,this.__onRemoveChild,this),this.target.on_(o.CHANGE,this.__checkIdChange,this)]}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}destroy(){this.__eventIds.length&&(this.__removeListenEvents(),this.pather.destroy(),this.findLeaf=null,this.innerIdMap={},this.idMap={})}}Object.assign(m,{watcher:(t,e)=>new F(t,e),layouter:(t,e)=>new Z(t,e),renderer:(t,e,i)=>new J(t,e,i),selector:(t,e)=>new at(t,e)}),p.layout=Z.fullLayout;class rt extends v{get allowBackgroundColor(){return!1}init(){let{view:t}=this.config;t?("string"==typeof t?("#"!==t[0]&&(t="#"+t),this.viewSelect=p.miniapp.select(t)):t.fields?this.viewSelect=t:this.initView(t),this.viewSelect&&p.miniapp.getSizeView(this.viewSelect).then((t=>{this.initView(t)}))):this.initView()}initView(t){t?this.view=t.view||t:(t={},this.__createView()),this.__createContext();const{width:e,height:i,pixelRatio:s}=this.config,n={width:e||t.width,height:i||t.height,pixelRatio:s};this.resize(n),this.context.roundRect&&(this.roundRect=function(t,e,i,s,n){this.context.roundRect(t,e,i,s,"number"==typeof n?[n]:n)}),x(this.context.__proto__)}__createView(){this.view=p.origin.createCanvas(1,1)}updateViewSize(){const{width:t,height:e,pixelRatio:i}=this;this.view.width=t*i,this.view.height=e*i}updateClientBounds(t){this.viewSelect&&p.miniapp.getBounds(this.viewSelect).then((e=>{this.clientBounds=e,t&&t()}))}startAutoLayout(t,e){this.resizeListener=e,this.checkSize=this.checkSize.bind(this),p.miniapp.onWindowResize(this.checkSize)}checkSize(){this.viewSelect&&setTimeout((()=>{this.updateClientBounds((()=>{const{width:t,height:i}=this.clientBounds,{pixelRatio:s}=this,n={width:t,height:i,pixelRatio:s};if(!this.isSameSize(n)){const t={};e.copyAttrs(t,this,b),this.resize(n),void 0!==this.width&&this.resizeListener(new w(n,t))}}))}),500)}stopAutoLayout(){this.autoLayout=!1,this.resizeListener=null,p.miniapp.offWindowResize(this.checkSize)}}const ht={convertTouch(t,e){const i=ht.getTouch(t),s=B.getBase(t);return Object.assign(Object.assign({},s),{x:e.x,y:e.y,width:1,height:1,pointerType:"touch",pressure:i.force||1})},getTouch:t=>t.touches[0]||t.changedTouches[0]};class dt extends R{__listenEvents(){super.__listenEvents(),this.config.eventer&&(this.config.eventer.receiveEvent=this.receive.bind(this))}receive(t){switch(t.type){case"touchstart":this.onTouchStart(t);break;case"touchmove":this.onTouchMove(t);break;case"touchend":this.onTouchEnd(t);break;case"touchcancel":this.onTouchCancel()}}getLocal(t,e){if(e&&this.canvas.updateClientBounds(),void 0!==t.x)return{x:t.x,y:t.y};{const{clientBounds:e}=this.canvas;return{x:t.clientX-e.x,y:t.clientY-e.y}}}getTouches(t){return t}onTouchStart(t){this.multiTouchStart(t);const e=ht.getTouch(t);this.pointerDown(ht.convertTouch(t,this.getLocal(e,!0)))}onTouchMove(t){if(this.multiTouchMove(t),this.useMultiTouch)return;const e=ht.getTouch(t);this.pointerMove(ht.convertTouch(t,this.getLocal(e)))}onTouchEnd(t){this.multiTouchEnd();const e=ht.getTouch(t);this.pointerUp(ht.convertTouch(t,this.getLocal(e)))}onTouchCancel(){this.pointerCancel()}multiTouchStart(t){this.useMultiTouch=t.touches.length>=2,this.touches=this.useMultiTouch?this.getTouches(t.touches):void 0,this.useMultiTouch&&this.pointerCancel()}multiTouchMove(t){if(this.useMultiTouch&&t.touches.length>1){const e=this.getTouches(t.touches),i=this.getKeepTouchList(this.touches,e);i.length>1&&(this.multiTouch(B.getBase(t),i),this.touches=e)}}multiTouchEnd(){this.touches=null,this.useMultiTouch=!1,this.transformEnd()}getKeepTouchList(t,e){let i;const s=[];return t.forEach((t=>{i=e.find((e=>e.identifier===t.identifier)),i&&s.push({from:this.getLocal(t),to:this.getLocal(i)})})),s}getLocalTouchs(t){return t.map((t=>this.getLocal(t)))}destroy(){super.destroy(),this.touches=null}}const{mineType:lt,fileType:ct}=S;function ut(t,e){p.origin||(p.origin={createCanvas:(t,i,s)=>e.createOffscreenCanvas({type:"2d",width:t,height:i}),canvasToDataURL:(t,e,i)=>t.toDataURL(lt(e),i),canvasToBolb:(t,e,i)=>t.toBuffer(e,{quality:i}),canvasSaveAs:(t,i,s)=>new Promise(((n,o)=>{let a,r=t.toDataURL(lt(ct(i)),s);r=r.substring(r.indexOf("64,")+3),i.includes("/")||(i=`${e.env.USER_DATA_PATH}/`+i,a=!0);const h=e.getFileSystemManager();h.writeFile({filePath:i,data:r,encoding:"base64",success(){a&&p.miniapp.saveToAlbum(i).then((()=>{h.unlink({filePath:i})})),n()},fail(t){o(t)}})})),loadImage:t=>new Promise(((e,i)=>{const s=p.canvas.view.createImage();s.onload=()=>{e(s)},s.onerror=t=>{i(t)},s.src=t})),noRepeat:"repeat-x"},p.miniapp={select:t=>e.createSelectorQuery().select(t),getBounds:t=>new Promise((e=>{t.boundingClientRect().exec((t=>{const i=t[1];e({x:i.top,y:i.left,width:i.width,height:i.height})}))})),getSizeView:t=>new Promise((e=>{t.fields({node:!0,size:!0}).exec((t=>{const i=t[0];e({view:i.node,width:i.width,height:i.height})}))})),saveToAlbum:t=>new Promise((i=>{e.getSetting({success:s=>{s.authSetting["scope.writePhotosAlbum"]?e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}}):e.authorize({scope:"scope.writePhotosAlbum",success:()=>{e.saveImageToPhotosAlbum({filePath:t,success(){i(!0)}})},fail:()=>{}})}})})),onWindowResize(t){e.onWindowResize(t)},offWindowResize(t){e.offWindowResize(t)}},p.event={stopDefault(t){},stopNow(t){},stop(t){}},p.canvas=m.canvas(),p.conicGradientSupport=!!p.canvas.context.createConicGradient)}Object.assign(m,{canvas:(t,e)=>new rt(t,e),image:t=>new E(t),hitCanvas:(t,e)=>new rt(t,e),interaction:(t,e,i,s)=>new dt(t,e,i,s)}),p.name="miniapp",p.requestRender=function(t){p.canvas.view.requestAnimationFrame(t)},p.devicePixelRatio=wx.getSystemInfoSync().pixelRatio;let ft={};const{get:gt,rotateOfOuter:pt,translate:_t,scaleOfOuter:wt,scale:yt,rotate:mt}=k;const{get:vt,translate:xt}=k;function bt(t,e,i,s){let{width:n,height:o}=e;const{opacity:a,mode:r,offset:h,scale:d,size:l,rotation:c,blendMode:u,repeat:f}=i,g=s.width===n&&s.height===o;u&&(t.blendMode=u);const p=t.data={mode:r};let _,w,y,m;switch(h&&(_=h.x,w=h.y),l?(y=("number"==typeof l?l:l.width)/n,m=("number"==typeof l?l:l.height)/o):d&&(y="number"==typeof d?d:d.x,m="number"==typeof d?d:d.y),r){case"strench":g||(n=s.width,o=s.height),(s.x||s.y)&&(p.transform=vt(),xt(p.transform,s.x,s.y));break;case"clip":(h||y||c)&&function(t,e,i,s,n,o,a){const r=gt();_t(r,e.x,e.y),(i||s)&&_t(r,i,s),n&&(yt(r,n,o),t.scaleX=r.a,t.scaleY=r.d),a&&mt(r,a),t.transform=r}(p,s,_,w,y,m,c);break;case"repeat":(!g||y||c)&&function(t,e,i,s,n,o,a,r,h){const d=gt();if(h)switch(mt(d,h),h){case 90:_t(d,s,0);break;case 180:_t(d,i,s);break;case 270:_t(d,0,i)}ft.x=e.x,ft.y=e.y,(n||o)&&(ft.x+=n,ft.y+=o),_t(d,ft.x,ft.y),a&&(wt(d,ft,a,r),t.scaleX=a,t.scaleY=r),t.transform=d}(p,s,n,o,_,w,y,m,c),f||(p.repeat="repeat");break;default:g&&!c||function(t,e,i,s,n,o){const a=gt(),r=o&&180!==o,h=i.width/(r?n:s),d=i.height/(r?s:n),l="fit"===e?Math.min(h,d):Math.max(h,d),c=i.x+(i.width-s*l)/2,u=i.y+(i.height-n*l)/2;_t(a,c,u),yt(a,l),o&&pt(a,{x:i.x+i.width/2,y:i.y+i.height/2},o),t.scaleX=t.scaleY=l,t.transform=a}(p,r,s,n,o,c)}p.width=n,p.height=o,a&&(p.opacity=a),f&&(p.repeat="string"==typeof f?"x"===f?"repeat-x":"repeat-y":"repeat")}function Bt(t,e,i){if("fill"===e&&!t.__.__naturalWidth){const{__:e}=t;if(e.__naturalWidth=i.width,e.__naturalHeight=i.height,!e.__getInput("width")||!e.__getInput("height"))return t.forceUpdate("width"),t.__proxyData&&(t.setProxyAttr("width",t.__.width),t.setProxyAttr("height",t.__.height)),!1}return!0}function Rt(t,e){e.target.hasEvent(t)&&e.target.emitEvent(new L(t,e))}function Et(t,e,i,s){return new(i||(i=Promise))((function(n,o){function a(t){try{h(s.next(t))}catch(t){o(t)}}function r(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,r)}h((s=s.apply(t,e||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const St={},{get:kt,scale:Lt,copy:Tt}=k;function At(t,e,i){let{scaleX:s,scaleY:n}=t.__world;const o=s+"-"+n;if(e.patternId===o||t.destroyed)return!1;{s=Math.abs(s),n=Math.abs(n);const{image:t,data:a}=e;let r,h,{width:d,height:l,scaleX:c,scaleY:u,opacity:f,transform:g,repeat:_}=a;c&&(h=kt(),Tt(h,g),Lt(h,1/c,1/u),s*=c,n*=u),s*=i,n*=i,d*=s,l*=n;const w=d*l;if(!_&&w>p.image.maxCacheSize)return!1;let y=p.image.maxPatternSize;if(!t.isSVG){const e=t.width*t.height;y>e&&(y=e)}w>y&&(r=Math.sqrt(w/y)),r&&(s/=r,n/=r,d/=r,l/=r),c&&(s/=c,n/=u),(g||1!==s||1!==n)&&(h||(h=kt(),g&&Tt(h,g)),Lt(h,1/s,1/n));const m=p.canvas.createPattern(t.getCanvas(d<1?1:d,l<1?1:l,f),_||p.origin.noRepeat||"no-repeat");try{e.transform&&(e.transform=null),h&&(m.setTransform?m.setTransform(h):e.transform=h)}catch(t){e.transform=h}return e.style=m,e.patternId=o,!0}}const{abs:Mt}=Math;function Ct(t,e,i,s){const{scaleX:n,scaleY:o}=t.__world;if(i.data&&i.patternId!==n+"-"+o){const{data:a}=i;if(s)if(a.repeat)s=!1;else{let{width:t,height:i}=a;t*=Mt(n)*e.pixelRatio,i*=Mt(o)*e.pixelRatio,a.scaleX&&(t*=a.scaleX,i*=a.scaleY),s=t*i>p.image.maxCacheSize}return s?(e.save(),e.clip(),i.blendMode&&(e.blendMode=i.blendMode),a.opacity&&(e.opacity*=a.opacity),a.transform&&e.transform(a.transform),e.drawImage(i.image.view,0,0,a.width,a.height),e.restore(),!0):(!i.style||St.running?At(t,i,e.pixelRatio):i.patternTask||(i.patternTask=g.patternTasker.add((()=>Et(this,void 0,void 0,(function*(){i.patternTask=null,e.bounds.hit(t.__world)&&At(t,i,e.pixelRatio),t.forceUpdate("surface")}))),300)),!1)}return!1}function Ot(t,e){const i=e["_"+t];if(i instanceof Array){let s,n,o,a;for(let r=0,h=i.length;r<h;r++)s=i[r].image,a=s&&s.url,a&&(n||(n={}),n[a]=!0,g.recycle(s),s.loading&&(o||(o=e.__input&&e.__input[t]||[],o instanceof Array||(o=[o])),s.unload(i[r].loadId,!o.some((t=>t.url===a)))));return n}return null}function It(t,e){let i;const{rows:s,decorationY:n,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=s.length;t<a;t++)i=s[t],i.text?e.fillText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.fillText(t.char,t.x,i.y)})),n&&e.fillRect(i.x,i.y+n,i.width,o)}function Pt(t,e,i,s){const{strokeAlign:n}=e.__,o="string"!=typeof t;switch(n){case"center":i.setStroke(o?void 0:t,e.__.strokeWidth,e.__),o?zt(t,!0,e,i):Dt(e,i);break;case"inside":Wt("inside",t,o,e,i,s);break;case"outside":Wt("outside",t,o,e,i,s)}}function Wt(t,e,i,s,n,o){const{strokeWidth:a,__font:r}=s.__,h=n.getSameCanvas(!0);h.setStroke(i?void 0:e,2*a,s.__),h.font=r,i?zt(e,!0,s,h):Dt(s,h),h.blendMode="outside"===t?"destination-out":"destination-in",It(s,h),h.blendMode="normal",s.__worldFlipped||o.matrix?n.copyWorldByReset(h):n.copyWorldToInner(h,s.__world,s.__layout.renderBounds),h.recycle()}function Dt(t,e){let i;const{rows:s,decorationY:n,decorationHeight:o}=t.__.__textDrawData;for(let t=0,a=s.length;t<a;t++)i=s[t],i.text?e.strokeText(i.text,i.x,i.y):i.data&&i.data.forEach((t=>{e.strokeText(t.char,t.x,i.y)})),n&&e.strokeRect(i.x,i.y+n,i.width,o)}function zt(t,e,i,s){let n;for(let o=0,a=t.length;o<a;o++)n=t[o],n.image&&Ct(i,s,n,!1)||n.style&&(s.strokeStyle=n.style,n.blendMode?(s.saveBlendMode(n.blendMode),e?Dt(i,s):s.stroke(),s.restoreBlendMode()):e?Dt(i,s):s.stroke())}const{getSpread:Ft,getOuterOf:Nt,getByMove:Yt,getIntersectData:Vt}=y;const Ut={x:.5,y:0},Ht={x:.5,y:1};function jt(t,e,i){let s;for(let n=0,o=e.length;n<o;n++)s=e[n],t.addColorStop(s.offset,C.string(s.color,i))}const{set:Xt,getAngle:qt,getDistance:Gt}=T,{get:Qt,rotateOfOuter:Kt,scaleOfOuter:Zt}=k,$t={x:.5,y:.5},Jt={x:.5,y:1},te={},ee={};const{set:ie,getAngle:se,getDistance:ne}=T,{get:oe,rotateOfOuter:ae,scaleOfOuter:re}=k,he={x:.5,y:.5},de={x:.5,y:1},le={},ce={};let ue;function fe(t,e,i){if("object"!=typeof e||!1===e.visible||0===e.opacity)return;const{boxBounds:s}=i.__layout;switch(e.type){case"solid":let{type:n,blendMode:o,color:a,opacity:r}=e;return{type:n,blendMode:o,style:C.string(a,r)};case"image":return function(t,e,i,s,n){const o={type:i.type},a=o.image=g.get(i),r=(n||a.loading)&&{target:t,image:a,attrName:e,attrValue:i};return a.ready?(Bt(t,e,a)&&bt(o,a,i,s),n&&(Rt(L.LOAD,r),Rt(L.LOADED,r))):a.error?n&&(t.forceUpdate("surface"),r.error=a.error,Rt(L.ERROR,r)):(n&&Rt(L.LOAD,r),o.loadId=a.load((()=>{t.destroyed||(Bt(t,e,a)&&(bt(o,a,i,s),t.forceUpdate("surface")),Rt(L.LOADED,r))}),(e=>{t.forceUpdate("surface"),r.error=e,Rt(L.ERROR,r)}))),o}(i,t,e,s,!ue||!ue[e.url]);case"linear":return function(t,e){let{from:i,to:s,type:n,blendMode:o,opacity:a}=t;i||(i=Ut),s||(s=Ht);const r=p.canvas.createLinearGradient(e.x+i.x*e.width,e.y+i.y*e.height,e.x+s.x*e.width,e.y+s.y*e.height);jt(r,t.stops,a);const h={type:n,style:r};return o&&(h.blendMode=o),h}(e,s);case"radial":return function(t,e){let{from:i,to:s,type:n,opacity:o,blendMode:a,stretch:r}=t;i||(i=$t),s||(s=Jt);const{x:h,y:d,width:l,height:c}=e;let u;Xt(te,h+i.x*l,d+i.y*c),Xt(ee,h+s.x*l,d+s.y*c),(l!==c||r)&&(u=Qt(),Zt(u,te,l/c*(r||1),1),Kt(u,te,qt(te,ee)+90));const f=p.canvas.createRadialGradient(te.x,te.y,0,te.x,te.y,Gt(te,ee));jt(f,t.stops,o);const g={type:n,style:f,transform:u};return a&&(g.blendMode=a),g}(e,s);case"angular":return function(t,e){let{from:i,to:s,type:n,opacity:o,blendMode:a,stretch:r}=t;i||(i=he),s||(s=de);const{x:h,y:d,width:l,height:c}=e;ie(le,h+i.x*l,d+i.y*c),ie(ce,h+s.x*l,d+s.y*c);const u=oe(),f=se(le,ce);p.conicGradientRotate90?(re(u,le,l/c*(r||1),1),ae(u,le,f+90)):(re(u,le,1,l/c*(r||1)),ae(u,le,f));const g=p.conicGradientSupport?p.canvas.createConicGradient(0,le.x,le.y):p.canvas.createRadialGradient(le.x,le.y,0,le.x,le.y,ne(le,ce));jt(g,t.stops,o);const _={type:n,style:g,transform:u};return a&&(_.blendMode=a),_}(e,s);default:return e.r?{type:"solid",style:C.string(e)}:void 0}}var ge=Object.freeze({__proto__:null,compute:function(t,e){const i=[],s=e.__;let n,o,a=s.__input[t];a instanceof Array||(a=[a]),ue=Ot(t,s);for(let s=0,o=a.length;s<o;s++)n=fe(t,a[s],e),n&&i.push(n);if(s["_"+t]=i.length?i:void 0,1===a.length){const t=a[0];"image"===t.type&&(o=O.isPixel(t))}"fill"===t?s.__pixelFill=o:s.__pixelStroke=o},drawTextStroke:Dt,fill:function(t,e,i){i.fillStyle=t,e.__.__font?It(e,i):e.__.windingRule?i.fill(e.__.windingRule):i.fill()},fillText:It,fills:function(t,e,i){let s;const{windingRule:n,__font:o}=e.__;for(let a=0,r=t.length;a<r;a++)s=t[a],s.image&&Ct(e,i,s,!o)||s.style&&(i.fillStyle=s.style,s.transform?(i.save(),i.transform(s.transform),s.blendMode&&(i.blendMode=s.blendMode),o?It(e,i):n?i.fill(n):i.fill(),i.restore()):s.blendMode?(i.saveBlendMode(s.blendMode),o?It(e,i):n?i.fill(n):i.fill(),i.restoreBlendMode()):o?It(e,i):n?i.fill(n):i.fill())},recycleImage:Ot,shape:function(t,e,i){const s=e.getSameCanvas();let n,o,a,r;const{__world:h}=t;let{scaleX:d,scaleY:l}=h;if(d<0&&(d=-d),l<0&&(l=-l),e.bounds.includes(h,i.matrix))i.matrix?(d*=i.matrix.a,l*=i.matrix.d,n=a=Nt(h,i.matrix)):n=a=h,r=s;else{const{renderShapeSpread:s}=t.__layout,c=Vt(s?Ft(e.bounds,s*d,s*l):e.bounds,h,i.matrix);o=e.bounds.getFitMatrix(c),o.a<1&&(r=e.getSameCanvas(),t.__renderShape(r,i),d*=o.a,l*=o.d),a=Nt(h,o),n=Yt(a,-o.e,-o.f),i.matrix&&o.multiply(i.matrix),i=Object.assign(Object.assign({},i),{matrix:o})}return t.__renderShape(s,i),{canvas:s,matrix:o,bounds:n,worldCanvas:r,shapeBounds:a,scaleX:d,scaleY:l}},stroke:function(t,e,i,s){const n=e.__,{strokeWidth:o,strokeAlign:a,__font:r}=n;if(o)if(r)Pt(t,e,i,s);else switch(a){case"center":i.setStroke(t,o,n),i.stroke();break;case"inside":i.save(),i.setStroke(t,2*o,n),n.windingRule?i.clip(n.windingRule):i.clip(),i.stroke(),i.restore();break;case"outside":const a=i.getSameCanvas(!0);a.setStroke(t,2*o,e.__),e.__drawRenderPath(a),a.stroke(),n.windingRule?a.clip(n.windingRule):a.clip(),a.clearWorld(e.__layout.renderBounds),e.__worldFlipped||s.matrix?i.copyWorldByReset(a):i.copyWorldToInner(a,e.__world,e.__layout.renderBounds),a.recycle()}},strokeText:Pt,strokes:function(t,e,i,s){const n=e.__,{strokeWidth:o,strokeAlign:a,__font:r}=n;if(o)if(r)Pt(t,e,i,s);else switch(a){case"center":i.setStroke(void 0,o,n),zt(t,!1,e,i);break;case"inside":i.save(),i.setStroke(void 0,2*o,n),n.windingRule?i.clip(n.windingRule):i.clip(),zt(t,!1,e,i),i.restore();break;case"outside":const{renderBounds:a}=e.__layout,r=i.getSameCanvas(!0);e.__drawRenderPath(r),r.setStroke(void 0,2*o,e.__),zt(t,!1,e,r),n.windingRule?r.clip(n.windingRule):r.clip(),r.clearWorld(a),e.__worldFlipped||s.matrix?i.copyWorldByReset(r):i.copyWorldToInner(r,e.__world,a),r.recycle()}}});const{copy:pe,toOffsetOutBounds:_e}=y,we={},ye={};function me(t,e,i,s){const{bounds:n,shapeBounds:o}=s;if(p.fullImageShadow){if(pe(we,t.bounds),we.x+=e.x-o.x,we.y+=e.y-o.y,i){const{matrix:t}=s;we.x-=(n.x+(t?t.e:0)+n.width/2)*(i-1),we.y-=(n.y+(t?t.f:0)+n.height/2)*(i-1),we.width*=i,we.height*=i}t.copyWorld(s.canvas,t.bounds,we)}else i&&(pe(we,e),we.x-=e.width/2*(i-1),we.y-=e.height/2*(i-1),we.width*=i,we.height*=i),t.copyWorld(s.canvas,o,i?we:e)}const{toOffsetOutBounds:ve}=y,xe={};var be=Object.freeze({__proto__:null,blur:function(t,e,i){const{blur:s}=t.__;i.setWorldBlur(s*t.__world.a),i.copyWorldToInner(e,t.__world,t.__layout.renderBounds),i.filter="none"},innerShadow:function(t,e,i,s){let n,o;const{__world:a,__layout:r}=t,{innerShadow:h}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:u,scaleY:f}=i,g=e.getSameCanvas(),p=h.length-1;ve(l,xe),h.forEach(((h,_)=>{g.save(),g.setWorldShadow(xe.offsetX+h.x*u,xe.offsetY+h.y*f,h.blur*u),o=h.spread?1-2*h.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,me(g,xe,o,i),g.restore(),d?(g.copyWorld(g,l,a,"copy"),g.copyWorld(d,a,a,"source-out"),n=a):(g.copyWorld(i.canvas,c,l,"source-out"),n=l),g.fillWorld(n,h.color,"source-in"),t.__worldFlipped||s.matrix?e.copyWorldByReset(g,n,a,h.blendMode):e.copyWorldToInner(g,n,r.renderBounds,h.blendMode),p&&_<p&&g.clear()})),g.recycle()},shadow:function(t,e,i,s){let n,o;const{__world:a,__layout:r}=t,{shadow:h}=t.__,{worldCanvas:d,bounds:l,shapeBounds:c,scaleX:u,scaleY:f}=i,g=e.getSameCanvas(),p=h.length-1;_e(l,ye),h.forEach(((h,_)=>{g.setWorldShadow(ye.offsetX+h.x*u,ye.offsetY+h.y*f,h.blur*u,h.color),o=h.spread?1+2*h.spread/(r.boxBounds.width+2*(r.strokeBoxSpread||0)):0,me(g,ye,o,i),n=l,h.box&&(g.restore(),g.save(),d&&(g.copyWorld(g,l,a,"copy"),n=a),d?g.copyWorld(d,a,a,"destination-out"):g.copyWorld(i.canvas,c,l,"destination-out")),t.__worldFlipped||s.matrix?e.copyWorldByReset(g,n,a,h.blendMode):e.copyWorldToInner(g,n,r.renderBounds,h.blendMode),p&&_<p&&g.clear()})),g.recycle()}});const Be=">)]}%!?,.:;'\"》)」〉』〗】〕}┐>’”!?,、。:;‰",Re=Be+"_#~&*+\\=|≮≯≈≠=…",Ee=new RegExp([[19968,40959],[13312,19903],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[196608,201551],[201552,205743],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12736,12783],[12800,13055],[13056,13311],[63744,64255],[65072,65103],[127488,127743],[194560,195103]].map((([t,e])=>`[\\u${t.toString(16)}-\\u${e.toString(16)}]`)).join("|"));function Se(t){const e={};return t.split("").forEach((t=>e[t]=!0)),e}const ke=Se("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"),Le=Se("{[(<'\"《(「〈『〖【〔{┌<‘“=¥¥$€££¢¢"),Te=Se(Be),Ae=Se(Re),Me=Se("- —/~|┆·");var Ce;!function(t){t[t.Letter=0]="Letter",t[t.Single=1]="Single",t[t.Before=2]="Before",t[t.After=3]="After",t[t.Symbol=4]="Symbol",t[t.Break=5]="Break"}(Ce||(Ce={}));const{Letter:Oe,Single:Ie,Before:Pe,After:We,Symbol:De,Break:ze}=Ce;function Fe(t){return ke[t]?Oe:Me[t]?ze:Le[t]?Pe:Te[t]?We:Ae[t]?De:Ee.test(t)?Ie:Oe}const Ne={trimRight(t){const{words:e}=t;let i,s=0,n=e.length;for(let o=n-1;o>-1&&(i=e[o].data[0]," "===i.char);o--)s++,t.width-=i.width;s&&e.splice(n-s,s)}};function Ye(t,e,i){switch(e){case"title":return i?t.toUpperCase():t;case"upper":return t.toUpperCase();case"lower":return t.toLowerCase();default:return t}}const{trimRight:Ve}=Ne,{Letter:Ue,Single:He,Before:je,After:Xe,Symbol:qe,Break:Ge}=Ce;let Qe,Ke,Ze,$e,Je,ti,ei,ii,si,ni,oi,ai,ri,hi,di,li,ci=[];function ui(t,e){si&&!ii&&(ii=si),Qe.data.push({char:t,width:e}),Ze+=e}function fi(){$e+=Ze,Qe.width=Ze,Ke.words.push(Qe),Qe={data:[]},Ze=0}function gi(){hi&&(di.paraNumber++,Ke.paraStart=!0,hi=!1),si&&(Ke.startCharSize=ii,Ke.endCharSize=si,ii=0),Ke.width=$e,li.width&&Ve(Ke),ci.push(Ke),Ke={words:[]},$e=0}const{top:pi,right:_i,bottom:wi,left:yi}=A,mi={getDrawData(t,e){"string"!=typeof t&&(t=String(t));let i=0,s=0,n=e.__getInput("width")||0,o=e.__getInput("height")||0;const{textDecoration:a,__font:r,__padding:h}=e;h&&(n&&(i=h[yi],n-=h[_i]+h[yi]),o&&(s=h[pi],o-=h[pi]+h[wi]));const d={bounds:{x:i,y:s,width:n,height:o},rows:[],paraNumber:0,font:p.canvas.font=r};return function(t,e,i){di=t,ci=t.rows,li=t.bounds;const{__letterSpacing:s,paraIndent:n,textCase:o}=i,{canvas:a}=p,{width:r,height:h}=li;if(r||h||s||"none"!==o){const t="none"!==i.textWrap,h="break"===i.textWrap;hi=!0,oi=null,ii=ei=si=Ze=$e=0,Qe={data:[]},Ke={words:[]};for(let i=0,d=e.length;i<d;i++)ti=e[i],"\n"===ti?(Ze&&fi(),Ke.paraEnd=!0,gi(),hi=!0):(ni=Fe(ti),ni===Ue&&"none"!==o&&(ti=Ye(ti,o,!Ze)),ei=a.measureText(ti).width,s&&(s<0&&(si=ei),ei+=s),ai=ni===He&&(oi===He||oi===Ue)||oi===He&&ni!==Xe,ri=!(ni!==je&&ni!==He||oi!==qe&&oi!==Xe),Je=hi&&n?r-n:r,t&&r&&$e+Ze+ei>Je&&(h?(Ze&&fi(),gi()):(ri||(ri=ni===Ue&&oi==Xe),ai||ri||ni===Ge||ni===je||ni===He||Ze+ei>Je?(Ze&&fi(),gi()):gi()))," "===ti&&!0!==hi&&$e+Ze===0||(ni===Ge?(" "===ti&&Ze&&fi(),ui(ti,ei),fi()):ai||ri?(Ze&&fi(),ui(ti,ei)):ui(ti,ei)),oi=ni);Ze&&fi(),$e&&gi(),ci.length>0&&(ci[ci.length-1].paraEnd=!0)}else e.split("\n").forEach((t=>{di.paraNumber++,ci.push({x:n||0,text:t,width:a.measureText(t).width,paraStart:!0})}))}(d,t,e),h&&function(t,e,i,s,n){if(!s)switch(i.textAlign){case"left":vi(e,"x",t[yi]);break;case"right":vi(e,"x",-t[_i])}if(!n)switch(i.verticalAlign){case"top":vi(e,"y",t[pi]);break;case"bottom":vi(e,"y",-t[wi])}}(h,d,e,n,o),function(t,e){const{rows:i,bounds:s}=t,{__lineHeight:n,__baseLine:o,__letterSpacing:a,__clipText:r,textAlign:h,verticalAlign:d,paraSpacing:l}=e;let c,u,f,{x:g,y:p,width:_,height:w}=s,y=n*i.length+(l?l*(t.paraNumber-1):0),m=o;if(r&&y>w)y=Math.max(w,n),t.overflow=i.length;else switch(d){case"middle":p+=(w-y)/2;break;case"bottom":p+=w-y}m+=p;for(let o=0,d=i.length;o<d;o++){switch(c=i[o],c.x=g,h){case"center":c.x+=(_-c.width)/2;break;case"right":c.x+=_-c.width}c.paraStart&&l&&o>0&&(m+=l),c.y=m,m+=n,t.overflow>o&&m>y&&(c.isOverflow=!0,t.overflow=o+1),u=c.x,f=c.width,a<0&&(c.width<0?(f=-c.width+e.fontSize+a,u-=f,f+=e.fontSize):f-=a),u<s.x&&(s.x=u),f>s.width&&(s.width=f),r&&_&&_<f&&(c.isOverflow=!0,t.overflow||(t.overflow=i.length))}s.y=p,s.height=y}(d,e),function(t,e,i,s){const{rows:n}=t,{textAlign:o,paraIndent:a,letterSpacing:r}=e;let h,d,l,c,u;n.forEach((t=>{t.words&&(l=a&&t.paraStart?a:0,d=i&&"justify"===o&&t.words.length>1?(i-t.width-l)/(t.words.length-1):0,c=r||t.isOverflow?0:d>.01?1:2,t.isOverflow&&!r&&(t.textMode=!0),2===c?(t.x+=l,function(t){t.text="",t.words.forEach((e=>{e.data.forEach((e=>{t.text+=e.char}))}))}(t)):(t.x+=l,h=t.x,t.data=[],t.words.forEach((e=>{1===c?(u={char:"",x:h},h=function(t,e,i){return t.forEach((t=>{i.char+=t.char,e+=t.width})),e}(e.data,h,u)," "!==u.char&&t.data.push(u)):h=function(t,e,i){return t.forEach((t=>{" "!==t.char&&(t.x=e,i.push(t)),e+=t.width})),e}(e.data,h,t.data),!t.paraEnd&&d&&(h+=d,t.width+=d)}))),t.words=null)}))}(d,e,n),d.overflow&&function(t,e){const{rows:i,overflow:s}=t;let{textOverflow:n}=e;if(i.splice(s),"hide"!==n){let t,o;"ellipsis"===n&&(n="...");const a=p.canvas.measureText(n).width,r=e.x+e.width-a;("none"===e.textWrap?i:[i[s-1]]).forEach((e=>{if(e.isOverflow&&e.data){let i=e.data.length-1;for(let s=i;s>-1&&(t=e.data[s],o=t.x+t.width,!(s===i&&o<r));s--){if(o<r&&" "!==t.char){e.data.splice(s+1),e.width-=t.width;break}e.width-=t.width}e.width+=a,e.data.push({char:n,x:o}),e.textMode&&function(t){t.text="",t.data.forEach((e=>{t.text+=e.char})),t.data=null}(e)}}))}}(d,e),"none"!==a&&function(t,e){const{fontSize:i}=e;switch(t.decorationHeight=i/11,e.textDecoration){case"under":t.decorationY=.15*i;break;case"delete":t.decorationY=.35*-i}}(d,e),d}};function vi(t,e,i){const{bounds:s,rows:n}=t;s[e]+=i;for(let t=0;t<n.length;t++)n[t][e]+=i}const xi={string(t,e){if("string"==typeof t)return t;let i=void 0===t.a?1:t.a;e&&(i*=e);const s=t.r+","+t.g+","+t.b;return 1===i?"rgb("+s+")":"rgba("+s+","+i+")"}},bi={export(t,e,i){return bi.running=!0,function(t){Bi||(Bi=new M);return new Promise((e=>{Bi.add((()=>Et(this,void 0,void 0,(function*(){return yield t(e)}))),{parallel:!1})}))}((s=>new Promise((n=>{const{leafer:o}=t;o?o.waitViewCompleted((()=>Et(this,void 0,void 0,(function*(){let t,a,r,{canvas:h}=o,{unreal:d}=h;switch(d&&(h=h.getSameCanvas(),h.backgroundColor=o.config.fill,o.__render(h,{})),typeof i){case"object":i.quality&&(t=i.quality),i.blob&&(a=!0);break;case"number":t=i;break;case"boolean":a=i}r=e.includes(".")?yield h.saveAs(e,t):a?yield h.toBlob(e,t):yield h.toDataURL(e,t),s({data:r}),n(),bi.running=!1,d&&h.recycle()})))):(s({data:!1}),n(),bi.running=!1)}))))}};let Bi;Object.assign(I,ge),Object.assign(P,be),Object.assign(W,mi),Object.assign(C,xi),Object.assign(D,bi);try{ut(0,wx)}catch(t){}rt.prototype.__createContext=function(){if(this.viewSelect){const t=z.origin.createCanvas(1,1),e=this.view.getContext("2d");this.testView=this.view,this.testContext=e,this.view=t}this.context=this.view.getContext("2d"),this.__bindContext()},rt.prototype.updateRender=function(){if(this.testView){let t=this.context.createPattern(this.view,z.origin.noRepeat);this.testContext.clearRect(0,0,this.view.width,this.view.height),this.testContext.fillStyle=t,this.testContext.fillRect(0,0,this.view.width,this.view.height),this.testContext.fillStyle=t=null}},rt.prototype.updateViewSize=function(){const{width:t,height:e,pixelRatio:i,view:s,testView:n}=this;s.width=t*i,s.height=e*i,n&&(n.width=s.width,n.height=s.height)};export{dt as Interaction,Z as Layouter,rt as LeaferCanvas,J as Renderer,at as Selector,F as Watcher,ut as useCanvas};
|
package/dist/miniapp.module.js
CHANGED
|
@@ -5935,7 +5935,7 @@ const LeafRender = {
|
|
|
5935
5935
|
canvas.setWorld(this.__world, options.matrix);
|
|
5936
5936
|
canvas.opacity = this.__worldOpacity;
|
|
5937
5937
|
if (this.__.__single) {
|
|
5938
|
-
const tempCanvas = canvas.getSameCanvas(true);
|
|
5938
|
+
const tempCanvas = canvas.getSameCanvas(true, true);
|
|
5939
5939
|
this.__draw(tempCanvas, options);
|
|
5940
5940
|
const blendMode = this.__.isEraser ? 'destination-out' : this.__.blendMode;
|
|
5941
5941
|
if (this.__worldFlipped || options.matrix) {
|
|
@@ -6012,7 +6012,7 @@ const BranchRender = {
|
|
|
6012
6012
|
if (this.__worldOpacity) {
|
|
6013
6013
|
if (this.__.__single) {
|
|
6014
6014
|
canvas.resetTransform();
|
|
6015
|
-
const tempCanvas = canvas.getSameCanvas();
|
|
6015
|
+
const tempCanvas = canvas.getSameCanvas(false, true);
|
|
6016
6016
|
this.__renderBranch(tempCanvas, options);
|
|
6017
6017
|
canvas.opacity = this.__worldOpacity;
|
|
6018
6018
|
const blendMode = this.__.isEraser ? 'destination-out' : this.__.blendMode;
|
|
@@ -7840,6 +7840,9 @@ class FrameData extends BoxData {
|
|
|
7840
7840
|
class LineData extends UIData {
|
|
7841
7841
|
}
|
|
7842
7842
|
|
|
7843
|
+
class ArrowData extends LineData {
|
|
7844
|
+
}
|
|
7845
|
+
|
|
7843
7846
|
class RectData extends UIData {
|
|
7844
7847
|
get __boxStroke() { return true; }
|
|
7845
7848
|
}
|
|
@@ -7898,6 +7901,25 @@ class TextData extends UIData {
|
|
|
7898
7901
|
}
|
|
7899
7902
|
|
|
7900
7903
|
class ImageData extends RectData {
|
|
7904
|
+
setUrl(value) {
|
|
7905
|
+
this.__setImageFill(value);
|
|
7906
|
+
this._url = value;
|
|
7907
|
+
}
|
|
7908
|
+
__setImageFill(value) {
|
|
7909
|
+
if (this.__leaf.image)
|
|
7910
|
+
this.__leaf.image = null;
|
|
7911
|
+
this.fill = value ? { type: 'image', mode: 'strench', url: value } : undefined;
|
|
7912
|
+
}
|
|
7913
|
+
__getData() {
|
|
7914
|
+
const data = super.__getData();
|
|
7915
|
+
delete data.fill;
|
|
7916
|
+
return data;
|
|
7917
|
+
}
|
|
7918
|
+
__getInputData() {
|
|
7919
|
+
const data = super.__getInputData();
|
|
7920
|
+
delete data.fill;
|
|
7921
|
+
return data;
|
|
7922
|
+
}
|
|
7901
7923
|
}
|
|
7902
7924
|
|
|
7903
7925
|
class CanvasData extends RectData {
|
|
@@ -8144,14 +8166,15 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
8144
8166
|
findOne(condition, options) {
|
|
8145
8167
|
return this.leafer ? this.leafer.selector.getBy(condition, this, true, options) : null;
|
|
8146
8168
|
}
|
|
8147
|
-
getPath(curve) {
|
|
8148
|
-
|
|
8169
|
+
getPath(curve, pathForRender) {
|
|
8170
|
+
this.__layout.update();
|
|
8171
|
+
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
8149
8172
|
if (!path)
|
|
8150
|
-
|
|
8173
|
+
this.__drawPathByBox(new PathCreator(path = []));
|
|
8151
8174
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
8152
8175
|
}
|
|
8153
|
-
getPathString(curve) {
|
|
8154
|
-
return PathConvert.stringify(this.getPath(curve));
|
|
8176
|
+
getPathString(curve, pathForRender) {
|
|
8177
|
+
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
8155
8178
|
}
|
|
8156
8179
|
__onUpdateSize() {
|
|
8157
8180
|
if (this.__.__input) {
|
|
@@ -8323,6 +8346,12 @@ __decorate([
|
|
|
8323
8346
|
__decorate([
|
|
8324
8347
|
strokeType(10)
|
|
8325
8348
|
], UI.prototype, "miterLimit", void 0);
|
|
8349
|
+
__decorate([
|
|
8350
|
+
strokeType('none')
|
|
8351
|
+
], UI.prototype, "startArrow", void 0);
|
|
8352
|
+
__decorate([
|
|
8353
|
+
strokeType('none')
|
|
8354
|
+
], UI.prototype, "endArrow", void 0);
|
|
8326
8355
|
__decorate([
|
|
8327
8356
|
pathType(0)
|
|
8328
8357
|
], UI.prototype, "cornerRadius", void 0);
|
|
@@ -8819,26 +8848,10 @@ let Image = class Image extends Rect {
|
|
|
8819
8848
|
get ready() { return this.image ? this.image.ready : false; }
|
|
8820
8849
|
constructor(data) {
|
|
8821
8850
|
super(data);
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
const fill = this.fill;
|
|
8827
|
-
if (fill) {
|
|
8828
|
-
if (fill.url !== url)
|
|
8829
|
-
update = true;
|
|
8830
|
-
}
|
|
8831
|
-
else {
|
|
8832
|
-
if (url)
|
|
8833
|
-
update = true;
|
|
8834
|
-
}
|
|
8835
|
-
if (update) {
|
|
8836
|
-
if (this.image)
|
|
8837
|
-
this.image = null;
|
|
8838
|
-
this.fill = url ? { type: 'image', mode: 'strench', url } : undefined;
|
|
8839
|
-
this.once(ImageEvent.LOADED, (e) => this.image = e.image);
|
|
8840
|
-
}
|
|
8841
|
-
super.__updateBoxBounds();
|
|
8851
|
+
this.on(ImageEvent.LOADED, (e) => {
|
|
8852
|
+
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8853
|
+
this.image = e.image;
|
|
8854
|
+
});
|
|
8842
8855
|
}
|
|
8843
8856
|
destroy() {
|
|
8844
8857
|
this.image = null;
|
|
@@ -9598,6 +9611,7 @@ App = __decorate([
|
|
|
9598
9611
|
registerUI()
|
|
9599
9612
|
], App);
|
|
9600
9613
|
|
|
9614
|
+
let origin = {};
|
|
9601
9615
|
const { get: get$4, rotateOfOuter: rotateOfOuter$2, translate: translate$1, scaleOfOuter: scaleOfOuter$2, scale: scaleHelper, rotate } = MatrixHelper;
|
|
9602
9616
|
function fillOrFitMode(data, mode, box, width, height, rotation) {
|
|
9603
9617
|
const transform = get$4();
|
|
@@ -9614,13 +9628,13 @@ function fillOrFitMode(data, mode, box, width, height, rotation) {
|
|
|
9614
9628
|
data.scaleX = data.scaleY = scale;
|
|
9615
9629
|
data.transform = transform;
|
|
9616
9630
|
}
|
|
9617
|
-
function clipMode(data, box,
|
|
9631
|
+
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
9618
9632
|
const transform = get$4();
|
|
9619
9633
|
translate$1(transform, box.x, box.y);
|
|
9620
|
-
if (
|
|
9621
|
-
translate$1(transform,
|
|
9622
|
-
if (
|
|
9623
|
-
|
|
9634
|
+
if (x || y)
|
|
9635
|
+
translate$1(transform, x, y);
|
|
9636
|
+
if (scaleX) {
|
|
9637
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
9624
9638
|
data.scaleX = transform.a;
|
|
9625
9639
|
data.scaleY = transform.d;
|
|
9626
9640
|
}
|
|
@@ -9628,7 +9642,7 @@ function clipMode(data, box, offset, scale, rotation) {
|
|
|
9628
9642
|
rotate(transform, rotation);
|
|
9629
9643
|
data.transform = transform;
|
|
9630
9644
|
}
|
|
9631
|
-
function repeatMode(data, box, width, height,
|
|
9645
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation) {
|
|
9632
9646
|
const transform = get$4();
|
|
9633
9647
|
if (rotation) {
|
|
9634
9648
|
rotate(transform, rotation);
|
|
@@ -9644,10 +9658,15 @@ function repeatMode(data, box, width, height, scale, rotation) {
|
|
|
9644
9658
|
break;
|
|
9645
9659
|
}
|
|
9646
9660
|
}
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9661
|
+
origin.x = box.x;
|
|
9662
|
+
origin.y = box.y;
|
|
9663
|
+
if (x || y)
|
|
9664
|
+
origin.x += x, origin.y += y;
|
|
9665
|
+
translate$1(transform, origin.x, origin.y);
|
|
9666
|
+
if (scaleX) {
|
|
9667
|
+
scaleOfOuter$2(transform, origin, scaleX, scaleY);
|
|
9668
|
+
data.scaleX = scaleX;
|
|
9669
|
+
data.scaleY = scaleY;
|
|
9651
9670
|
}
|
|
9652
9671
|
data.transform = transform;
|
|
9653
9672
|
}
|
|
@@ -9655,11 +9674,22 @@ function repeatMode(data, box, width, height, scale, rotation) {
|
|
|
9655
9674
|
const { get: get$3, translate } = MatrixHelper;
|
|
9656
9675
|
function createData(leafPaint, image, paint, box) {
|
|
9657
9676
|
let { width, height } = image;
|
|
9658
|
-
const { opacity, mode, offset, scale, rotation, blendMode, repeat } = paint;
|
|
9677
|
+
const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
9659
9678
|
const sameBox = box.width === width && box.height === height;
|
|
9660
9679
|
if (blendMode)
|
|
9661
9680
|
leafPaint.blendMode = blendMode;
|
|
9662
9681
|
const data = leafPaint.data = { mode };
|
|
9682
|
+
let x, y, scaleX, scaleY;
|
|
9683
|
+
if (offset)
|
|
9684
|
+
x = offset.x, y = offset.y;
|
|
9685
|
+
if (size) {
|
|
9686
|
+
scaleX = (typeof size === 'number' ? size : size.width) / width;
|
|
9687
|
+
scaleY = (typeof size === 'number' ? size : size.height) / height;
|
|
9688
|
+
}
|
|
9689
|
+
else if (scale) {
|
|
9690
|
+
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
9691
|
+
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
9692
|
+
}
|
|
9663
9693
|
switch (mode) {
|
|
9664
9694
|
case 'strench':
|
|
9665
9695
|
if (!sameBox)
|
|
@@ -9670,12 +9700,12 @@ function createData(leafPaint, image, paint, box) {
|
|
|
9670
9700
|
}
|
|
9671
9701
|
break;
|
|
9672
9702
|
case 'clip':
|
|
9673
|
-
if (offset ||
|
|
9674
|
-
clipMode(data, box,
|
|
9703
|
+
if (offset || scaleX || rotation)
|
|
9704
|
+
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
9675
9705
|
break;
|
|
9676
9706
|
case 'repeat':
|
|
9677
|
-
if (!sameBox ||
|
|
9678
|
-
repeatMode(data, box, width, height,
|
|
9707
|
+
if (!sameBox || scaleX || rotation)
|
|
9708
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation);
|
|
9679
9709
|
if (!repeat)
|
|
9680
9710
|
data.repeat = 'repeat';
|
|
9681
9711
|
break;
|
|
@@ -11010,4 +11040,4 @@ LeaferCanvas.prototype.updateViewSize = function () {
|
|
|
11010
11040
|
}
|
|
11011
11041
|
};
|
|
11012
11042
|
|
|
11013
|
-
export { Animate, AnimateEvent, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert$1 as ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export$1 as Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafHit, LeafLayout, LeafLevelList, LeafList, LeafMask, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, Path, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Platform, PluginManager, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert$1 as TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIHit, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, effectType, eraserType, getDescriptor, hitType, layoutProcessor, maskType, opacityType, pathType, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, useCanvas, useModule, usePlugin };
|
|
11043
|
+
export { Animate, AnimateEvent, App, AroundHelper, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert$1 as ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export$1 as Export, FileHelper, Frame, FrameData, Group, GroupData, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafHit, LeafLayout, LeafLevelList, LeafList, LeafMask, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, Path, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Platform, PluginManager, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, RotateEvent, Run, Selector, Star, StarData, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert$1 as TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIHit, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, defineDataProcessor, defineKey, defineLeafAttr, effectType, eraserType, getDescriptor, hitType, layoutProcessor, maskType, opacityType, pathType, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, strokeType, surfaceType, useCanvas, useModule, usePlugin };
|