@leafer-ui/core 1.2.2 → 1.3.0
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/lib/core.cjs +11 -19
- package/lib/core.esm.js +12 -20
- package/lib/core.esm.min.js +1 -1
- package/lib/core.min.cjs +1 -1
- package/package.json +6 -6
package/lib/core.cjs
CHANGED
|
@@ -133,8 +133,8 @@ exports.App = class App extends draw.Leafer {
|
|
|
133
133
|
this.children.forEach(leafer => leafer.resize(event));
|
|
134
134
|
super.__onResize(event);
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
this.children.forEach(leafer => leafer.
|
|
136
|
+
updateLayout() {
|
|
137
|
+
this.children.forEach(leafer => leafer.updateLayout());
|
|
138
138
|
}
|
|
139
139
|
__getChildConfig(userConfig) {
|
|
140
140
|
let config = Object.assign({}, this.config);
|
|
@@ -1211,8 +1211,8 @@ leaf.__drawHitPath = function (canvas) { if (canvas)
|
|
|
1211
1211
|
this.__drawRenderPath(canvas); };
|
|
1212
1212
|
|
|
1213
1213
|
const matrix = new core.Matrix();
|
|
1214
|
-
const ui$
|
|
1215
|
-
ui$
|
|
1214
|
+
const ui$1 = draw.UI.prototype;
|
|
1215
|
+
ui$1.__updateHitCanvas = function () {
|
|
1216
1216
|
const data = this.__, { hitCanvasManager } = this.leafer;
|
|
1217
1217
|
const isHitPixelFill = (data.__pixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
1218
1218
|
const isHitPixelStroke = data.__pixelStroke && data.hitStroke === 'pixel';
|
|
@@ -1239,7 +1239,7 @@ ui$2.__updateHitCanvas = function () {
|
|
|
1239
1239
|
this.__drawHitPath(h);
|
|
1240
1240
|
h.setStrokeOptions(data);
|
|
1241
1241
|
};
|
|
1242
|
-
ui$
|
|
1242
|
+
ui$1.__hit = function (inner) {
|
|
1243
1243
|
if (core.Platform.name === 'miniapp')
|
|
1244
1244
|
this.__drawHitPath(this.__hitCanvas);
|
|
1245
1245
|
const data = this.__;
|
|
@@ -1279,31 +1279,23 @@ ui$2.__hit = function (inner) {
|
|
|
1279
1279
|
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
1280
1280
|
};
|
|
1281
1281
|
|
|
1282
|
-
const ui
|
|
1282
|
+
const ui = draw.UI.prototype, rect = draw.Rect.prototype, box = draw.Box.prototype;
|
|
1283
1283
|
rect.__updateHitCanvas = box.__updateHitCanvas = function () {
|
|
1284
1284
|
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
1285
|
-
ui
|
|
1285
|
+
ui.__updateHitCanvas.call(this);
|
|
1286
1286
|
else if (this.__hitCanvas)
|
|
1287
1287
|
this.__hitCanvas = null;
|
|
1288
1288
|
};
|
|
1289
1289
|
rect.__hitFill = box.__hitFill = function (inner) {
|
|
1290
|
-
return this.__hitCanvas ? ui
|
|
1290
|
+
return this.__hitCanvas ? ui.__hitFill.call(this, inner) : core.BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
1291
1291
|
};
|
|
1292
1292
|
|
|
1293
|
-
const ui = draw.UI.prototype, group = draw.Group.prototype;
|
|
1294
1293
|
function getSelector(ui) {
|
|
1295
1294
|
return ui.leafer ? ui.leafer.selector : (draw.Platform.selector || (draw.Platform.selector = draw.Creator.selector()));
|
|
1296
1295
|
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
ui.findOne = function (condition, options) {
|
|
1301
|
-
return getSelector(this).getBy(condition, this, true, options);
|
|
1302
|
-
};
|
|
1303
|
-
group.pick = function (hitPoint, options) {
|
|
1304
|
-
this.__layout.update();
|
|
1305
|
-
if (!options)
|
|
1306
|
-
options = {};
|
|
1296
|
+
draw.Group.prototype.pick = function (hitPoint, options) {
|
|
1297
|
+
this.leafer || this.updateLayout();
|
|
1298
|
+
options || (options = draw.emptyData);
|
|
1307
1299
|
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
1308
1300
|
};
|
|
1309
1301
|
|
package/lib/core.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Leafer, State, UI, ImageManager, Rect, Box, Group, Platform as Platform$1, Creator as Creator$1 } from '@leafer-ui/draw';
|
|
1
|
+
import { Leafer, State, UI, ImageManager, Rect, Box, Group, Platform as Platform$1, Creator as Creator$1, emptyData } from '@leafer-ui/draw';
|
|
2
2
|
export * from '@leafer-ui/draw';
|
|
3
3
|
import { registerUI, Creator, PropertyEvent, Debug, DataHelper, canvasSizeAttrs, LayoutEvent, RenderEvent, Event, EventCreator, registerUIEvent, LeafList, PointHelper, BoundsHelper, Bounds, ResizeEvent, LeaferEvent, CanvasManager, Leaf, Matrix, Platform, tempBounds, LeaferCanvasBase } from '@leafer/core';
|
|
4
4
|
|
|
@@ -132,8 +132,8 @@ let App = class App extends Leafer {
|
|
|
132
132
|
this.children.forEach(leafer => leafer.resize(event));
|
|
133
133
|
super.__onResize(event);
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
this.children.forEach(leafer => leafer.
|
|
135
|
+
updateLayout() {
|
|
136
|
+
this.children.forEach(leafer => leafer.updateLayout());
|
|
137
137
|
}
|
|
138
138
|
__getChildConfig(userConfig) {
|
|
139
139
|
let config = Object.assign({}, this.config);
|
|
@@ -1210,8 +1210,8 @@ leaf.__drawHitPath = function (canvas) { if (canvas)
|
|
|
1210
1210
|
this.__drawRenderPath(canvas); };
|
|
1211
1211
|
|
|
1212
1212
|
const matrix = new Matrix();
|
|
1213
|
-
const ui$
|
|
1214
|
-
ui$
|
|
1213
|
+
const ui$1 = UI.prototype;
|
|
1214
|
+
ui$1.__updateHitCanvas = function () {
|
|
1215
1215
|
const data = this.__, { hitCanvasManager } = this.leafer;
|
|
1216
1216
|
const isHitPixelFill = (data.__pixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
1217
1217
|
const isHitPixelStroke = data.__pixelStroke && data.hitStroke === 'pixel';
|
|
@@ -1238,7 +1238,7 @@ ui$2.__updateHitCanvas = function () {
|
|
|
1238
1238
|
this.__drawHitPath(h);
|
|
1239
1239
|
h.setStrokeOptions(data);
|
|
1240
1240
|
};
|
|
1241
|
-
ui$
|
|
1241
|
+
ui$1.__hit = function (inner) {
|
|
1242
1242
|
if (Platform.name === 'miniapp')
|
|
1243
1243
|
this.__drawHitPath(this.__hitCanvas);
|
|
1244
1244
|
const data = this.__;
|
|
@@ -1278,31 +1278,23 @@ ui$2.__hit = function (inner) {
|
|
|
1278
1278
|
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
1279
1279
|
};
|
|
1280
1280
|
|
|
1281
|
-
const ui
|
|
1281
|
+
const ui = UI.prototype, rect = Rect.prototype, box = Box.prototype;
|
|
1282
1282
|
rect.__updateHitCanvas = box.__updateHitCanvas = function () {
|
|
1283
1283
|
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
1284
|
-
ui
|
|
1284
|
+
ui.__updateHitCanvas.call(this);
|
|
1285
1285
|
else if (this.__hitCanvas)
|
|
1286
1286
|
this.__hitCanvas = null;
|
|
1287
1287
|
};
|
|
1288
1288
|
rect.__hitFill = box.__hitFill = function (inner) {
|
|
1289
|
-
return this.__hitCanvas ? ui
|
|
1289
|
+
return this.__hitCanvas ? ui.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
1290
1290
|
};
|
|
1291
1291
|
|
|
1292
|
-
const ui = UI.prototype, group = Group.prototype;
|
|
1293
1292
|
function getSelector(ui) {
|
|
1294
1293
|
return ui.leafer ? ui.leafer.selector : (Platform$1.selector || (Platform$1.selector = Creator$1.selector()));
|
|
1295
1294
|
}
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
ui.findOne = function (condition, options) {
|
|
1300
|
-
return getSelector(this).getBy(condition, this, true, options);
|
|
1301
|
-
};
|
|
1302
|
-
group.pick = function (hitPoint, options) {
|
|
1303
|
-
this.__layout.update();
|
|
1304
|
-
if (!options)
|
|
1305
|
-
options = {};
|
|
1295
|
+
Group.prototype.pick = function (hitPoint, options) {
|
|
1296
|
+
this.leafer || this.updateLayout();
|
|
1297
|
+
options || (options = emptyData);
|
|
1306
1298
|
return getSelector(this).getByPoint(hitPoint, options.hitRadius || 0, Object.assign(Object.assign({}, options), { target: this }));
|
|
1307
1299
|
};
|
|
1308
1300
|
|
package/lib/core.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Leafer as t,State as e,UI as i,ImageManager as s,Rect as a,Box as r,Group as n,Platform as h,Creator as o}from"@leafer-ui/draw";export*from"@leafer-ui/draw";import{registerUI as d,Creator as l,PropertyEvent as g,Debug as c,DataHelper as u,canvasSizeAttrs as p,LayoutEvent as _,RenderEvent as v,Event as m,EventCreator as f,registerUIEvent as y,LeafList as E,PointHelper as D,BoundsHelper as P,Bounds as w,ResizeEvent as T,LeaferEvent as O,CanvasManager as C,Leaf as R,Matrix as x,Platform as L,tempBounds as b,LeaferCanvasBase as M}from"@leafer/core";function S(t,e,i,s){var a,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var h=t.length-1;h>=0;h--)(a=t[h])&&(n=(r<3?a(n):r>3?a(e,i,n):a(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n}"function"==typeof SuppressedError&&SuppressedError;let k=class extends t{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:a}=t;e&&(this.ground=this.addLeafer(e)),(i||a)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||a)&&(this.sky=this.addLeafer(s)),a&&this.sky.add(this.editor=l.editor(a))}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(g.CHANGE,this.__onPropertyChange,this))}start(){super.start(),this.children.forEach((t=>t.start()))}stop(){this.children.forEach((t=>t.stop())),super.stop()}unlockLayout(){super.unlockLayout(),this.children.forEach((t=>t.unlockLayout()))}lockLayout(){super.lockLayout(),this.children.forEach((t=>t.lockLayout()))}forceRender(t,e){this.children.forEach((i=>i.forceRender(t,e)))}addLeafer(e){const i=new t(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout((()=>this.add(t,e)),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),void 0!==e&&(t.canvas.childIndex=e),this.__listenChildEvents(t)}__onPropertyChange(){c.showHitView&&this.children.forEach((t=>t.forceUpdate("surface")))}__onCreated(){this.created=this.children.every((t=>t.created))}__onReady(){this.children.every((t=>t.ready))&&super.__onReady()}__onViewReady(){this.children.every((t=>t.viewReady))&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){if(t.context){const i=e.matrix;i&&t.setTransform(i.a,i.b,i.c,i.d,i.e,i.f),this.children.forEach((e=>t.copyWorld(e.canvas)))}}__onResize(t){this.children.forEach((e=>e.resize(t))),super.__onResize(t)}__checkUpdateLayout(){this.children.forEach((t=>t.__layout.update()))}__getChildConfig(t){let e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&u.assign(e,t),this.autoLayout&&u.copyAttrs(e,this,p),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once(_.END,(()=>this.__onReady())),t.once(v.START,(()=>this.__onCreated())),t.once(v.END,(()=>this.__onViewReady())),this.realCanvas&&this.__eventIds.push(t.on_(v.END,this.__onChildRenderEnd,this))}};k=S([d()],k);const H={},A={isHoldSpaceKey:()=>A.isHold("Space"),isHold:t=>H[t],setDownCode(t){H[t]||(H[t]=!0)},setUpCode(t){H[t]=!1}},B={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class I extends m{get spaceKey(){return A.isHoldSpaceKey()}get left(){return B.left(this)}get right(){return B.right(this)}get middle(){return B.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){f.changeName(t,e)}}let N=class extends I{};N.POINTER="pointer",N.BEFORE_DOWN="pointer.before_down",N.BEFORE_MOVE="pointer.before_move",N.BEFORE_UP="pointer.before_up",N.DOWN="pointer.down",N.MOVE="pointer.move",N.UP="pointer.up",N.OVER="pointer.over",N.OUT="pointer.out",N.ENTER="pointer.enter",N.LEAVE="pointer.leave",N.TAP="tap",N.DOUBLE_TAP="double_tap",N.CLICK="click",N.DOUBLE_CLICK="double_click",N.LONG_PRESS="long_press",N.LONG_TAP="long_tap",N.MENU="pointer.menu",N.MENU_TAP="pointer.menu_tap",N=S([y()],N);const F=N,K={};let W=class extends N{static setList(t){this.list=t instanceof E?t:new E(t)}static setData(t){this.data=t}static getValidMove(t,e,i){const{draggable:s,dragBounds:a}=t,r=t.getLocalPoint(i,null,!0);return D.move(r,e.x-t.x,e.y-t.y),a&&this.getMoveInDragBounds(t.__local,"parent"===a?t.parent.boxBounds:a,r,!0),"x"===s&&(r.y=0),"y"===s&&(r.x=0),r}static getMoveInDragBounds(t,e,i,s){const a=t.x+i.x,r=t.y+i.y,n=a+t.width,h=r+t.height,o=e.x+e.width,d=e.y+e.height;return s||(i=Object.assign({},i)),P.includes(t,e)?(a>e.x?i.x+=e.x-a:n<o&&(i.x+=o-n),r>e.y?i.y+=e.y-r:h<d&&(i.y+=d-h)):(a<e.x?i.x+=e.x-a:n>o&&(i.x+=o-n),r<e.y?i.y+=e.y-r:h>d&&(i.y+=d-h)),i}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(K,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(K,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(K,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return P.set(i,e.x-t.x,e.y-t.y,t.x,t.y),P.unsign(i),i}assignMove(t){K.x=t?this.totalX:this.moveX,K.y=t?this.totalY:this.moveY}};W.BEFORE_DRAG="drag.before_drag",W.START="drag.start",W.DRAG="drag",W.END="drag.end",W.OVER="drag.over",W.OUT="drag.out",W.ENTER="drag.enter",W.LEAVE="drag.leave",W=S([y()],W);const U=W;let V=class extends N{static setList(t){W.setList(t)}static setData(t){W.setData(t)}};V.DROP="drop",V=S([y()],V);let j=class extends W{};j.BEFORE_MOVE="move.before_move",j.START="move.start",j.MOVE="move",j.END="move.end",j=S([y()],j);let z=class extends I{};z.BEFORE_ROTATE="rotate.before_rotate",z.START="rotate.start",z.ROTATE="rotate",z.END="rotate.end",z=S([y()],z);let G=class extends W{};G.SWIPE="swipe",G.LEFT="swipe.left",G.RIGHT="swipe.right",G.UP="swipe.up",G.DOWN="swipe.down",G=S([y()],G);let X=class extends I{};X.BEFORE_ZOOM="zoom.before_zoom",X.START="zoom.start",X.ZOOM="zoom",X.END="zoom.end",X=S([y()],X);let Y=class extends I{};Y.DOWN="key.down",Y.HOLD="key.hold",Y.UP="key.up",Y=S([y()],Y);const Z={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?G.UP:t>45&&t<135?G.DOWN:t<=45&&t>=-45?G.RIGHT:G.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:q.getSwipeDirection(D.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new E,{list:s}=t;for(let t=0,a=s.length;t<a;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some((t=>t.draggable||t.editable||!t.isLeafer&&t.hasEvent(W.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},q=Z,J=new E,{getDragEventData:Q,getDropEventData:$,getSwipeEventData:tt}=Z;class et{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=Q(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,a=W.list||this.draggableList||J;return this.dragging&&(s?t?J:new E(e?[...i.list,...i.dragHoverExclude]:i.list):a)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(j.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&B.left(t),this.dragging&&(this.interaction.emit(W.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach((t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y}))}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],(e.draggable||e.editable)&&e.hitSelf&&!e.locked){this.draggableList=new E(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:a,throughPath:r}=s;this.dragData=Q(s,i,t),r&&(this.dragData.throughPath=r),this.dragData.path=a,this.moving?(this.dragData.moveType="drag",e.emit(j.BEFORE_MOVE,this.dragData),e.emit(j.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(W.BEFORE_DRAG,this.dragData),e.emit(W.DRAG,this.dragData))}dragReal(){const{running:t}=this.interaction,e=this.realDraggableList;if(e.length&&t){const{totalX:t,totalY:i}=this.dragData;e.forEach((e=>e.draggable&&e.move(W.getValidMove(e,this.dragStartPoints[e.innerId],{x:t,y:i}))))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(W.OUT,t,i),e.emit(W.OVER,t,s)):e.emit(W.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(W.LEAVE,t,i,s),e.emit(W.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:a,throughPath:r}=i,n=Q(i,t,t);if(r&&(n.throughPath=r),n.path=a,this.moving&&(this.moving=!1,n.moveType="drag",e.emit(j.END,n)),this.dragging){const a=this.getList();this.dragging=!1,e.emit(W.END,n),this.swipe(t,i,s,n),this.drop(t,a,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:a}=this;if(D.getDistance(e,t)>a.config.pointer.swipeDistance){const t=tt(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=$(t,e,W.data);s.path=i,this.interaction.emit(V.DROP,s),this.interaction.emit(W.LEAVE,t,i)}dragReset(){W.list=W.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const it=c.get("emit");const st=["move","zoom","rotate","key"];function at(t,e,i,s,a){if(st.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!nt(t,a)){let r;for(let n=0,h=t.children.length;n<h;n++)r=t.children[n],!i.path.has(r)&&r.__.hittable&&rt(r,e,i,s,a)}}function rt(t,i,s,a,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!nt(t,r)&&(e.updateEventStyle&&!a&&e.updateEventStyle(t,i),t.hasEvent(i,a))){s.phase=a?1:t===s.target?2:3;const e=f.get(i,s);if(t.emitEvent(e,a),e.isStop)return!0}return!1}function nt(t,e){return e&&e.has(t)}const ht={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:ot,pathCanDrag:dt,pathHasOutside:lt}=Z;class gt{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&B.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&B.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&A.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=u.clone(ht),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new E(t),this.createTransformer(),this.dragger=new et(this),s&&(this.config=u.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(B.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(N.BEFORE_DOWN,t),this.emit(N.DOWN,t),B.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=B.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&B.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){const{dragHover:e,dragDistance:i}=this.p;if(this.emit(N.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=D.getDistance(this.downData,t)>i;e&&(this.waitTap&&this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(N.MOVE,t),this.dragging&&!e||this.pointerHover(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;B.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(N.BEFORE_UP,t),this.emit(N.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(N.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(N.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,A.setDownCode(e),this.emit(Y.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(Y.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]=!1,A.setUpCode(e),this.emit(Y.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){this.canHover&&(this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(N.OUT,t,i),this.emit(N.OVER,t,e)):this.emit(N.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach((t=>e.add(t))));const{enterPath:i}=this;this.enterPath=e,this.emit(N.LEAVE,t,i,e),this.emit(N.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(N.LEAVE,t),this.dragger.dragging&&this.emit(V.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,a=[N.DOUBLE_TAP,N.DOUBLE_CLICK].some((e=>ot(t.path,e)));s<e.tapTime+50&&a?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:a}=this,r=this.selector.getByPoint(t,i,Object.assign({bottomList:a,name:t.type},e||{through:s}));return r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,r.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!lt(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!dt(t.path))&&!lt(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:N.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,a=s.length;t<a&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e);return{x:t.clientX-i.x,y:t.clientY-i.y}}emitTap(t){this.emit(N.TAP,t),this.emit(N.CLICK,t)}emitDoubleTap(t){this.emit(N.DOUBLE_TAP,t),this.emit(N.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(N.LONG_PRESS,t)}),this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(N.LONG_TAP,t),(ot(t.path,N.LONG_TAP)||ot(t.path,N.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new w(this.canvas.bounds),this.shrinkCanvasBounds.spread(-("number"==typeof t?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(T.RESIZE,this.__onResize,this)],t.once(O.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let a;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(a=i.list[r],rt(a,t,e,!0,s))return;a.isApp&&at(a,t,e,!0,s)}for(let r=0,n=i.length;r<n;r++)if(a=i.list[r],a.isApp&&at(a,t,e,!1,s),rt(a,t,e,!1,s))return}catch(t){it.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class ct{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}ct.custom={};class ut extends C{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new E,this.pixelList=new E}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),l.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),l.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}const{toInnerRadiusPointOf:pt,copy:_t,setRadius:vt}=D,mt={},ft=R.prototype;ft.__hitWorld=function(t){if(!this.__.hitSelf)return!1;this.__.hitRadius&&(_t(mt,t),vt(t=mt,this.__.hitRadius)),pt(t,this.__world,mt);const{width:e,height:i}=this.__world,s=e<10&&i<10;if(this.__.hitBox||s){if(P.hitRadiusPoint(this.__layout.boxBounds,mt))return!0;if(s)return!1}return!this.__layout.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),this.__layout.boundsChanged||(this.__layout.hitCanvasChanged=!1)),this.__hit(mt)},ft.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},ft.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},ft.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},ft.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const yt=new x,Et=i.prototype;Et.__updateHitCanvas=function(){const t=this.__,{hitCanvasManager:e}=this.leafer,i=(t.__pixelFill||t.__isCanvas)&&"pixel"===t.hitFill,a=t.__pixelStroke&&"pixel"===t.hitStroke,r=i||a;this.__hitCanvas||(this.__hitCanvas=r?e.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):e.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:e}=this.__layout,r=L.image.hitCanvasSize,h=n.hitScale=b.set(0,0,r,r).getFitMatrix(e).a,{x:o,y:d,width:l,height:g}=b.set(e).scale(h);n.resize({width:l,height:g,pixelRatio:1}),n.clear(),s.patternLocked=!0,this.__renderShape(n,{matrix:yt.setWith(this.__world).scaleWith(1/h).invertWith().translate(-o,-d)},!i,!a),s.patternLocked=!1,n.resetTransform(),t.__isHitPixel=!0}else t.__isHitPixel&&(t.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(t)},Et.__hit=function(t){"miniapp"===L.name&&this.__drawHitPath(this.__hitCanvas);const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__pixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:a,__strokeWidth:r}=e,n=e.stroke&&("path"===a||"pixel"===a&&!e.__pixelStroke)||"all"===a;if(!s&&!n)return!1;const h=2*t.radiusX;let o=h;if(n)switch(e.strokeAlign){case"inside":if(o+=2*r,!s&&this.__hitFill(t)&&this.__hitStroke(t,o))return!0;o=h;break;case"center":o+=r;break;case"outside":if(o+=2*r,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,o))return!0;o=h}}return!!o&&this.__hitStroke(t,o)};const Dt=i.prototype,Pt=a.prototype,wt=r.prototype;Pt.__updateHitCanvas=wt.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Dt.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},Pt.__hitFill=wt.__hitFill=function(t){return this.__hitCanvas?Dt.__hitFill.call(this,t):P.hitRadiusPoint(this.__layout.boxBounds,t)};const Tt=i.prototype,Ot=n.prototype;function Ct(t){return t.leafer?t.leafer.selector:h.selector||(h.selector=o.selector())}Tt.find=function(t,e){return Ct(this).getBy(t,this,!1,e)},Tt.findOne=function(t,e){return Ct(this).getBy(t,this,!0,e)},Ot.pick=function(t,e){return this.__layout.update(),e||(e={}),Ct(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Rt=M.prototype;Rt.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Rt.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Rt.hitPixel=function(t,e,i=1){let{x:s,y:a,radiusX:r,radiusY:n}=t;e&&(s-=e.x,a-=e.y),b.set(s-r,a-n,2*r,2*n).scale(i).ceil();const{data:h}=this.context.getImageData(b.x,b.y,b.width||1,b.height||1);for(let t=0,e=h.length;t<e;t+=4)if(h[t+3]>0)return!0;return h[3]>0};export{k as App,ct as Cursor,W as DragEvent,et as Dragger,V as DropEvent,ut as HitCanvasManager,gt as InteractionBase,Z as InteractionHelper,Y as KeyEvent,A as Keyboard,j as MoveEvent,U as MyDragEvent,F as MyPointerEvent,B as PointerButton,N as PointerEvent,z as RotateEvent,G as SwipeEvent,I as UIEvent,X as ZoomEvent};
|
|
1
|
+
import{Leafer as t,State as e,UI as i,ImageManager as s,Rect as a,Box as r,Group as n,Platform as h,Creator as o,emptyData as d}from"@leafer-ui/draw";export*from"@leafer-ui/draw";import{registerUI as l,Creator as g,PropertyEvent as c,Debug as u,DataHelper as p,canvasSizeAttrs as _,LayoutEvent as v,RenderEvent as m,Event as f,EventCreator as y,registerUIEvent as E,LeafList as D,PointHelper as P,BoundsHelper as w,Bounds as T,ResizeEvent as O,LeaferEvent as C,CanvasManager as R,Leaf as x,Matrix as L,Platform as b,tempBounds as M,LeaferCanvasBase as S}from"@leafer/core";function k(t,e,i,s){var a,r=arguments.length,n=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var h=t.length-1;h>=0;h--)(a=t[h])&&(n=(r<3?a(n):r>3?a(e,i,n):a(e,i))||n);return r>3&&n&&Object.defineProperty(e,i,n),n}"function"==typeof SuppressedError&&SuppressedError;let H=class extends t{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,e){if(super.init(t,e),t){const{ground:e,tree:i,sky:s,editor:a}=t;e&&(this.ground=this.addLeafer(e)),(i||a)&&(this.tree=this.addLeafer(i||{type:t.type||"design"})),(s||a)&&(this.sky=this.addLeafer(s)),a&&this.sky.add(this.editor=g.editor(a))}}__setApp(){const{canvas:t}=this,{realCanvas:e,view:i}=this.config;e||i===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(c.CHANGE,this.__onPropertyChange,this))}start(){super.start(),this.children.forEach((t=>t.start()))}stop(){this.children.forEach((t=>t.stop())),super.stop()}unlockLayout(){super.unlockLayout(),this.children.forEach((t=>t.unlockLayout()))}lockLayout(){super.lockLayout(),this.children.forEach((t=>t.lockLayout()))}forceRender(t,e){this.children.forEach((i=>i.forceRender(t,e)))}addLeafer(e){const i=new t(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout((()=>this.add(t,e)),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),void 0!==e&&(t.canvas.childIndex=e),this.__listenChildEvents(t)}__onPropertyChange(){u.showHitView&&this.children.forEach((t=>t.forceUpdate("surface")))}__onCreated(){this.created=this.children.every((t=>t.created))}__onReady(){this.children.every((t=>t.ready))&&super.__onReady()}__onViewReady(){this.children.every((t=>t.viewReady))&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){if(t.context){const i=e.matrix;i&&t.setTransform(i.a,i.b,i.c,i.d,i.e,i.f),this.children.forEach((e=>t.copyWorld(e.canvas)))}}__onResize(t){this.children.forEach((e=>e.resize(t))),super.__onResize(t)}updateLayout(){this.children.forEach((t=>t.updateLayout()))}__getChildConfig(t){let e=Object.assign({},this.config);return e.hittable=e.realCanvas=void 0,t&&p.assign(e,t),this.autoLayout&&p.copyAttrs(e,this,_),e.view=this.realCanvas?void 0:this.view,e.fill=void 0,e}__listenChildEvents(t){t.once(v.END,(()=>this.__onReady())),t.once(m.START,(()=>this.__onCreated())),t.once(m.END,(()=>this.__onViewReady())),this.realCanvas&&this.__eventIds.push(t.on_(m.END,this.__onChildRenderEnd,this))}};H=k([l()],H);const A={},B={isHoldSpaceKey:()=>B.isHold("Space"),isHold:t=>A[t],setDownCode(t){A[t]||(A[t]=!0)},setUpCode(t){A[t]=!1}},I={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class N extends f{get spaceKey(){return B.isHoldSpaceKey()}get left(){return I.left(this)}get right(){return I.right(this)}get middle(){return I.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,e){y.changeName(t,e)}}let F=class extends N{};F.POINTER="pointer",F.BEFORE_DOWN="pointer.before_down",F.BEFORE_MOVE="pointer.before_move",F.BEFORE_UP="pointer.before_up",F.DOWN="pointer.down",F.MOVE="pointer.move",F.UP="pointer.up",F.OVER="pointer.over",F.OUT="pointer.out",F.ENTER="pointer.enter",F.LEAVE="pointer.leave",F.TAP="tap",F.DOUBLE_TAP="double_tap",F.CLICK="click",F.DOUBLE_CLICK="double_click",F.LONG_PRESS="long_press",F.LONG_TAP="long_tap",F.MENU="pointer.menu",F.MENU_TAP="pointer.menu_tap",F=k([E()],F);const K=F,W={};let V=class extends F{static setList(t){this.list=t instanceof D?t:new D(t)}static setData(t){this.data=t}static getValidMove(t,e,i){const{draggable:s,dragBounds:a}=t,r=t.getLocalPoint(i,null,!0);return P.move(r,e.x-t.x,e.y-t.y),a&&this.getMoveInDragBounds(t.__local,"parent"===a?t.parent.boxBounds:a,r,!0),"x"===s&&(r.y=0),"y"===s&&(r.x=0),r}static getMoveInDragBounds(t,e,i,s){const a=t.x+i.x,r=t.y+i.y,n=a+t.width,h=r+t.height,o=e.x+e.width,d=e.y+e.height;return s||(i=Object.assign({},i)),w.includes(t,e)?(a>e.x?i.x+=e.x-a:n<o&&(i.x+=o-n),r>e.y?i.y+=e.y-r:h<d&&(i.y+=d-h)):(a<e.x?i.x+=e.x-a:n>o&&(i.x+=o-n),r<e.y?i.y+=e.y-r:h>d&&(i.y+=d-h)),i}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(W,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(W,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(W,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),e=this.getPagePoint(),i={};return w.set(i,e.x-t.x,e.y-t.y,t.x,t.y),w.unsign(i),i}assignMove(t){W.x=t?this.totalX:this.moveX,W.y=t?this.totalY:this.moveY}};V.BEFORE_DRAG="drag.before_drag",V.START="drag.start",V.DRAG="drag",V.END="drag.end",V.OVER="drag.over",V.OUT="drag.out",V.ENTER="drag.enter",V.LEAVE="drag.leave",V=k([E()],V);const U=V;let j=class extends F{static setList(t){V.setList(t)}static setData(t){V.setData(t)}};j.DROP="drop",j=k([E()],j);let z=class extends V{};z.BEFORE_MOVE="move.before_move",z.START="move.start",z.MOVE="move",z.END="move.end",z=k([E()],z);let G=class extends N{};G.BEFORE_ROTATE="rotate.before_rotate",G.START="rotate.start",G.ROTATE="rotate",G.END="rotate.end",G=k([E()],G);let X=class extends V{};X.SWIPE="swipe",X.LEFT="swipe.left",X.RIGHT="swipe.right",X.UP="swipe.up",X.DOWN="swipe.down",X=k([E()],X);let Y=class extends N{};Y.BEFORE_ZOOM="zoom.before_zoom",Y.START="zoom.start",Y.ZOOM="zoom",Y.END="zoom.end",Y=k([E()],Y);let Z=class extends N{};Z.DOWN="key.down",Z.HOLD="key.hold",Z.UP="key.up",Z=k([E()],Z);const q={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?X.UP:t>45&&t<135?X.DOWN:t<=45&&t>=-45?X.RIGHT:X.LEFT,getSwipeEventData:(t,e,i)=>Object.assign(Object.assign({},i),{moveX:e.moveX,moveY:e.moveY,totalX:i.x-t.x,totalY:i.y-t.y,type:J.getSwipeDirection(P.getAngle(t,i))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,e){const i=new D,{list:s}=t;for(let t=0,a=s.length;t<a;t++)s[t].hasEvent(e)&&i.add(s[t]);return i},pathCanDrag:t=>t&&t.list.some((t=>t.draggable||t.editable||!t.isLeafer&&t.hasEvent(V.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},J=q,Q=new D,{getDragEventData:$,getDropEventData:tt,getSwipeEventData:et}=q;class it{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=$(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,e){const{proxy:i}=this.interaction.selector,s=i&&i.list.length,a=V.list||this.draggableList||Q;return this.dragging&&(s?t?Q:new D(e?[...i.list,...i.dragHoverExclude]:i.list):a)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(z.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&I.left(t),this.dragging&&(this.interaction.emit(V.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach((t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y}))}getDraggableList(t){let e;for(let i=0,s=t.length;i<s;i++)if(e=t.list[i],(e.draggable||e.editable)&&e.hitSelf&&!e.locked){this.draggableList=new D(e);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:a,throughPath:r}=s;this.dragData=$(s,i,t),r&&(this.dragData.throughPath=r),this.dragData.path=a,this.moving?(this.dragData.moveType="drag",e.emit(z.BEFORE_MOVE,this.dragData),e.emit(z.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(V.BEFORE_DRAG,this.dragData),e.emit(V.DRAG,this.dragData))}dragReal(){const{running:t}=this.interaction,e=this.realDraggableList;if(e.length&&t){const{totalX:t,totalY:i}=this.dragData;e.forEach((e=>e.draggable&&e.move(V.getValidMove(e,this.dragStartPoints[e.innerId],{x:t,y:i}))))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(V.OUT,t,i),e.emit(V.OVER,t,s)):e.emit(V.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(V.LEAVE,t,i,s),e.emit(V.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:a,throughPath:r}=i,n=$(i,t,t);if(r&&(n.throughPath=r),n.path=a,this.moving&&(this.moving=!1,n.moveType="drag",e.emit(z.END,n)),this.dragging){const a=this.getList();this.dragging=!1,e.emit(V.END,n),this.swipe(t,i,s,n),this.drop(t,a,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,e,i,s){const{interaction:a}=this;if(P.getDistance(e,t)>a.config.pointer.swipeDistance){const t=et(e,i,s);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=tt(t,e,V.data);s.path=i,this.interaction.emit(j.DROP,s),this.interaction.emit(V.LEAVE,t,i)}dragReset(){V.list=V.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const st=u.get("emit");const at=["move","zoom","rotate","key"];function rt(t,e,i,s,a){if(at.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!ht(t,a)){let r;for(let n=0,h=t.children.length;n<h;n++)r=t.children[n],!i.path.has(r)&&r.__.hittable&&nt(r,e,i,s,a)}}function nt(t,i,s,a,r){if(t.destroyed)return!1;if(t.__.hitSelf&&!ht(t,r)&&(e.updateEventStyle&&!a&&e.updateEventStyle(t,i),t.hasEvent(i,a))){s.phase=a?1:t===s.target?2:3;const e=y.get(i,s);if(t.emitEvent(e,a),e.isStop)return!0}return!1}function ht(t,e){return e&&e.has(t)}const ot={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:dt,pathCanDrag:lt,pathHasOutside:gt}=q;class ct{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&I.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&I.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&B.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,e,i,s){this.config=p.clone(ot),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=e,this.selector=i,this.defaultPath=new D(t),this.createTransformer(),this.dragger=new it(this),s&&(this.config=p.default(s,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(I.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(F.BEFORE_DOWN,t),this.emit(F.DOWN,t),I.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=I.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&I.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){const{dragHover:e,dragDistance:i}=this.p;if(this.emit(F.BEFORE_MOVE,t,this.defaultPath),this.downData){const e=P.getDistance(this.downData,t)>i;e&&(this.waitTap&&this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,e)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(F.MOVE,t),this.dragging&&!e||this.pointerHover(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;I.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(F.BEFORE_UP,t),this.emit(F.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(F.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(F.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,B.setDownCode(e),this.emit(Z.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(Z.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]=!1,B.setUpCode(e),this.emit(Z.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){this.canHover&&(this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(F.OUT,t,i),this.emit(F.OVER,t,e)):this.emit(F.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach((t=>e.add(t))));const{enterPath:i}=this;this.enterPath=e,this.emit(F.LEAVE,t,i,e),this.emit(F.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(F.LEAVE,t),this.dragger.dragging&&this.emit(j.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,a=[F.DOUBLE_TAP,F.DOUBLE_CLICK].some((e=>dt(t.path,e)));s<e.tapTime+50&&a?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:a}=this,r=this.selector.getByPoint(t,i,Object.assign({bottomList:a,name:t.type},e||{through:s}));return r.throughPath&&(t.throughPath=r.throughPath),t.path=r.path,r.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!gt(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!lt(t.path))&&!gt(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:F.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,a=s.length;t<a&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e);return{x:t.clientX-i.x,y:t.clientY-i.y}}emitTap(t){this.emit(F.TAP,t),this.emit(F.CLICK,t)}emitDoubleTap(t){this.emit(F.DOUBLE_TAP,t),this.emit(F.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(F.LONG_PRESS,t)}),this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(F.LONG_TAP,t),(dt(t.path,F.LONG_TAP)||dt(t.path,F.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new T(this.canvas.bounds),this.shrinkCanvasBounds.spread(-("number"==typeof t?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(O.RESIZE,this.__onResize,this)],t.once(C.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let a;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let r=i.length-1;r>-1;r--){if(a=i.list[r],nt(a,t,e,!0,s))return;a.isApp&&rt(a,t,e,!0,s)}for(let r=0,n=i.length;r<n;r++)if(a=i.list[r],a.isApp&&rt(a,t,e,!1,s),nt(a,t,e,!1,s))return}catch(t){st.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}}class ut{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}ut.custom={};class pt extends R{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new D,this.pixelList=new D}getPixelType(t,e){return this.__autoClear(),this.pixelList.add(t),g.hitCanvas(e)}getPathType(t){return this.__autoClear(),this.pathList.add(t),g.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}const{toInnerRadiusPointOf:_t,copy:vt,setRadius:mt}=P,ft={},yt=x.prototype;yt.__hitWorld=function(t){if(!this.__.hitSelf)return!1;this.__.hitRadius&&(vt(ft,t),mt(t=ft,this.__.hitRadius)),_t(t,this.__world,ft);const{width:e,height:i}=this.__world,s=e<10&&i<10;if(this.__.hitBox||s){if(w.hitRadiusPoint(this.__layout.boxBounds,ft))return!0;if(s)return!1}return!this.__layout.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),this.__layout.boundsChanged||(this.__layout.hitCanvasChanged=!1)),this.__hit(ft)},yt.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},yt.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},yt.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},yt.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const Et=new L,Dt=i.prototype;Dt.__updateHitCanvas=function(){const t=this.__,{hitCanvasManager:e}=this.leafer,i=(t.__pixelFill||t.__isCanvas)&&"pixel"===t.hitFill,a=t.__pixelStroke&&"pixel"===t.hitStroke,r=i||a;this.__hitCanvas||(this.__hitCanvas=r?e.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):e.getPathType(this));const n=this.__hitCanvas;if(r){const{renderBounds:e}=this.__layout,r=b.image.hitCanvasSize,h=n.hitScale=M.set(0,0,r,r).getFitMatrix(e).a,{x:o,y:d,width:l,height:g}=M.set(e).scale(h);n.resize({width:l,height:g,pixelRatio:1}),n.clear(),s.patternLocked=!0,this.__renderShape(n,{matrix:Et.setWith(this.__world).scaleWith(1/h).invertWith().translate(-o,-d)},!i,!a),s.patternLocked=!1,n.resetTransform(),t.__isHitPixel=!0}else t.__isHitPixel&&(t.__isHitPixel=!1);this.__drawHitPath(n),n.setStrokeOptions(t)},Dt.__hit=function(t){"miniapp"===b.name&&this.__drawHitPath(this.__hitCanvas);const e=this.__;if(e.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:i}=e,s=(e.fill||e.__isCanvas)&&("path"===i||"pixel"===i&&!(e.__pixelFill||e.__isCanvas))||"all"===i;if(s&&this.__hitFill(t))return!0;const{hitStroke:a,__strokeWidth:r}=e,n=e.stroke&&("path"===a||"pixel"===a&&!e.__pixelStroke)||"all"===a;if(!s&&!n)return!1;const h=2*t.radiusX;let o=h;if(n)switch(e.strokeAlign){case"inside":if(o+=2*r,!s&&this.__hitFill(t)&&this.__hitStroke(t,o))return!0;o=h;break;case"center":o+=r;break;case"outside":if(o+=2*r,!s){if(!this.__hitFill(t)&&this.__hitStroke(t,o))return!0;o=h}}return!!o&&this.__hitStroke(t,o)};const Pt=i.prototype,wt=a.prototype,Tt=r.prototype;wt.__updateHitCanvas=Tt.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?Pt.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},wt.__hitFill=Tt.__hitFill=function(t){return this.__hitCanvas?Pt.__hitFill.call(this,t):w.hitRadiusPoint(this.__layout.boxBounds,t)},n.prototype.pick=function(t,e){return this.leafer||this.updateLayout(),e||(e=d),function(t){return t.leafer?t.leafer.selector:h.selector||(h.selector=o.selector())}(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const Ot=S.prototype;Ot.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},Ot.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},Ot.hitPixel=function(t,e,i=1){let{x:s,y:a,radiusX:r,radiusY:n}=t;e&&(s-=e.x,a-=e.y),M.set(s-r,a-n,2*r,2*n).scale(i).ceil();const{data:h}=this.context.getImageData(M.x,M.y,M.width||1,M.height||1);for(let t=0,e=h.length;t<e;t+=4)if(h[t+3]>0)return!0;return h[3]>0};export{H as App,ut as Cursor,V as DragEvent,it as Dragger,j as DropEvent,pt as HitCanvasManager,ct as InteractionBase,q as InteractionHelper,Z as KeyEvent,B as Keyboard,z as MoveEvent,U as MyDragEvent,K as MyPointerEvent,I as PointerButton,F as PointerEvent,G as RotateEvent,X as SwipeEvent,N as UIEvent,Y as ZoomEvent};
|
package/lib/core.min.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("@leafer-ui/draw"),e=require("@leafer/core");function i(t,e,i,s){var r,a=arguments.length,n=a<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(n=(a<3?r(n):a>3?r(e,i,n):r(e,i))||n);return a>3&&n&&Object.defineProperty(e,i,n),n}"function"==typeof SuppressedError&&SuppressedError,exports.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,i){if(super.init(t,i),t){const{ground:i,tree:s,sky:r,editor:a}=t;i&&(this.ground=this.addLeafer(i)),(s||a)&&(this.tree=this.addLeafer(s||{type:t.type||"design"})),(r||a)&&(this.sky=this.addLeafer(r)),a&&this.sky.add(this.editor=e.Creator.editor(a))}}__setApp(){const{canvas:t}=this,{realCanvas:i,view:s}=this.config;i||s===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(e.PropertyEvent.CHANGE,this.__onPropertyChange,this))}start(){super.start(),this.children.forEach((t=>t.start()))}stop(){this.children.forEach((t=>t.stop())),super.stop()}unlockLayout(){super.unlockLayout(),this.children.forEach((t=>t.unlockLayout()))}lockLayout(){super.lockLayout(),this.children.forEach((t=>t.lockLayout()))}forceRender(t,e){this.children.forEach((i=>i.forceRender(t,e)))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout((()=>this.add(t,e)),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),void 0!==e&&(t.canvas.childIndex=e),this.__listenChildEvents(t)}__onPropertyChange(){e.Debug.showHitView&&this.children.forEach((t=>t.forceUpdate("surface")))}__onCreated(){this.created=this.children.every((t=>t.created))}__onReady(){this.children.every((t=>t.ready))&&super.__onReady()}__onViewReady(){this.children.every((t=>t.viewReady))&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){if(t.context){const i=e.matrix;i&&t.setTransform(i.a,i.b,i.c,i.d,i.e,i.f),this.children.forEach((e=>t.copyWorld(e.canvas)))}}__onResize(t){this.children.forEach((e=>e.resize(t))),super.__onResize(t)}__checkUpdateLayout(){this.children.forEach((t=>t.__layout.update()))}__getChildConfig(t){let i=Object.assign({},this.config);return i.hittable=i.realCanvas=void 0,t&&e.DataHelper.assign(i,t),this.autoLayout&&e.DataHelper.copyAttrs(i,this,e.canvasSizeAttrs),i.view=this.realCanvas?void 0:this.view,i.fill=void 0,i}__listenChildEvents(t){t.once(e.LayoutEvent.END,(()=>this.__onReady())),t.once(e.RenderEvent.START,(()=>this.__onCreated())),t.once(e.RenderEvent.END,(()=>this.__onViewReady())),this.realCanvas&&this.__eventIds.push(t.on_(e.RenderEvent.END,this.__onChildRenderEnd,this))}},exports.App=i([e.registerUI()],exports.App);const s={},r={isHoldSpaceKey:()=>r.isHold("Space"),isHold:t=>s[t],setDownCode(t){s[t]||(s[t]=!0)},setUpCode(t){s[t]=!1}},a={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class n extends e.Event{get spaceKey(){return r.isHoldSpaceKey()}get left(){return a.left(this)}get right(){return a.right(this)}get middle(){return a.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,i){e.EventCreator.changeName(t,i)}}exports.PointerEvent=class extends n{},exports.PointerEvent.POINTER="pointer",exports.PointerEvent.BEFORE_DOWN="pointer.before_down",exports.PointerEvent.BEFORE_MOVE="pointer.before_move",exports.PointerEvent.BEFORE_UP="pointer.before_up",exports.PointerEvent.DOWN="pointer.down",exports.PointerEvent.MOVE="pointer.move",exports.PointerEvent.UP="pointer.up",exports.PointerEvent.OVER="pointer.over",exports.PointerEvent.OUT="pointer.out",exports.PointerEvent.ENTER="pointer.enter",exports.PointerEvent.LEAVE="pointer.leave",exports.PointerEvent.TAP="tap",exports.PointerEvent.DOUBLE_TAP="double_tap",exports.PointerEvent.CLICK="click",exports.PointerEvent.DOUBLE_CLICK="double_click",exports.PointerEvent.LONG_PRESS="long_press",exports.PointerEvent.LONG_TAP="long_tap",exports.PointerEvent.MENU="pointer.menu",exports.PointerEvent.MENU_TAP="pointer.menu_tap",exports.PointerEvent=i([e.registerUIEvent()],exports.PointerEvent);const o=exports.PointerEvent,h={};exports.DragEvent=class extends exports.PointerEvent{static setList(t){this.list=t instanceof e.LeafList?t:new e.LeafList(t)}static setData(t){this.data=t}static getValidMove(t,i,s){const{draggable:r,dragBounds:a}=t,n=t.getLocalPoint(s,null,!0);return e.PointHelper.move(n,i.x-t.x,i.y-t.y),a&&this.getMoveInDragBounds(t.__local,"parent"===a?t.parent.boxBounds:a,n,!0),"x"===r&&(n.y=0),"y"===r&&(n.x=0),n}static getMoveInDragBounds(t,i,s,r){const a=t.x+s.x,n=t.y+s.y,o=a+t.width,h=n+t.height,p=i.x+i.width,g=i.y+i.height;return r||(s=Object.assign({},s)),e.BoundsHelper.includes(t,i)?(a>i.x?s.x+=i.x-a:o<p&&(s.x+=p-o),n>i.y?s.y+=i.y-n:h<g&&(s.y+=g-h)):(a<i.x?s.x+=i.x-a:o>p&&(s.x+=p-o),n<i.y?s.y+=i.y-n:h>g&&(s.y+=g-h)),s}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(h,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(h,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(h,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),i=this.getPagePoint(),s={};return e.BoundsHelper.set(s,i.x-t.x,i.y-t.y,t.x,t.y),e.BoundsHelper.unsign(s),s}assignMove(t){h.x=t?this.totalX:this.moveX,h.y=t?this.totalY:this.moveY}},exports.DragEvent.BEFORE_DRAG="drag.before_drag",exports.DragEvent.START="drag.start",exports.DragEvent.DRAG="drag",exports.DragEvent.END="drag.end",exports.DragEvent.OVER="drag.over",exports.DragEvent.OUT="drag.out",exports.DragEvent.ENTER="drag.enter",exports.DragEvent.LEAVE="drag.leave",exports.DragEvent=i([e.registerUIEvent()],exports.DragEvent);const p=exports.DragEvent;exports.DropEvent=class extends exports.PointerEvent{static setList(t){exports.DragEvent.setList(t)}static setData(t){exports.DragEvent.setData(t)}},exports.DropEvent.DROP="drop",exports.DropEvent=i([e.registerUIEvent()],exports.DropEvent),exports.MoveEvent=class extends exports.DragEvent{},exports.MoveEvent.BEFORE_MOVE="move.before_move",exports.MoveEvent.START="move.start",exports.MoveEvent.MOVE="move",exports.MoveEvent.END="move.end",exports.MoveEvent=i([e.registerUIEvent()],exports.MoveEvent),exports.RotateEvent=class extends n{},exports.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",exports.RotateEvent.START="rotate.start",exports.RotateEvent.ROTATE="rotate",exports.RotateEvent.END="rotate.end",exports.RotateEvent=i([e.registerUIEvent()],exports.RotateEvent),exports.SwipeEvent=class extends exports.DragEvent{},exports.SwipeEvent.SWIPE="swipe",exports.SwipeEvent.LEFT="swipe.left",exports.SwipeEvent.RIGHT="swipe.right",exports.SwipeEvent.UP="swipe.up",exports.SwipeEvent.DOWN="swipe.down",exports.SwipeEvent=i([e.registerUIEvent()],exports.SwipeEvent),exports.ZoomEvent=class extends n{},exports.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",exports.ZoomEvent.START="zoom.start",exports.ZoomEvent.ZOOM="zoom",exports.ZoomEvent.END="zoom.end",exports.ZoomEvent=i([e.registerUIEvent()],exports.ZoomEvent),exports.KeyEvent=class extends n{},exports.KeyEvent.DOWN="key.down",exports.KeyEvent.HOLD="key.hold",exports.KeyEvent.UP="key.up",exports.KeyEvent=i([e.registerUIEvent()],exports.KeyEvent);const g={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?exports.SwipeEvent.UP:t>45&&t<135?exports.SwipeEvent.DOWN:t<=45&&t>=-45?exports.SwipeEvent.RIGHT:exports.SwipeEvent.LEFT,getSwipeEventData:(t,i,s)=>Object.assign(Object.assign({},s),{moveX:i.moveX,moveY:i.moveY,totalX:s.x-t.x,totalY:s.y-t.y,type:d.getSwipeDirection(e.PointHelper.getAngle(t,s))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,i){const s=new e.LeafList,{list:r}=t;for(let t=0,e=r.length;t<e;t++)r[t].hasEvent(i)&&s.add(r[t]);return s},pathCanDrag:t=>t&&t.list.some((t=>t.draggable||t.editable||!t.isLeafer&&t.hasEvent(exports.DragEvent.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},d=g,l=new e.LeafList,{getDragEventData:c,getDropEventData:u,getSwipeEventData:v}=g;class E{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=c(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,i){const{proxy:s}=this.interaction.selector,r=s&&s.list.length,a=exports.DragEvent.list||this.draggableList||l;return this.dragging&&(r?t?l:new e.LeafList(i?[...s.list,...s.dragHoverExclude]:s.list):a)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(exports.MoveEvent.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&a.left(t),this.dragging&&(this.interaction.emit(exports.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach((t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y}))}getDraggableList(t){let i;for(let s=0,r=t.length;s<r;s++)if(i=t.list[s],(i.draggable||i.editable)&&i.hitSelf&&!i.locked){this.draggableList=new e.LeafList(i);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:r,throughPath:a}=s;this.dragData=c(s,i,t),a&&(this.dragData.throughPath=a),this.dragData.path=r,this.moving?(this.dragData.moveType="drag",e.emit(exports.MoveEvent.BEFORE_MOVE,this.dragData),e.emit(exports.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(exports.DragEvent.BEFORE_DRAG,this.dragData),e.emit(exports.DragEvent.DRAG,this.dragData))}dragReal(){const{running:t}=this.interaction,e=this.realDraggableList;if(e.length&&t){const{totalX:t,totalY:i}=this.dragData;e.forEach((e=>e.draggable&&e.move(exports.DragEvent.getValidMove(e,this.dragStartPoints[e.innerId],{x:t,y:i}))))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(exports.DragEvent.OUT,t,i),e.emit(exports.DragEvent.OVER,t,s)):e.emit(exports.DragEvent.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(exports.DragEvent.LEAVE,t,i,s),e.emit(exports.DragEvent.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:r,throughPath:a}=i,n=c(i,t,t);if(a&&(n.throughPath=a),n.path=r,this.moving&&(this.moving=!1,n.moveType="drag",e.emit(exports.MoveEvent.END,n)),this.dragging){const r=this.getList();this.dragging=!1,e.emit(exports.DragEvent.END,n),this.swipe(t,i,s,n),this.drop(t,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,i,s,r){const{interaction:a}=this;if(e.PointHelper.getDistance(i,t)>a.config.pointer.swipeDistance){const t=v(i,s,r);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=u(t,e,exports.DragEvent.data);s.path=i,this.interaction.emit(exports.DropEvent.DROP,s),this.interaction.emit(exports.DragEvent.LEAVE,t,i)}dragReset(){exports.DragEvent.list=exports.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const _=e.Debug.get("emit");const x=["move","zoom","rotate","key"];function m(t,e,i,s,r){if(x.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!P(t,r)){let a;for(let n=0,o=t.children.length;n<o;n++)a=t.children[n],!i.path.has(a)&&a.__.hittable&&f(a,e,i,s,r)}}function f(i,s,r,a,n){if(i.destroyed)return!1;if(i.__.hitSelf&&!P(i,n)&&(t.State.updateEventStyle&&!a&&t.State.updateEventStyle(i,s),i.hasEvent(s,a))){r.phase=a?1:i===r.target?2:3;const t=e.EventCreator.get(s,r);if(i.emitEvent(t,a),t.isStop)return!0}return!1}function P(t,e){return e&&e.has(t)}const D={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:y,pathCanDrag:w,pathHasOutside:L}=g;class T{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}T.custom={};class R extends e.CanvasManager{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new e.LeafList,this.pixelList=new e.LeafList}getPixelType(t,i){return this.__autoClear(),this.pixelList.add(t),e.Creator.hitCanvas(i)}getPathType(t){return this.__autoClear(),this.pathList.add(t),e.Creator.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}const{toInnerRadiusPointOf:C,copy:O,setRadius:b}=e.PointHelper,M={},S=e.Leaf.prototype;S.__hitWorld=function(t){if(!this.__.hitSelf)return!1;this.__.hitRadius&&(O(M,t),b(t=M,this.__.hitRadius)),C(t,this.__world,M);const{width:i,height:s}=this.__world,r=i<10&&s<10;if(this.__.hitBox||r){if(e.BoundsHelper.hitRadiusPoint(this.__layout.boxBounds,M))return!0;if(r)return!1}return!this.__layout.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),this.__layout.boundsChanged||(this.__layout.hitCanvasChanged=!1)),this.__hit(M)},S.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},S.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},S.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},S.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const H=new e.Matrix,k=t.UI.prototype;k.__updateHitCanvas=function(){const i=this.__,{hitCanvasManager:s}=this.leafer,r=(i.__pixelFill||i.__isCanvas)&&"pixel"===i.hitFill,a=i.__pixelStroke&&"pixel"===i.hitStroke,n=r||a;this.__hitCanvas||(this.__hitCanvas=n?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const o=this.__hitCanvas;if(n){const{renderBounds:s}=this.__layout,n=e.Platform.image.hitCanvasSize,h=o.hitScale=e.tempBounds.set(0,0,n,n).getFitMatrix(s).a,{x:p,y:g,width:d,height:l}=e.tempBounds.set(s).scale(h);o.resize({width:d,height:l,pixelRatio:1}),o.clear(),t.ImageManager.patternLocked=!0,this.__renderShape(o,{matrix:H.setWith(this.__world).scaleWith(1/h).invertWith().translate(-p,-g)},!r,!a),t.ImageManager.patternLocked=!1,o.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(i)},k.__hit=function(t){"miniapp"===e.Platform.name&&this.__drawHitPath(this.__hitCanvas);const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,r=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__pixelFill||i.__isCanvas))||"all"===s;if(r&&this.__hitFill(t))return!0;const{hitStroke:a,__strokeWidth:n}=i,o=i.stroke&&("path"===a||"pixel"===a&&!i.__pixelStroke)||"all"===a;if(!r&&!o)return!1;const h=2*t.radiusX;let p=h;if(o)switch(i.strokeAlign){case"inside":if(p+=2*n,!r&&this.__hitFill(t)&&this.__hitStroke(t,p))return!0;p=h;break;case"center":p+=n;break;case"outside":if(p+=2*n,!r){if(!this.__hitFill(t)&&this.__hitStroke(t,p))return!0;p=h}}return!!p&&this.__hitStroke(t,p)};const B=t.UI.prototype,A=t.Rect.prototype,I=t.Box.prototype;A.__updateHitCanvas=I.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?B.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},A.__hitFill=I.__hitFill=function(t){return this.__hitCanvas?B.__hitFill.call(this,t):e.BoundsHelper.hitRadiusPoint(this.__layout.boxBounds,t)};const K=t.UI.prototype,U=t.Group.prototype;function N(e){return e.leafer?e.leafer.selector:t.Platform.selector||(t.Platform.selector=t.Creator.selector())}K.find=function(t,e){return N(this).getBy(t,this,!1,e)},K.findOne=function(t,e){return N(this).getBy(t,this,!0,e)},U.pick=function(t,e){return this.__layout.update(),e||(e={}),N(this).getByPoint(t,e.hitRadius||0,Object.assign(Object.assign({},e),{target:this}))};const F=e.LeaferCanvasBase.prototype;F.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},F.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},F.hitPixel=function(t,i,s=1){let{x:r,y:a,radiusX:n,radiusY:o}=t;i&&(r-=i.x,a-=i.y),e.tempBounds.set(r-n,a-o,2*n,2*o).scale(s).ceil();const{data:h}=this.context.getImageData(e.tempBounds.x,e.tempBounds.y,e.tempBounds.width||1,e.tempBounds.height||1);for(let t=0,e=h.length;t<e;t+=4)if(h[t+3]>0)return!0;return h[3]>0},exports.Cursor=T,exports.Dragger=E,exports.HitCanvasManager=R,exports.InteractionBase=class{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&a.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&a.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&r.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,i,s,r){this.config=e.DataHelper.clone(D),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=i,this.selector=s,this.defaultPath=new e.LeafList(t),this.createTransformer(),this.dragger=new E(this),r&&(this.config=e.DataHelper.default(r,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(a.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(exports.PointerEvent.BEFORE_DOWN,t),this.emit(exports.PointerEvent.DOWN,t),a.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=a.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&a.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){const{dragHover:i,dragDistance:s}=this.p;if(this.emit(exports.PointerEvent.BEFORE_MOVE,t,this.defaultPath),this.downData){const i=e.PointHelper.getDistance(this.downData,t)>s;i&&(this.waitTap&&this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,i)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(exports.PointerEvent.MOVE,t),this.dragging&&!i||this.pointerHover(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;a.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(exports.PointerEvent.BEFORE_UP,t),this.emit(exports.PointerEvent.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(exports.PointerEvent.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(exports.PointerEvent.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,r.setDownCode(e),this.emit(exports.KeyEvent.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(exports.KeyEvent.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]=!1,r.setUpCode(e),this.emit(exports.KeyEvent.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){this.canHover&&(this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(exports.PointerEvent.OUT,t,i),this.emit(exports.PointerEvent.OVER,t,e)):this.emit(exports.PointerEvent.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach((t=>e.add(t))));const{enterPath:i}=this;this.enterPath=e,this.emit(exports.PointerEvent.LEAVE,t,i,e),this.emit(exports.PointerEvent.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(exports.PointerEvent.LEAVE,t),this.dragger.dragging&&this.emit(exports.DropEvent.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,r=[exports.PointerEvent.DOUBLE_TAP,exports.PointerEvent.DOUBLE_CLICK].some((e=>y(t.path,e)));s<e.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r}=this,a=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!L(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!w(t.path))&&!L(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:exports.PointerEvent.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,r=s.length;t<r&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e);return{x:t.clientX-i.x,y:t.clientY-i.y}}emitTap(t){this.emit(exports.PointerEvent.TAP,t),this.emit(exports.PointerEvent.CLICK,t)}emitDoubleTap(t){this.emit(exports.PointerEvent.DOUBLE_TAP,t),this.emit(exports.PointerEvent.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(exports.PointerEvent.LONG_PRESS,t)}),this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(exports.PointerEvent.LONG_TAP,t),(y(t.path,exports.PointerEvent.LONG_TAP)||y(t.path,exports.PointerEvent.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new e.Bounds(this.canvas.bounds),this.shrinkCanvasBounds.spread(-("number"==typeof t?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(e.ResizeEvent.RESIZE,this.__onResize,this)],t.once(e.LeaferEvent.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let a=i.length-1;a>-1;a--){if(r=i.list[a],f(r,t,e,!0,s))return;r.isApp&&m(r,t,e,!0,s)}for(let a=0,n=i.length;a<n;a++)if(r=i.list[a],r.isApp&&m(r,t,e,!1,s),f(r,t,e,!1,s))return}catch(t){_.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}},exports.InteractionHelper=g,exports.Keyboard=r,exports.MyDragEvent=p,exports.MyPointerEvent=o,exports.PointerButton=a,exports.UIEvent=n,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}));
|
|
1
|
+
"use strict";var t=require("@leafer-ui/draw"),e=require("@leafer/core");function i(t,e,i,s){var r,a=arguments.length,n=a<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(r=t[o])&&(n=(a<3?r(n):a>3?r(e,i,n):r(e,i))||n);return a>3&&n&&Object.defineProperty(e,i,n),n}"function"==typeof SuppressedError&&SuppressedError,exports.App=class extends t.Leafer{get __tag(){return"App"}get isApp(){return!0}constructor(t,e){super(t,e)}init(t,i){if(super.init(t,i),t){const{ground:i,tree:s,sky:r,editor:a}=t;i&&(this.ground=this.addLeafer(i)),(s||a)&&(this.tree=this.addLeafer(s||{type:t.type||"design"})),(r||a)&&(this.sky=this.addLeafer(r)),a&&this.sky.add(this.editor=e.Creator.editor(a))}}__setApp(){const{canvas:t}=this,{realCanvas:i,view:s}=this.config;i||s===this.canvas.view||!t.parentView?this.realCanvas=!0:t.unrealCanvas(),this.leafer=this,this.watcher.disable(),this.layouter.disable(),this.__eventIds.push(this.on_(e.PropertyEvent.CHANGE,this.__onPropertyChange,this))}start(){super.start(),this.children.forEach((t=>t.start()))}stop(){this.children.forEach((t=>t.stop())),super.stop()}unlockLayout(){super.unlockLayout(),this.children.forEach((t=>t.unlockLayout()))}lockLayout(){super.lockLayout(),this.children.forEach((t=>t.lockLayout()))}forceRender(t,e){this.children.forEach((i=>i.forceRender(t,e)))}addLeafer(e){const i=new t.Leafer(e);return this.add(i),i}add(t,e){if(!t.view){if(this.realCanvas&&!this.canvas.bounds)return void setTimeout((()=>this.add(t,e)),10);t.init(this.__getChildConfig(t.userConfig),this)}super.add(t,e),void 0!==e&&(t.canvas.childIndex=e),this.__listenChildEvents(t)}__onPropertyChange(){e.Debug.showHitView&&this.children.forEach((t=>t.forceUpdate("surface")))}__onCreated(){this.created=this.children.every((t=>t.created))}__onReady(){this.children.every((t=>t.ready))&&super.__onReady()}__onViewReady(){this.children.every((t=>t.viewReady))&&super.__onViewReady()}__onChildRenderEnd(t){this.renderer.addBlock(t.renderBounds),this.viewReady&&this.renderer.update()}__render(t,e){if(t.context){const i=e.matrix;i&&t.setTransform(i.a,i.b,i.c,i.d,i.e,i.f),this.children.forEach((e=>t.copyWorld(e.canvas)))}}__onResize(t){this.children.forEach((e=>e.resize(t))),super.__onResize(t)}updateLayout(){this.children.forEach((t=>t.updateLayout()))}__getChildConfig(t){let i=Object.assign({},this.config);return i.hittable=i.realCanvas=void 0,t&&e.DataHelper.assign(i,t),this.autoLayout&&e.DataHelper.copyAttrs(i,this,e.canvasSizeAttrs),i.view=this.realCanvas?void 0:this.view,i.fill=void 0,i}__listenChildEvents(t){t.once(e.LayoutEvent.END,(()=>this.__onReady())),t.once(e.RenderEvent.START,(()=>this.__onCreated())),t.once(e.RenderEvent.END,(()=>this.__onViewReady())),this.realCanvas&&this.__eventIds.push(t.on_(e.RenderEvent.END,this.__onChildRenderEnd,this))}},exports.App=i([e.registerUI()],exports.App);const s={},r={isHoldSpaceKey:()=>r.isHold("Space"),isHold:t=>s[t],setDownCode(t){s[t]||(s[t]=!0)},setUpCode(t){s[t]=!1}},a={LEFT:1,RIGHT:2,MIDDLE:4,defaultLeft(t){t.buttons||(t.buttons=1)},left:t=>1===t.buttons,right:t=>2===t.buttons,middle:t=>4===t.buttons};class n extends e.Event{get spaceKey(){return r.isHoldSpaceKey()}get left(){return a.left(this)}get right(){return a.right(this)}get middle(){return a.middle(this)}constructor(t){super(t.type),this.bubbles=!0,Object.assign(this,t)}getBoxPoint(t){return(t||this.current).getBoxPoint(this)}getInnerPoint(t){return(t||this.current).getInnerPoint(this)}getLocalPoint(t){return(t||this.current).getLocalPoint(this)}getPagePoint(){return this.current.getPagePoint(this)}getInner(t){return this.getInnerPoint(t)}getLocal(t){return this.getLocalPoint(t)}getPage(){return this.getPagePoint()}static changeName(t,i){e.EventCreator.changeName(t,i)}}exports.PointerEvent=class extends n{},exports.PointerEvent.POINTER="pointer",exports.PointerEvent.BEFORE_DOWN="pointer.before_down",exports.PointerEvent.BEFORE_MOVE="pointer.before_move",exports.PointerEvent.BEFORE_UP="pointer.before_up",exports.PointerEvent.DOWN="pointer.down",exports.PointerEvent.MOVE="pointer.move",exports.PointerEvent.UP="pointer.up",exports.PointerEvent.OVER="pointer.over",exports.PointerEvent.OUT="pointer.out",exports.PointerEvent.ENTER="pointer.enter",exports.PointerEvent.LEAVE="pointer.leave",exports.PointerEvent.TAP="tap",exports.PointerEvent.DOUBLE_TAP="double_tap",exports.PointerEvent.CLICK="click",exports.PointerEvent.DOUBLE_CLICK="double_click",exports.PointerEvent.LONG_PRESS="long_press",exports.PointerEvent.LONG_TAP="long_tap",exports.PointerEvent.MENU="pointer.menu",exports.PointerEvent.MENU_TAP="pointer.menu_tap",exports.PointerEvent=i([e.registerUIEvent()],exports.PointerEvent);const o=exports.PointerEvent,h={};exports.DragEvent=class extends exports.PointerEvent{static setList(t){this.list=t instanceof e.LeafList?t:new e.LeafList(t)}static setData(t){this.data=t}static getValidMove(t,i,s){const{draggable:r,dragBounds:a}=t,n=t.getLocalPoint(s,null,!0);return e.PointHelper.move(n,i.x-t.x,i.y-t.y),a&&this.getMoveInDragBounds(t.__local,"parent"===a?t.parent.boxBounds:a,n,!0),"x"===r&&(n.y=0),"y"===r&&(n.x=0),n}static getMoveInDragBounds(t,i,s,r){const a=t.x+s.x,n=t.y+s.y,o=a+t.width,h=n+t.height,p=i.x+i.width,g=i.y+i.height;return r||(s=Object.assign({},s)),e.BoundsHelper.includes(t,i)?(a>i.x?s.x+=i.x-a:o<p&&(s.x+=p-o),n>i.y?s.y+=i.y-n:h<g&&(s.y+=g-h)):(a<i.x?s.x+=i.x-a:o>p&&(s.x+=p-o),n<i.y?s.y+=i.y-n:h>g&&(s.y+=g-h)),s}getPageMove(t){return this.assignMove(t),this.current.getPagePoint(h,null,!0)}getInnerMove(t,e){return t||(t=this.current),this.assignMove(e),t.getInnerPoint(h,null,!0)}getLocalMove(t,e){return t||(t=this.current),this.assignMove(e),t.getLocalPoint(h,null,!0)}getPageTotal(){return this.getPageMove(!0)}getInnerTotal(t){return this.getInnerMove(t,!0)}getLocalTotal(t){return this.getLocalMove(t,!0)}getPageBounds(){const t=this.getPageTotal(),i=this.getPagePoint(),s={};return e.BoundsHelper.set(s,i.x-t.x,i.y-t.y,t.x,t.y),e.BoundsHelper.unsign(s),s}assignMove(t){h.x=t?this.totalX:this.moveX,h.y=t?this.totalY:this.moveY}},exports.DragEvent.BEFORE_DRAG="drag.before_drag",exports.DragEvent.START="drag.start",exports.DragEvent.DRAG="drag",exports.DragEvent.END="drag.end",exports.DragEvent.OVER="drag.over",exports.DragEvent.OUT="drag.out",exports.DragEvent.ENTER="drag.enter",exports.DragEvent.LEAVE="drag.leave",exports.DragEvent=i([e.registerUIEvent()],exports.DragEvent);const p=exports.DragEvent;exports.DropEvent=class extends exports.PointerEvent{static setList(t){exports.DragEvent.setList(t)}static setData(t){exports.DragEvent.setData(t)}},exports.DropEvent.DROP="drop",exports.DropEvent=i([e.registerUIEvent()],exports.DropEvent),exports.MoveEvent=class extends exports.DragEvent{},exports.MoveEvent.BEFORE_MOVE="move.before_move",exports.MoveEvent.START="move.start",exports.MoveEvent.MOVE="move",exports.MoveEvent.END="move.end",exports.MoveEvent=i([e.registerUIEvent()],exports.MoveEvent),exports.RotateEvent=class extends n{},exports.RotateEvent.BEFORE_ROTATE="rotate.before_rotate",exports.RotateEvent.START="rotate.start",exports.RotateEvent.ROTATE="rotate",exports.RotateEvent.END="rotate.end",exports.RotateEvent=i([e.registerUIEvent()],exports.RotateEvent),exports.SwipeEvent=class extends exports.DragEvent{},exports.SwipeEvent.SWIPE="swipe",exports.SwipeEvent.LEFT="swipe.left",exports.SwipeEvent.RIGHT="swipe.right",exports.SwipeEvent.UP="swipe.up",exports.SwipeEvent.DOWN="swipe.down",exports.SwipeEvent=i([e.registerUIEvent()],exports.SwipeEvent),exports.ZoomEvent=class extends n{},exports.ZoomEvent.BEFORE_ZOOM="zoom.before_zoom",exports.ZoomEvent.START="zoom.start",exports.ZoomEvent.ZOOM="zoom",exports.ZoomEvent.END="zoom.end",exports.ZoomEvent=i([e.registerUIEvent()],exports.ZoomEvent),exports.KeyEvent=class extends n{},exports.KeyEvent.DOWN="key.down",exports.KeyEvent.HOLD="key.hold",exports.KeyEvent.UP="key.up",exports.KeyEvent=i([e.registerUIEvent()],exports.KeyEvent);const g={getDragEventData:(t,e,i)=>Object.assign(Object.assign({},i),{x:i.x,y:i.y,moveX:i.x-e.x,moveY:i.y-e.y,totalX:i.x-t.x,totalY:i.y-t.y}),getDropEventData:(t,e,i)=>Object.assign(Object.assign({},t),{list:e,data:i}),getSwipeDirection:t=>t<-45&&t>-135?exports.SwipeEvent.UP:t>45&&t<135?exports.SwipeEvent.DOWN:t<=45&&t>=-45?exports.SwipeEvent.RIGHT:exports.SwipeEvent.LEFT,getSwipeEventData:(t,i,s)=>Object.assign(Object.assign({},s),{moveX:i.moveX,moveY:i.moveY,totalX:s.x-t.x,totalY:s.y-t.y,type:d.getSwipeDirection(e.PointHelper.getAngle(t,s))}),getBase(t){const e=1===t.button?4:t.button;return{altKey:t.altKey,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,metaKey:t.metaKey,buttons:void 0===t.buttons?1:0===t.buttons?e:t.buttons,origin:t}},pathHasEventType(t,e){const{list:i}=t;for(let t=0,s=i.length;t<s;t++)if(i[t].hasEvent(e))return!0;return!1},filterPathByEventType(t,i){const s=new e.LeafList,{list:r}=t;for(let t=0,e=r.length;t<e;t++)r[t].hasEvent(i)&&s.add(r[t]);return s},pathCanDrag:t=>t&&t.list.some((t=>t.draggable||t.editable||!t.isLeafer&&t.hasEvent(exports.DragEvent.DRAG))),pathHasOutside:t=>t&&t.list.some((t=>t.isOutside))},d=g,l=new e.LeafList,{getDragEventData:c,getDropEventData:u,getSwipeEventData:v}=g;class E{constructor(t){this.interaction=t}setDragData(t){this.animateWait&&this.dragEndReal(),this.downData=this.interaction.downData,this.dragData=c(t,t,t),this.canAnimate=this.canDragOut=!0}getList(t,i){const{proxy:s}=this.interaction.selector,r=s&&s.list.length,a=exports.DragEvent.list||this.draggableList||l;return this.dragging&&(r?t?l:new e.LeafList(i?[...s.list,...s.dragHoverExclude]:s.list):a)}checkDrag(t,e){const{interaction:i}=this;if(this.moving&&t.buttons<1)return this.canAnimate=!1,void i.pointerCancel();!this.moving&&e&&(this.moving=i.canMove(this.downData)||i.isHoldRightKey||i.isMobileDragEmpty)&&(this.dragData.moveType="drag",i.emit(exports.MoveEvent.START,this.dragData)),this.moving||this.dragStart(t,e),this.drag(t)}dragStart(t,e){this.dragging||(this.dragging=e&&a.left(t),this.dragging&&(this.interaction.emit(exports.DragEvent.START,this.dragData),this.getDraggableList(this.dragData.path),this.setDragStartPoints(this.realDraggableList=this.getList(!0))))}setDragStartPoints(t){this.dragStartPoints={},t.forEach((t=>this.dragStartPoints[t.innerId]={x:t.x,y:t.y}))}getDraggableList(t){let i;for(let s=0,r=t.length;s<r;s++)if(i=t.list[s],(i.draggable||i.editable)&&i.hitSelf&&!i.locked){this.draggableList=new e.LeafList(i);break}}drag(t){const{interaction:e,dragData:i,downData:s}=this,{path:r,throughPath:a}=s;this.dragData=c(s,i,t),a&&(this.dragData.throughPath=a),this.dragData.path=r,this.moving?(this.dragData.moveType="drag",e.emit(exports.MoveEvent.BEFORE_MOVE,this.dragData),e.emit(exports.MoveEvent.MOVE,this.dragData)):this.dragging&&(this.dragReal(),e.emit(exports.DragEvent.BEFORE_DRAG,this.dragData),e.emit(exports.DragEvent.DRAG,this.dragData))}dragReal(){const{running:t}=this.interaction,e=this.realDraggableList;if(e.length&&t){const{totalX:t,totalY:i}=this.dragData;e.forEach((e=>e.draggable&&e.move(exports.DragEvent.getValidMove(e,this.dragStartPoints[e.innerId],{x:t,y:i}))))}}dragOverOrOut(t){const{interaction:e}=this,{dragOverPath:i}=this,{path:s}=t;this.dragOverPath=s,i?s.indexAt(0)!==i.indexAt(0)&&(e.emit(exports.DragEvent.OUT,t,i),e.emit(exports.DragEvent.OVER,t,s)):e.emit(exports.DragEvent.OVER,t,s)}dragEnterOrLeave(t){const{interaction:e}=this,{dragEnterPath:i}=this,{path:s}=t;e.emit(exports.DragEvent.LEAVE,t,i,s),e.emit(exports.DragEvent.ENTER,t,s,i),this.dragEnterPath=s}dragEnd(t,e){(this.dragging||this.moving)&&(this.checkDragEndAnimate(t,e)||this.dragEndReal(t))}dragEndReal(t){const{interaction:e,downData:i,dragData:s}=this;t||(t=s);const{path:r,throughPath:a}=i,n=c(i,t,t);if(a&&(n.throughPath=a),n.path=r,this.moving&&(this.moving=!1,n.moveType="drag",e.emit(exports.MoveEvent.END,n)),this.dragging){const r=this.getList();this.dragging=!1,e.emit(exports.DragEvent.END,n),this.swipe(t,i,s,n),this.drop(t,r,this.dragEnterPath)}this.autoMoveCancel(),this.dragReset(),this.animate(null,"off")}swipe(t,i,s,r){const{interaction:a}=this;if(e.PointHelper.getDistance(i,t)>a.config.pointer.swipeDistance){const t=v(i,s,r);this.interaction.emit(t.type,t)}}drop(t,e,i){const s=u(t,e,exports.DragEvent.data);s.path=i,this.interaction.emit(exports.DropEvent.DROP,s),this.interaction.emit(exports.DragEvent.LEAVE,t,i)}dragReset(){exports.DragEvent.list=exports.DragEvent.data=this.draggableList=this.dragData=this.downData=this.dragOverPath=this.dragEnterPath=null}checkDragEndAnimate(t,e){return!1}animate(t,e){}checkDragOut(t){}autoMoveOnDragOut(t){}autoMoveCancel(){}destroy(){this.dragReset()}}const _=e.Debug.get("emit");const x=["move","zoom","rotate","key"];function m(t,e,i,s,r){if(x.some((t=>e.startsWith(t)))&&t.__.hitChildren&&!P(t,r)){let a;for(let n=0,o=t.children.length;n<o;n++)a=t.children[n],!i.path.has(a)&&a.__.hittable&&f(a,e,i,s,r)}}function f(i,s,r,a,n){if(i.destroyed)return!1;if(i.__.hitSelf&&!P(i,n)&&(t.State.updateEventStyle&&!a&&t.State.updateEventStyle(i,s),i.hasEvent(s,a))){r.phase=a?1:i===r.target?2:3;const t=e.EventCreator.get(s,r);if(i.emitEvent(t,a),t.isStop)return!0}return!1}function P(t,e){return e&&e.has(t)}const D={wheel:{zoomSpeed:.5,moveSpeed:.5,rotateSpeed:.5,delta:{x:20,y:8}},pointer:{hitRadius:5,tapTime:120,longPressTime:800,transformTime:500,hover:!0,dragHover:!0,dragDistance:2,swipeDistance:20},touch:{preventDefault:"auto"},multiTouch:{},move:{autoDistance:2},zoom:{},cursor:!0,keyEvent:!0},{pathHasEventType:y,pathCanDrag:w,pathHasOutside:L}=g;class T{static set(t,e){this.custom[t]=e}static get(t){return this.custom[t]}}T.custom={};class R extends e.CanvasManager{constructor(){super(...arguments),this.maxTotal=1e3,this.pathList=new e.LeafList,this.pixelList=new e.LeafList}getPixelType(t,i){return this.__autoClear(),this.pixelList.add(t),e.Creator.hitCanvas(i)}getPathType(t){return this.__autoClear(),this.pathList.add(t),e.Creator.hitCanvas()}clearImageType(){this.__clearLeafList(this.pixelList)}clearPathType(){this.__clearLeafList(this.pathList)}__clearLeafList(t){t.length&&(t.forEach((t=>{t.__hitCanvas&&(t.__hitCanvas.destroy(),t.__hitCanvas=null)})),t.reset())}__autoClear(){this.pathList.length+this.pixelList.length>this.maxTotal&&this.clear()}clear(){this.clearPathType(),this.clearImageType()}}const{toInnerRadiusPointOf:C,copy:O,setRadius:b}=e.PointHelper,M={},S=e.Leaf.prototype;S.__hitWorld=function(t){if(!this.__.hitSelf)return!1;this.__.hitRadius&&(O(M,t),b(t=M,this.__.hitRadius)),C(t,this.__world,M);const{width:i,height:s}=this.__world,r=i<10&&s<10;if(this.__.hitBox||r){if(e.BoundsHelper.hitRadiusPoint(this.__layout.boxBounds,M))return!0;if(r)return!1}return!this.__layout.hitCanvasChanged&&this.__hitCanvas||(this.__updateHitCanvas(),this.__layout.boundsChanged||(this.__layout.hitCanvasChanged=!1)),this.__hit(M)},S.__hitFill=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitFill(t,this.__.windingRule)},S.__hitStroke=function(t,e){var i;return null===(i=this.__hitCanvas)||void 0===i?void 0:i.hitStroke(t,e)},S.__hitPixel=function(t){var e;return null===(e=this.__hitCanvas)||void 0===e?void 0:e.hitPixel(t,this.__layout.renderBounds,this.__hitCanvas.hitScale)},S.__drawHitPath=function(t){t&&this.__drawRenderPath(t)};const H=new e.Matrix,k=t.UI.prototype;k.__updateHitCanvas=function(){const i=this.__,{hitCanvasManager:s}=this.leafer,r=(i.__pixelFill||i.__isCanvas)&&"pixel"===i.hitFill,a=i.__pixelStroke&&"pixel"===i.hitStroke,n=r||a;this.__hitCanvas||(this.__hitCanvas=n?s.getPixelType(this,{contextSettings:{willReadFrequently:!0}}):s.getPathType(this));const o=this.__hitCanvas;if(n){const{renderBounds:s}=this.__layout,n=e.Platform.image.hitCanvasSize,h=o.hitScale=e.tempBounds.set(0,0,n,n).getFitMatrix(s).a,{x:p,y:g,width:d,height:l}=e.tempBounds.set(s).scale(h);o.resize({width:d,height:l,pixelRatio:1}),o.clear(),t.ImageManager.patternLocked=!0,this.__renderShape(o,{matrix:H.setWith(this.__world).scaleWith(1/h).invertWith().translate(-p,-g)},!r,!a),t.ImageManager.patternLocked=!1,o.resetTransform(),i.__isHitPixel=!0}else i.__isHitPixel&&(i.__isHitPixel=!1);this.__drawHitPath(o),o.setStrokeOptions(i)},k.__hit=function(t){"miniapp"===e.Platform.name&&this.__drawHitPath(this.__hitCanvas);const i=this.__;if(i.__isHitPixel&&this.__hitPixel(t))return!0;const{hitFill:s}=i,r=(i.fill||i.__isCanvas)&&("path"===s||"pixel"===s&&!(i.__pixelFill||i.__isCanvas))||"all"===s;if(r&&this.__hitFill(t))return!0;const{hitStroke:a,__strokeWidth:n}=i,o=i.stroke&&("path"===a||"pixel"===a&&!i.__pixelStroke)||"all"===a;if(!r&&!o)return!1;const h=2*t.radiusX;let p=h;if(o)switch(i.strokeAlign){case"inside":if(p+=2*n,!r&&this.__hitFill(t)&&this.__hitStroke(t,p))return!0;p=h;break;case"center":p+=n;break;case"outside":if(p+=2*n,!r){if(!this.__hitFill(t)&&this.__hitStroke(t,p))return!0;p=h}}return!!p&&this.__hitStroke(t,p)};const B=t.UI.prototype,A=t.Rect.prototype,I=t.Box.prototype;A.__updateHitCanvas=I.__updateHitCanvas=function(){this.stroke||this.cornerRadius||(this.fill||this.__.__isCanvas)&&"pixel"===this.hitFill||"all"===this.hitStroke?B.__updateHitCanvas.call(this):this.__hitCanvas&&(this.__hitCanvas=null)},A.__hitFill=I.__hitFill=function(t){return this.__hitCanvas?B.__hitFill.call(this,t):e.BoundsHelper.hitRadiusPoint(this.__layout.boxBounds,t)},t.Group.prototype.pick=function(e,i){return this.leafer||this.updateLayout(),i||(i=t.emptyData),function(e){return e.leafer?e.leafer.selector:t.Platform.selector||(t.Platform.selector=t.Creator.selector())}(this).getByPoint(e,i.hitRadius||0,Object.assign(Object.assign({},i),{target:this}))};const K=e.LeaferCanvasBase.prototype;K.hitFill=function(t,e){return e?this.context.isPointInPath(t.x,t.y,e):this.context.isPointInPath(t.x,t.y)},K.hitStroke=function(t,e){return this.strokeWidth=e,this.context.isPointInStroke(t.x,t.y)},K.hitPixel=function(t,i,s=1){let{x:r,y:a,radiusX:n,radiusY:o}=t;i&&(r-=i.x,a-=i.y),e.tempBounds.set(r-n,a-o,2*n,2*o).scale(s).ceil();const{data:h}=this.context.getImageData(e.tempBounds.x,e.tempBounds.y,e.tempBounds.width||1,e.tempBounds.height||1);for(let t=0,e=h.length;t<e;t+=4)if(h[t+3]>0)return!0;return h[3]>0},exports.Cursor=T,exports.Dragger=E,exports.HitCanvasManager=R,exports.InteractionBase=class{get dragging(){return this.dragger.dragging}get transforming(){return this.transformer.transforming}get moveMode(){return!0===this.m.drag||this.isHoldSpaceKey||this.isHoldMiddleKey||this.isHoldRightKey&&this.dragger.moving||this.isDragEmpty}get canHover(){return this.p.hover&&!this.config.mobile}get isDragEmpty(){return this.m.dragEmpty&&this.isRootPath(this.hoverData)&&(!this.downData||this.isRootPath(this.downData))}get isMobileDragEmpty(){return this.m.dragEmpty&&!this.canHover&&this.downData&&this.isTreePath(this.downData)}get isHoldMiddleKey(){return this.m.holdMiddleKey&&this.downData&&a.middle(this.downData)}get isHoldRightKey(){return this.m.holdRightKey&&this.downData&&a.right(this.downData)}get isHoldSpaceKey(){return this.m.holdSpaceKey&&r.isHoldSpaceKey()}get m(){return this.config.move}get p(){return this.config.pointer}get hitRadius(){return this.p.hitRadius}constructor(t,i,s,r){this.config=e.DataHelper.clone(D),this.tapCount=0,this.downKeyMap={},this.target=t,this.canvas=i,this.selector=s,this.defaultPath=new e.LeafList(t),this.createTransformer(),this.dragger=new E(this),r&&(this.config=e.DataHelper.default(r,this.config)),this.__listenEvents()}start(){this.running=!0}stop(){this.running=!1}receive(t){}pointerDown(t,e){t||(t=this.hoverData),t&&(a.defaultLeft(t),this.updateDownData(t),this.checkPath(t,e),this.downTime=Date.now(),this.emit(exports.PointerEvent.BEFORE_DOWN,t),this.emit(exports.PointerEvent.DOWN,t),a.left(t)&&(this.tapWait(),this.longPressWait(t)),this.waitRightTap=a.right(t),this.dragger.setDragData(t),this.isHoldRightKey||this.updateCursor(t))}pointerMove(t){if(t||(t=this.hoverData),!t)return;const{downData:e}=this;e&&a.defaultLeft(t);(this.canvas.bounds.hitPoint(t)||e)&&(this.pointerMoveReal(t),e&&this.dragger.checkDragOut(t))}pointerMoveReal(t){const{dragHover:i,dragDistance:s}=this.p;if(this.emit(exports.PointerEvent.BEFORE_MOVE,t,this.defaultPath),this.downData){const i=e.PointHelper.getDistance(this.downData,t)>s;i&&(this.waitTap&&this.pointerWaitCancel(),this.waitRightTap=!1),this.dragger.checkDrag(t,i)}this.dragger.moving||(this.updateHoverData(t),this.checkPath(t),this.emit(exports.PointerEvent.MOVE,t),this.dragging&&!i||this.pointerHover(t),this.dragger.dragging&&(this.dragger.dragOverOrOut(t),this.dragger.dragEnterOrLeave(t))),this.updateCursor(this.downData||t)}pointerUp(t){const{downData:e}=this;if(t||(t=e),!e)return;a.defaultLeft(t),t.multiTouch=e.multiTouch,this.findPath(t);const i=Object.assign(Object.assign({},t),{path:t.path.clone()});t.path.addList(e.path.list),this.checkPath(t),this.downData=null,this.emit(exports.PointerEvent.BEFORE_UP,t),this.emit(exports.PointerEvent.UP,t),this.touchLeave(t),t.isCancel||(this.tap(t),this.menuTap(t)),this.dragger.dragEnd(t),this.updateCursor(i)}pointerCancel(){const t=Object.assign({},this.dragger.dragData);t.isCancel=!0,this.pointerUp(t)}menu(t){this.findPath(t),this.emit(exports.PointerEvent.MENU,t),this.waitMenuTap=!0,!this.downData&&this.waitRightTap&&this.menuTap(t)}menuTap(t){this.waitRightTap&&this.waitMenuTap&&(this.emit(exports.PointerEvent.MENU_TAP,t),this.waitRightTap=this.waitMenuTap=!1)}createTransformer(){}move(t){}zoom(t){}rotate(t){}transformEnd(){}wheel(t){}multiTouch(t,e){}keyDown(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]||(this.downKeyMap[e]=!0,r.setDownCode(e),this.emit(exports.KeyEvent.HOLD,t,this.defaultPath),this.moveMode&&(this.cancelHover(),this.updateCursor())),this.emit(exports.KeyEvent.DOWN,t,this.defaultPath)}keyUp(t){if(!this.config.keyEvent)return;const{code:e}=t;this.downKeyMap[e]=!1,r.setUpCode(e),this.emit(exports.KeyEvent.UP,t,this.defaultPath),"grab"===this.cursor&&this.updateCursor()}pointerHover(t){this.canHover&&(this.pointerOverOrOut(t),this.pointerEnterOrLeave(t))}pointerOverOrOut(t){const{path:e}=t,{overPath:i}=this;this.overPath=e,i?e.indexAt(0)!==i.indexAt(0)&&(this.emit(exports.PointerEvent.OUT,t,i),this.emit(exports.PointerEvent.OVER,t,e)):this.emit(exports.PointerEvent.OVER,t,e)}pointerEnterOrLeave(t){let{path:e}=t;this.downData&&!this.moveMode&&(e=e.clone(),this.downData.path.forEach((t=>e.add(t))));const{enterPath:i}=this;this.enterPath=e,this.emit(exports.PointerEvent.LEAVE,t,i,e),this.emit(exports.PointerEvent.ENTER,t,e,i)}touchLeave(t){"touch"===t.pointerType&&this.enterPath&&(this.emit(exports.PointerEvent.LEAVE,t),this.dragger.dragging&&this.emit(exports.DropEvent.LEAVE,t))}tap(t){const{pointer:e}=this.config,i=this.longTap(t);if(!e.tapMore&&i)return;if(!this.waitTap)return;e.tapMore&&this.emitTap(t);const s=Date.now()-this.downTime,r=[exports.PointerEvent.DOUBLE_TAP,exports.PointerEvent.DOUBLE_CLICK].some((e=>y(t.path,e)));s<e.tapTime+50&&r?(this.tapCount++,2===this.tapCount?(this.tapWaitCancel(),this.emitDoubleTap(t)):(clearTimeout(this.tapTimer),this.tapTimer=setTimeout((()=>{e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}),e.tapTime))):e.tapMore||(this.tapWaitCancel(),this.emitTap(t))}findPath(t,e){const{hitRadius:i,through:s}=this.p,{bottomList:r}=this,a=this.selector.getByPoint(t,i,Object.assign({bottomList:r,name:t.type},e||{through:s}));return a.throughPath&&(t.throughPath=a.throughPath),t.path=a.path,a.path}isRootPath(t){return t&&t.path.list[0].isLeafer}isTreePath(t){const e=this.target.app;return!(!e||!e.isApp)&&(e.editor&&!t.path.has(e.editor)&&t.path.has(e.tree)&&!t.target.syncEventer)}checkPath(t,e){(e||this.moveMode&&!L(t.path))&&(t.path=this.defaultPath)}canMove(t){return t&&(this.moveMode||"auto"===this.m.drag&&!w(t.path))&&!L(t.path)}isDrag(t){return this.dragger.getList().has(t)}isPress(t){return this.downData&&this.downData.path.has(t)}isHover(t){return this.enterPath&&this.enterPath.has(t)}isFocus(t){return this.focusData===t}cancelHover(){const{hoverData:t}=this;t&&(t.path=this.defaultPath,this.pointerHover(t))}updateDownData(t,e,i){const{downData:s}=this;!t&&s&&(t=s),t&&(this.findPath(t,e),i&&s&&t.path.addList(s.path.list),this.downData=t)}updateHoverData(t){t||(t=this.hoverData),t&&(this.findPath(t,{exclude:this.dragger.getList(!1,!0),name:exports.PointerEvent.MOVE}),this.hoverData=t)}updateCursor(t){if(!this.config.cursor||!this.canHover)return;if(t||(this.updateHoverData(),t=this.downData||this.hoverData),this.dragger.moving)return this.setCursor("grabbing");if(this.canMove(t))return this.setCursor(this.downData?"grabbing":"grab");if(!t)return;let e,i;const{path:s}=t;for(let t=0,r=s.length;t<r&&(e=s.list[t],i=e.syncEventer&&e.syncEventer.cursor||e.cursor,!i);t++);this.setCursor(i)}setCursor(t){this.cursor=t}getLocal(t,e){const i=this.canvas.getClientBounds(e);return{x:t.clientX-i.x,y:t.clientY-i.y}}emitTap(t){this.emit(exports.PointerEvent.TAP,t),this.emit(exports.PointerEvent.CLICK,t)}emitDoubleTap(t){this.emit(exports.PointerEvent.DOUBLE_TAP,t),this.emit(exports.PointerEvent.DOUBLE_CLICK,t)}pointerWaitCancel(){this.tapWaitCancel(),this.longPressWaitCancel()}tapWait(){clearTimeout(this.tapTimer),this.waitTap=!0}tapWaitCancel(){clearTimeout(this.tapTimer),this.waitTap=!1,this.tapCount=0}longPressWait(t){clearTimeout(this.longPressTimer),this.longPressTimer=setTimeout((()=>{this.longPressed=!0,this.emit(exports.PointerEvent.LONG_PRESS,t)}),this.p.longPressTime)}longTap(t){let e;return this.longPressed&&(this.emit(exports.PointerEvent.LONG_TAP,t),(y(t.path,exports.PointerEvent.LONG_TAP)||y(t.path,exports.PointerEvent.LONG_PRESS))&&(e=!0)),this.longPressWaitCancel(),e}longPressWaitCancel(){clearTimeout(this.longPressTimer),this.longPressed=!1}__onResize(){const{dragOut:t}=this.m;this.shrinkCanvasBounds=new e.Bounds(this.canvas.bounds),this.shrinkCanvasBounds.spread(-("number"==typeof t?t:2))}__listenEvents(){const{target:t}=this;this.__eventIds=[t.on_(e.ResizeEvent.RESIZE,this.__onResize,this)],t.once(e.LeaferEvent.READY,(()=>this.__onResize()))}__removeListenEvents(){this.target.off_(this.__eventIds),this.__eventIds.length=0}emit(t,e,i,s){this.running&&function(t,e,i,s){if(!i&&!e.path)return;let r;e.type=t,i?e=Object.assign(Object.assign({},e),{path:i}):i=e.path,e.target=i.indexAt(0);try{for(let a=i.length-1;a>-1;a--){if(r=i.list[a],f(r,t,e,!0,s))return;r.isApp&&m(r,t,e,!0,s)}for(let a=0,n=i.length;a<n;a++)if(r=i.list[a],r.isApp&&m(r,t,e,!1,s),f(r,t,e,!1,s))return}catch(t){_.error(t)}}(t,e,i,s)}destroy(){this.__eventIds.length&&(this.stop(),this.__removeListenEvents(),this.dragger.destroy(),this.transformer&&this.transformer.destroy(),this.downData=this.overPath=this.enterPath=null)}},exports.InteractionHelper=g,exports.Keyboard=r,exports.MyDragEvent=p,exports.MyPointerEvent=o,exports.PointerButton=a,exports.UIEvent=n,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "@leafer-ui/core",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"leaferjs"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@leafer-ui/draw": "1.
|
|
33
|
-
"@leafer-ui/app": "1.
|
|
34
|
-
"@leafer-ui/interaction": "1.
|
|
35
|
-
"@leafer-ui/event": "1.
|
|
36
|
-
"@leafer-ui/hit": "1.
|
|
32
|
+
"@leafer-ui/draw": "1.3.0",
|
|
33
|
+
"@leafer-ui/app": "1.3.0",
|
|
34
|
+
"@leafer-ui/interaction": "1.3.0",
|
|
35
|
+
"@leafer-ui/event": "1.3.0",
|
|
36
|
+
"@leafer-ui/hit": "1.3.0"
|
|
37
37
|
}
|
|
38
38
|
}
|