leafer-game 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web.js +183 -54
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +266 -137
- package/dist/web.module.min.js +1 -1
- package/package.json +10 -10
package/dist/web.module.js
CHANGED
|
@@ -6007,7 +6007,7 @@ class LeafLevelList {
|
|
|
6007
6007
|
}
|
|
6008
6008
|
}
|
|
6009
6009
|
|
|
6010
|
-
const version = "1.3.
|
|
6010
|
+
const version = "1.3.2";
|
|
6011
6011
|
|
|
6012
6012
|
const debug$5 = Debug.get('LeaferCanvas');
|
|
6013
6013
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6226,7 +6226,7 @@ function useCanvas(_canvasType, _power) {
|
|
|
6226
6226
|
},
|
|
6227
6227
|
loadImage(src) {
|
|
6228
6228
|
return new Promise((resolve, reject) => {
|
|
6229
|
-
const img = new Image();
|
|
6229
|
+
const img = new Platform.origin.Image();
|
|
6230
6230
|
const { crossOrigin } = Platform.image;
|
|
6231
6231
|
if (crossOrigin) {
|
|
6232
6232
|
img.setAttribute('crossOrigin', crossOrigin);
|
|
@@ -6236,7 +6236,10 @@ function useCanvas(_canvasType, _power) {
|
|
|
6236
6236
|
img.onerror = (e) => { reject(e); };
|
|
6237
6237
|
img.src = Platform.image.getRealURL(src);
|
|
6238
6238
|
});
|
|
6239
|
-
}
|
|
6239
|
+
},
|
|
6240
|
+
Image,
|
|
6241
|
+
PointerEvent,
|
|
6242
|
+
DragEvent
|
|
6240
6243
|
};
|
|
6241
6244
|
Platform.event = {
|
|
6242
6245
|
stopDefault(origin) { origin.preventDefault(); },
|
|
@@ -6712,7 +6715,7 @@ class Renderer {
|
|
|
6712
6715
|
partRender() {
|
|
6713
6716
|
const { canvas, updateBlocks: list } = this;
|
|
6714
6717
|
if (!list)
|
|
6715
|
-
return
|
|
6718
|
+
return;
|
|
6716
6719
|
this.mergeBlocks();
|
|
6717
6720
|
list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
|
|
6718
6721
|
this.clipRender(block); });
|
|
@@ -7568,7 +7571,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7568
7571
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7569
7572
|
return Plugin.need('animate');
|
|
7570
7573
|
}
|
|
7571
|
-
killAnimate(_type,
|
|
7574
|
+
killAnimate(_type, _nextStyle) { }
|
|
7572
7575
|
export(_filename, _options) {
|
|
7573
7576
|
return Plugin.need('export');
|
|
7574
7577
|
}
|
|
@@ -8064,8 +8067,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8064
8067
|
this.created = true;
|
|
8065
8068
|
}
|
|
8066
8069
|
__onReady() {
|
|
8067
|
-
if (this.ready)
|
|
8068
|
-
return;
|
|
8069
8070
|
this.ready = true;
|
|
8070
8071
|
this.emitLeafer(LeaferEvent.BEFORE_READY);
|
|
8071
8072
|
this.emitLeafer(LeaferEvent.READY);
|
|
@@ -8079,6 +8080,20 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8079
8080
|
this.emitLeafer(LeaferEvent.VIEW_READY);
|
|
8080
8081
|
WaitHelper.run(this.__viewReadyWait);
|
|
8081
8082
|
}
|
|
8083
|
+
__onLayoutEnd() {
|
|
8084
|
+
const { grow, growWidth, growHeight } = this.config;
|
|
8085
|
+
if (grow) {
|
|
8086
|
+
let { width, height, pixelRatio } = this;
|
|
8087
|
+
const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
|
|
8088
|
+
if (growWidth !== false)
|
|
8089
|
+
width = Math.max(1, bounds.x + bounds.width);
|
|
8090
|
+
if (growHeight !== false)
|
|
8091
|
+
height = Math.max(1, bounds.y + bounds.height);
|
|
8092
|
+
this.__doResize({ width, height, pixelRatio });
|
|
8093
|
+
}
|
|
8094
|
+
if (!this.ready)
|
|
8095
|
+
this.__onReady();
|
|
8096
|
+
}
|
|
8082
8097
|
__onNextRender() {
|
|
8083
8098
|
if (this.viewReady) {
|
|
8084
8099
|
WaitHelper.run(this.__nextRenderWait);
|
|
@@ -8172,10 +8187,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
8172
8187
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8173
8188
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
8174
8189
|
this.once(LayoutEvent.START, () => this.updateLazyBounds());
|
|
8175
|
-
this.once(LayoutEvent.END, () => this.__onReady());
|
|
8176
8190
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
8177
8191
|
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
8178
|
-
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
|
|
8192
|
+
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(LayoutEvent.END, this.__onLayoutEnd, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
|
|
8179
8193
|
}
|
|
8180
8194
|
__removeListenEvents() {
|
|
8181
8195
|
this.off_(this.__eventIds);
|
|
@@ -9104,34 +9118,34 @@ class UIEvent extends Event {
|
|
|
9104
9118
|
}
|
|
9105
9119
|
}
|
|
9106
9120
|
|
|
9107
|
-
let PointerEvent = class PointerEvent extends UIEvent {
|
|
9121
|
+
let PointerEvent$1 = class PointerEvent extends UIEvent {
|
|
9108
9122
|
};
|
|
9109
|
-
PointerEvent.POINTER = 'pointer';
|
|
9110
|
-
PointerEvent.BEFORE_DOWN = 'pointer.before_down';
|
|
9111
|
-
PointerEvent.BEFORE_MOVE = 'pointer.before_move';
|
|
9112
|
-
PointerEvent.BEFORE_UP = 'pointer.before_up';
|
|
9113
|
-
PointerEvent.DOWN = 'pointer.down';
|
|
9114
|
-
PointerEvent.MOVE = 'pointer.move';
|
|
9115
|
-
PointerEvent.UP = 'pointer.up';
|
|
9116
|
-
PointerEvent.OVER = 'pointer.over';
|
|
9117
|
-
PointerEvent.OUT = 'pointer.out';
|
|
9118
|
-
PointerEvent.ENTER = 'pointer.enter';
|
|
9119
|
-
PointerEvent.LEAVE = 'pointer.leave';
|
|
9120
|
-
PointerEvent.TAP = 'tap';
|
|
9121
|
-
PointerEvent.DOUBLE_TAP = 'double_tap';
|
|
9122
|
-
PointerEvent.CLICK = 'click';
|
|
9123
|
-
PointerEvent.DOUBLE_CLICK = 'double_click';
|
|
9124
|
-
PointerEvent.LONG_PRESS = 'long_press';
|
|
9125
|
-
PointerEvent.LONG_TAP = 'long_tap';
|
|
9126
|
-
PointerEvent.MENU = 'pointer.menu';
|
|
9127
|
-
PointerEvent.MENU_TAP = 'pointer.menu_tap';
|
|
9128
|
-
PointerEvent = __decorate([
|
|
9123
|
+
PointerEvent$1.POINTER = 'pointer';
|
|
9124
|
+
PointerEvent$1.BEFORE_DOWN = 'pointer.before_down';
|
|
9125
|
+
PointerEvent$1.BEFORE_MOVE = 'pointer.before_move';
|
|
9126
|
+
PointerEvent$1.BEFORE_UP = 'pointer.before_up';
|
|
9127
|
+
PointerEvent$1.DOWN = 'pointer.down';
|
|
9128
|
+
PointerEvent$1.MOVE = 'pointer.move';
|
|
9129
|
+
PointerEvent$1.UP = 'pointer.up';
|
|
9130
|
+
PointerEvent$1.OVER = 'pointer.over';
|
|
9131
|
+
PointerEvent$1.OUT = 'pointer.out';
|
|
9132
|
+
PointerEvent$1.ENTER = 'pointer.enter';
|
|
9133
|
+
PointerEvent$1.LEAVE = 'pointer.leave';
|
|
9134
|
+
PointerEvent$1.TAP = 'tap';
|
|
9135
|
+
PointerEvent$1.DOUBLE_TAP = 'double_tap';
|
|
9136
|
+
PointerEvent$1.CLICK = 'click';
|
|
9137
|
+
PointerEvent$1.DOUBLE_CLICK = 'double_click';
|
|
9138
|
+
PointerEvent$1.LONG_PRESS = 'long_press';
|
|
9139
|
+
PointerEvent$1.LONG_TAP = 'long_tap';
|
|
9140
|
+
PointerEvent$1.MENU = 'pointer.menu';
|
|
9141
|
+
PointerEvent$1.MENU_TAP = 'pointer.menu_tap';
|
|
9142
|
+
PointerEvent$1 = __decorate([
|
|
9129
9143
|
registerUIEvent()
|
|
9130
|
-
], PointerEvent);
|
|
9131
|
-
const MyPointerEvent = PointerEvent;
|
|
9144
|
+
], PointerEvent$1);
|
|
9145
|
+
const MyPointerEvent = PointerEvent$1;
|
|
9132
9146
|
|
|
9133
9147
|
const tempMove = {};
|
|
9134
|
-
let DragEvent = class DragEvent extends PointerEvent {
|
|
9148
|
+
let DragEvent$1 = class DragEvent extends PointerEvent$1 {
|
|
9135
9149
|
static setList(data) {
|
|
9136
9150
|
this.list = data instanceof LeafList ? data : new LeafList(data);
|
|
9137
9151
|
}
|
|
@@ -9212,25 +9226,25 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
9212
9226
|
tempMove.y = total ? this.totalY : this.moveY;
|
|
9213
9227
|
}
|
|
9214
9228
|
};
|
|
9215
|
-
DragEvent.BEFORE_DRAG = 'drag.before_drag';
|
|
9216
|
-
DragEvent.START = 'drag.start';
|
|
9217
|
-
DragEvent.DRAG = 'drag';
|
|
9218
|
-
DragEvent.END = 'drag.end';
|
|
9219
|
-
DragEvent.OVER = 'drag.over';
|
|
9220
|
-
DragEvent.OUT = 'drag.out';
|
|
9221
|
-
DragEvent.ENTER = 'drag.enter';
|
|
9222
|
-
DragEvent.LEAVE = 'drag.leave';
|
|
9223
|
-
DragEvent = __decorate([
|
|
9229
|
+
DragEvent$1.BEFORE_DRAG = 'drag.before_drag';
|
|
9230
|
+
DragEvent$1.START = 'drag.start';
|
|
9231
|
+
DragEvent$1.DRAG = 'drag';
|
|
9232
|
+
DragEvent$1.END = 'drag.end';
|
|
9233
|
+
DragEvent$1.OVER = 'drag.over';
|
|
9234
|
+
DragEvent$1.OUT = 'drag.out';
|
|
9235
|
+
DragEvent$1.ENTER = 'drag.enter';
|
|
9236
|
+
DragEvent$1.LEAVE = 'drag.leave';
|
|
9237
|
+
DragEvent$1 = __decorate([
|
|
9224
9238
|
registerUIEvent()
|
|
9225
|
-
], DragEvent);
|
|
9226
|
-
const MyDragEvent = DragEvent;
|
|
9239
|
+
], DragEvent$1);
|
|
9240
|
+
const MyDragEvent = DragEvent$1;
|
|
9227
9241
|
|
|
9228
|
-
let DropEvent = class DropEvent extends PointerEvent {
|
|
9242
|
+
let DropEvent = class DropEvent extends PointerEvent$1 {
|
|
9229
9243
|
static setList(data) {
|
|
9230
|
-
DragEvent.setList(data);
|
|
9244
|
+
DragEvent$1.setList(data);
|
|
9231
9245
|
}
|
|
9232
9246
|
static setData(data) {
|
|
9233
|
-
DragEvent.setData(data);
|
|
9247
|
+
DragEvent$1.setData(data);
|
|
9234
9248
|
}
|
|
9235
9249
|
};
|
|
9236
9250
|
DropEvent.DROP = 'drop';
|
|
@@ -9238,7 +9252,7 @@ DropEvent = __decorate([
|
|
|
9238
9252
|
registerUIEvent()
|
|
9239
9253
|
], DropEvent);
|
|
9240
9254
|
|
|
9241
|
-
let MoveEvent = class MoveEvent extends DragEvent {
|
|
9255
|
+
let MoveEvent = class MoveEvent extends DragEvent$1 {
|
|
9242
9256
|
};
|
|
9243
9257
|
MoveEvent.BEFORE_MOVE = 'move.before_move';
|
|
9244
9258
|
MoveEvent.START = 'move.start';
|
|
@@ -9258,7 +9272,7 @@ RotateEvent = __decorate([
|
|
|
9258
9272
|
registerUIEvent()
|
|
9259
9273
|
], RotateEvent);
|
|
9260
9274
|
|
|
9261
|
-
let SwipeEvent = class SwipeEvent extends DragEvent {
|
|
9275
|
+
let SwipeEvent = class SwipeEvent extends DragEvent$1 {
|
|
9262
9276
|
};
|
|
9263
9277
|
SwipeEvent.SWIPE = 'swipe';
|
|
9264
9278
|
SwipeEvent.LEFT = 'swipe.left';
|
|
@@ -9338,7 +9352,7 @@ const InteractionHelper = {
|
|
|
9338
9352
|
return find;
|
|
9339
9353
|
},
|
|
9340
9354
|
pathCanDrag(path) {
|
|
9341
|
-
return path && path.list.some(item => item.draggable || item.editable || (!item.isLeafer && item.hasEvent(DragEvent.DRAG)));
|
|
9355
|
+
return path && path.list.some(item => item.draggable || item.editable || (!item.isLeafer && item.hasEvent(DragEvent$1.DRAG)));
|
|
9342
9356
|
},
|
|
9343
9357
|
pathHasOutside(path) {
|
|
9344
9358
|
return path && path.list.some(item => item.isOutside);
|
|
@@ -9361,7 +9375,7 @@ class Dragger {
|
|
|
9361
9375
|
}
|
|
9362
9376
|
getList(realDraggable, hover) {
|
|
9363
9377
|
const { proxy } = this.interaction.selector;
|
|
9364
|
-
const hasProxyList = proxy && proxy.list.length, dragList = DragEvent.list || this.draggableList || emptyList;
|
|
9378
|
+
const hasProxyList = proxy && proxy.list.length, dragList = DragEvent$1.list || this.draggableList || emptyList;
|
|
9365
9379
|
return this.dragging && (hasProxyList ? (realDraggable ? emptyList : new LeafList(hover ? [...proxy.list, ...proxy.dragHoverExclude] : proxy.list)) : dragList);
|
|
9366
9380
|
}
|
|
9367
9381
|
checkDrag(data, canDrag) {
|
|
@@ -9385,7 +9399,7 @@ class Dragger {
|
|
|
9385
9399
|
if (!this.dragging) {
|
|
9386
9400
|
this.dragging = canDrag && PointerButton.left(data);
|
|
9387
9401
|
if (this.dragging) {
|
|
9388
|
-
this.interaction.emit(DragEvent.START, this.dragData);
|
|
9402
|
+
this.interaction.emit(DragEvent$1.START, this.dragData);
|
|
9389
9403
|
this.getDraggableList(this.dragData.path);
|
|
9390
9404
|
this.setDragStartPoints(this.realDraggableList = this.getList(true));
|
|
9391
9405
|
}
|
|
@@ -9419,8 +9433,8 @@ class Dragger {
|
|
|
9419
9433
|
}
|
|
9420
9434
|
else if (this.dragging) {
|
|
9421
9435
|
this.dragReal();
|
|
9422
|
-
interaction.emit(DragEvent.BEFORE_DRAG, this.dragData);
|
|
9423
|
-
interaction.emit(DragEvent.DRAG, this.dragData);
|
|
9436
|
+
interaction.emit(DragEvent$1.BEFORE_DRAG, this.dragData);
|
|
9437
|
+
interaction.emit(DragEvent$1.DRAG, this.dragData);
|
|
9424
9438
|
}
|
|
9425
9439
|
}
|
|
9426
9440
|
dragReal() {
|
|
@@ -9428,7 +9442,7 @@ class Dragger {
|
|
|
9428
9442
|
const list = this.realDraggableList;
|
|
9429
9443
|
if (list.length && running) {
|
|
9430
9444
|
const { totalX, totalY } = this.dragData;
|
|
9431
|
-
list.forEach(leaf => leaf.draggable && leaf.move(DragEvent.getValidMove(leaf, this.dragStartPoints[leaf.innerId], { x: totalX, y: totalY })));
|
|
9445
|
+
list.forEach(leaf => leaf.draggable && leaf.move(DragEvent$1.getValidMove(leaf, this.dragStartPoints[leaf.innerId], { x: totalX, y: totalY })));
|
|
9432
9446
|
}
|
|
9433
9447
|
}
|
|
9434
9448
|
dragOverOrOut(data) {
|
|
@@ -9438,19 +9452,19 @@ class Dragger {
|
|
|
9438
9452
|
this.dragOverPath = path;
|
|
9439
9453
|
if (dragOverPath) {
|
|
9440
9454
|
if (path.indexAt(0) !== dragOverPath.indexAt(0)) {
|
|
9441
|
-
interaction.emit(DragEvent.OUT, data, dragOverPath);
|
|
9442
|
-
interaction.emit(DragEvent.OVER, data, path);
|
|
9455
|
+
interaction.emit(DragEvent$1.OUT, data, dragOverPath);
|
|
9456
|
+
interaction.emit(DragEvent$1.OVER, data, path);
|
|
9443
9457
|
}
|
|
9444
9458
|
}
|
|
9445
9459
|
else
|
|
9446
|
-
interaction.emit(DragEvent.OVER, data, path);
|
|
9460
|
+
interaction.emit(DragEvent$1.OVER, data, path);
|
|
9447
9461
|
}
|
|
9448
9462
|
dragEnterOrLeave(data) {
|
|
9449
9463
|
const { interaction } = this;
|
|
9450
9464
|
const { dragEnterPath } = this;
|
|
9451
9465
|
const { path } = data;
|
|
9452
|
-
interaction.emit(DragEvent.LEAVE, data, dragEnterPath, path);
|
|
9453
|
-
interaction.emit(DragEvent.ENTER, data, path, dragEnterPath);
|
|
9466
|
+
interaction.emit(DragEvent$1.LEAVE, data, dragEnterPath, path);
|
|
9467
|
+
interaction.emit(DragEvent$1.ENTER, data, path, dragEnterPath);
|
|
9454
9468
|
this.dragEnterPath = path;
|
|
9455
9469
|
}
|
|
9456
9470
|
dragEnd(data, speed) {
|
|
@@ -9477,7 +9491,7 @@ class Dragger {
|
|
|
9477
9491
|
if (this.dragging) {
|
|
9478
9492
|
const dropList = this.getList();
|
|
9479
9493
|
this.dragging = false;
|
|
9480
|
-
interaction.emit(DragEvent.END, endDragData);
|
|
9494
|
+
interaction.emit(DragEvent$1.END, endDragData);
|
|
9481
9495
|
this.swipe(data, downData, dragData, endDragData);
|
|
9482
9496
|
this.drop(data, dropList, this.dragEnterPath);
|
|
9483
9497
|
}
|
|
@@ -9493,13 +9507,13 @@ class Dragger {
|
|
|
9493
9507
|
}
|
|
9494
9508
|
}
|
|
9495
9509
|
drop(data, dropList, dragEnterPath) {
|
|
9496
|
-
const dropData = getDropEventData(data, dropList, DragEvent.data);
|
|
9510
|
+
const dropData = getDropEventData(data, dropList, DragEvent$1.data);
|
|
9497
9511
|
dropData.path = dragEnterPath;
|
|
9498
9512
|
this.interaction.emit(DropEvent.DROP, dropData);
|
|
9499
|
-
this.interaction.emit(DragEvent.LEAVE, data, dragEnterPath);
|
|
9513
|
+
this.interaction.emit(DragEvent$1.LEAVE, data, dragEnterPath);
|
|
9500
9514
|
}
|
|
9501
9515
|
dragReset() {
|
|
9502
|
-
DragEvent.list = DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
|
|
9516
|
+
DragEvent$1.list = DragEvent$1.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null;
|
|
9503
9517
|
}
|
|
9504
9518
|
checkDragEndAnimate(_data, _speed) { return false; }
|
|
9505
9519
|
animate(_func, _off) { }
|
|
@@ -9646,8 +9660,8 @@ class InteractionBase {
|
|
|
9646
9660
|
this.updateDownData(data);
|
|
9647
9661
|
this.checkPath(data, useDefaultPath);
|
|
9648
9662
|
this.downTime = Date.now();
|
|
9649
|
-
this.emit(PointerEvent.BEFORE_DOWN, data);
|
|
9650
|
-
this.emit(PointerEvent.DOWN, data);
|
|
9663
|
+
this.emit(PointerEvent$1.BEFORE_DOWN, data);
|
|
9664
|
+
this.emit(PointerEvent$1.DOWN, data);
|
|
9651
9665
|
if (PointerButton.left(data)) {
|
|
9652
9666
|
this.tapWait();
|
|
9653
9667
|
this.longPressWait(data);
|
|
@@ -9674,7 +9688,7 @@ class InteractionBase {
|
|
|
9674
9688
|
}
|
|
9675
9689
|
pointerMoveReal(data) {
|
|
9676
9690
|
const { dragHover, dragDistance } = this.p;
|
|
9677
|
-
this.emit(PointerEvent.BEFORE_MOVE, data, this.defaultPath);
|
|
9691
|
+
this.emit(PointerEvent$1.BEFORE_MOVE, data, this.defaultPath);
|
|
9678
9692
|
if (this.downData) {
|
|
9679
9693
|
const canDrag = PointHelper.getDistance(this.downData, data) > dragDistance;
|
|
9680
9694
|
if (canDrag) {
|
|
@@ -9687,7 +9701,7 @@ class InteractionBase {
|
|
|
9687
9701
|
if (!this.dragger.moving) {
|
|
9688
9702
|
this.updateHoverData(data);
|
|
9689
9703
|
this.checkPath(data);
|
|
9690
|
-
this.emit(PointerEvent.MOVE, data);
|
|
9704
|
+
this.emit(PointerEvent$1.MOVE, data);
|
|
9691
9705
|
if (!(this.dragging && !dragHover))
|
|
9692
9706
|
this.pointerHover(data);
|
|
9693
9707
|
if (this.dragger.dragging) {
|
|
@@ -9710,8 +9724,8 @@ class InteractionBase {
|
|
|
9710
9724
|
data.path.addList(downData.path.list);
|
|
9711
9725
|
this.checkPath(data);
|
|
9712
9726
|
this.downData = null;
|
|
9713
|
-
this.emit(PointerEvent.BEFORE_UP, data);
|
|
9714
|
-
this.emit(PointerEvent.UP, data);
|
|
9727
|
+
this.emit(PointerEvent$1.BEFORE_UP, data);
|
|
9728
|
+
this.emit(PointerEvent$1.UP, data);
|
|
9715
9729
|
this.touchLeave(data);
|
|
9716
9730
|
if (!data.isCancel) {
|
|
9717
9731
|
this.tap(data);
|
|
@@ -9727,14 +9741,14 @@ class InteractionBase {
|
|
|
9727
9741
|
}
|
|
9728
9742
|
menu(data) {
|
|
9729
9743
|
this.findPath(data);
|
|
9730
|
-
this.emit(PointerEvent.MENU, data);
|
|
9744
|
+
this.emit(PointerEvent$1.MENU, data);
|
|
9731
9745
|
this.waitMenuTap = true;
|
|
9732
9746
|
if (!this.downData && this.waitRightTap)
|
|
9733
9747
|
this.menuTap(data);
|
|
9734
9748
|
}
|
|
9735
9749
|
menuTap(data) {
|
|
9736
9750
|
if (this.waitRightTap && this.waitMenuTap) {
|
|
9737
|
-
this.emit(PointerEvent.MENU_TAP, data);
|
|
9751
|
+
this.emit(PointerEvent$1.MENU_TAP, data);
|
|
9738
9752
|
this.waitRightTap = this.waitMenuTap = false;
|
|
9739
9753
|
}
|
|
9740
9754
|
}
|
|
@@ -9782,12 +9796,12 @@ class InteractionBase {
|
|
|
9782
9796
|
this.overPath = path;
|
|
9783
9797
|
if (overPath) {
|
|
9784
9798
|
if (path.indexAt(0) !== overPath.indexAt(0)) {
|
|
9785
|
-
this.emit(PointerEvent.OUT, data, overPath);
|
|
9786
|
-
this.emit(PointerEvent.OVER, data, path);
|
|
9799
|
+
this.emit(PointerEvent$1.OUT, data, overPath);
|
|
9800
|
+
this.emit(PointerEvent$1.OVER, data, path);
|
|
9787
9801
|
}
|
|
9788
9802
|
}
|
|
9789
9803
|
else {
|
|
9790
|
-
this.emit(PointerEvent.OVER, data, path);
|
|
9804
|
+
this.emit(PointerEvent$1.OVER, data, path);
|
|
9791
9805
|
}
|
|
9792
9806
|
}
|
|
9793
9807
|
pointerEnterOrLeave(data) {
|
|
@@ -9798,13 +9812,13 @@ class InteractionBase {
|
|
|
9798
9812
|
}
|
|
9799
9813
|
const { enterPath } = this;
|
|
9800
9814
|
this.enterPath = path;
|
|
9801
|
-
this.emit(PointerEvent.LEAVE, data, enterPath, path);
|
|
9802
|
-
this.emit(PointerEvent.ENTER, data, path, enterPath);
|
|
9815
|
+
this.emit(PointerEvent$1.LEAVE, data, enterPath, path);
|
|
9816
|
+
this.emit(PointerEvent$1.ENTER, data, path, enterPath);
|
|
9803
9817
|
}
|
|
9804
9818
|
touchLeave(data) {
|
|
9805
9819
|
if (data.pointerType === 'touch') {
|
|
9806
9820
|
if (this.enterPath) {
|
|
9807
|
-
this.emit(PointerEvent.LEAVE, data);
|
|
9821
|
+
this.emit(PointerEvent$1.LEAVE, data);
|
|
9808
9822
|
if (this.dragger.dragging)
|
|
9809
9823
|
this.emit(DropEvent.LEAVE, data);
|
|
9810
9824
|
}
|
|
@@ -9820,7 +9834,7 @@ class InteractionBase {
|
|
|
9820
9834
|
if (pointer.tapMore)
|
|
9821
9835
|
this.emitTap(data);
|
|
9822
9836
|
const useTime = Date.now() - this.downTime;
|
|
9823
|
-
const hasDouble = [PointerEvent.DOUBLE_TAP, PointerEvent.DOUBLE_CLICK].some(type => pathHasEventType(data.path, type));
|
|
9837
|
+
const hasDouble = [PointerEvent$1.DOUBLE_TAP, PointerEvent$1.DOUBLE_CLICK].some(type => pathHasEventType(data.path, type));
|
|
9824
9838
|
if (useTime < pointer.tapTime + 50 && hasDouble) {
|
|
9825
9839
|
this.tapCount++;
|
|
9826
9840
|
if (this.tapCount === 2) {
|
|
@@ -9904,7 +9918,7 @@ class InteractionBase {
|
|
|
9904
9918
|
data = this.hoverData;
|
|
9905
9919
|
if (!data)
|
|
9906
9920
|
return;
|
|
9907
|
-
this.findPath(data, { exclude: this.dragger.getList(false, true), name: PointerEvent.MOVE });
|
|
9921
|
+
this.findPath(data, { exclude: this.dragger.getList(false, true), name: PointerEvent$1.MOVE });
|
|
9908
9922
|
this.hoverData = data;
|
|
9909
9923
|
}
|
|
9910
9924
|
updateCursor(data) {
|
|
@@ -9940,12 +9954,12 @@ class InteractionBase {
|
|
|
9940
9954
|
return { x: clientPoint.clientX - clientBounds.x, y: clientPoint.clientY - clientBounds.y };
|
|
9941
9955
|
}
|
|
9942
9956
|
emitTap(data) {
|
|
9943
|
-
this.emit(PointerEvent.TAP, data);
|
|
9944
|
-
this.emit(PointerEvent.CLICK, data);
|
|
9957
|
+
this.emit(PointerEvent$1.TAP, data);
|
|
9958
|
+
this.emit(PointerEvent$1.CLICK, data);
|
|
9945
9959
|
}
|
|
9946
9960
|
emitDoubleTap(data) {
|
|
9947
|
-
this.emit(PointerEvent.DOUBLE_TAP, data);
|
|
9948
|
-
this.emit(PointerEvent.DOUBLE_CLICK, data);
|
|
9961
|
+
this.emit(PointerEvent$1.DOUBLE_TAP, data);
|
|
9962
|
+
this.emit(PointerEvent$1.DOUBLE_CLICK, data);
|
|
9949
9963
|
}
|
|
9950
9964
|
pointerWaitCancel() {
|
|
9951
9965
|
this.tapWaitCancel();
|
|
@@ -9964,14 +9978,14 @@ class InteractionBase {
|
|
|
9964
9978
|
clearTimeout(this.longPressTimer);
|
|
9965
9979
|
this.longPressTimer = setTimeout(() => {
|
|
9966
9980
|
this.longPressed = true;
|
|
9967
|
-
this.emit(PointerEvent.LONG_PRESS, data);
|
|
9981
|
+
this.emit(PointerEvent$1.LONG_PRESS, data);
|
|
9968
9982
|
}, this.p.longPressTime);
|
|
9969
9983
|
}
|
|
9970
9984
|
longTap(data) {
|
|
9971
9985
|
let hasLong;
|
|
9972
9986
|
if (this.longPressed) {
|
|
9973
|
-
this.emit(PointerEvent.LONG_TAP, data);
|
|
9974
|
-
if (pathHasEventType(data.path, PointerEvent.LONG_TAP) || pathHasEventType(data.path, PointerEvent.LONG_PRESS))
|
|
9987
|
+
this.emit(PointerEvent$1.LONG_TAP, data);
|
|
9988
|
+
if (pathHasEventType(data.path, PointerEvent$1.LONG_TAP) || pathHasEventType(data.path, PointerEvent$1.LONG_PRESS))
|
|
9975
9989
|
hasLong = true;
|
|
9976
9990
|
}
|
|
9977
9991
|
this.longPressWaitCancel();
|
|
@@ -11726,7 +11740,7 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
11726
11740
|
rows.forEach(row => {
|
|
11727
11741
|
if (row.words) {
|
|
11728
11742
|
indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
|
|
11729
|
-
addWordWidth = (width && textAlign === 'justify' && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
|
|
11743
|
+
addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
|
|
11730
11744
|
mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
|
|
11731
11745
|
if (row.isOverflow && !letterSpacing)
|
|
11732
11746
|
row.textMode = true;
|
|
@@ -11748,7 +11762,7 @@ function layoutChar(drawData, style, width, _height) {
|
|
|
11748
11762
|
else {
|
|
11749
11763
|
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
11750
11764
|
}
|
|
11751
|
-
if (!row.paraEnd
|
|
11765
|
+
if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
|
|
11752
11766
|
charX += addWordWidth;
|
|
11753
11767
|
row.width += addWordWidth;
|
|
11754
11768
|
}
|
|
@@ -12223,7 +12237,9 @@ function updateStyle(leaf, style, type) {
|
|
|
12223
12237
|
type = null;
|
|
12224
12238
|
let transition = type ? getTransition(type, style, leaf) : false;
|
|
12225
12239
|
const fromStyle = transition ? getFromStyle(leaf, style) : undefined;
|
|
12226
|
-
|
|
12240
|
+
const nextStyle = State.canAnimate && getStyle(leaf);
|
|
12241
|
+
if (nextStyle)
|
|
12242
|
+
leaf.killAnimate('transition');
|
|
12227
12243
|
if (normalStyle)
|
|
12228
12244
|
leaf.set(normalStyle, 'temp');
|
|
12229
12245
|
const statesStyle = getStyle(leaf);
|
|
@@ -12384,16 +12400,16 @@ function unsetChildrenState(children, stateType, state) {
|
|
|
12384
12400
|
|
|
12385
12401
|
function updateEventStyle(leaf, eventType) {
|
|
12386
12402
|
switch (eventType) {
|
|
12387
|
-
case PointerEvent.ENTER:
|
|
12403
|
+
case PointerEvent$1.ENTER:
|
|
12388
12404
|
setPointerState(leaf, 'hoverStyle');
|
|
12389
12405
|
break;
|
|
12390
|
-
case PointerEvent.LEAVE:
|
|
12406
|
+
case PointerEvent$1.LEAVE:
|
|
12391
12407
|
unsetPointerState(leaf, 'hoverStyle');
|
|
12392
12408
|
break;
|
|
12393
|
-
case PointerEvent.DOWN:
|
|
12409
|
+
case PointerEvent$1.DOWN:
|
|
12394
12410
|
setPointerState(leaf, 'pressStyle');
|
|
12395
12411
|
break;
|
|
12396
|
-
case PointerEvent.UP:
|
|
12412
|
+
case PointerEvent$1.UP:
|
|
12397
12413
|
unsetPointerState(leaf, 'pressStyle');
|
|
12398
12414
|
break;
|
|
12399
12415
|
}
|
|
@@ -12596,8 +12612,11 @@ function animationType(defaultValue) {
|
|
|
12596
12612
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
12597
12613
|
set(value) {
|
|
12598
12614
|
this.__setAttr(key, value);
|
|
12599
|
-
if (this.leafer)
|
|
12600
|
-
|
|
12615
|
+
if (this.leafer) {
|
|
12616
|
+
this.killAnimate('animation');
|
|
12617
|
+
if (value)
|
|
12618
|
+
this.animate(value, undefined, 'animation');
|
|
12619
|
+
}
|
|
12601
12620
|
}
|
|
12602
12621
|
}));
|
|
12603
12622
|
}
|
|
@@ -12634,6 +12653,7 @@ let Animate = class Animate extends Eventer {
|
|
|
12634
12653
|
get completed() { return this.time >= this.duration && !this.started; }
|
|
12635
12654
|
get frame() { return this.frames[this.nowIndex]; }
|
|
12636
12655
|
get frameTotalTime() { return this.frame.totalTime || this.frame.duration || 0; }
|
|
12656
|
+
get nowReverse() { return (this.mainReverse ? 1 : 0) + (this.frameReverse ? 1 : 0) === 1; }
|
|
12637
12657
|
get realEnding() {
|
|
12638
12658
|
let count;
|
|
12639
12659
|
const { ending, reverse, loop } = this;
|
|
@@ -12650,6 +12670,12 @@ let Animate = class Animate extends Eventer {
|
|
|
12650
12670
|
}
|
|
12651
12671
|
constructor(target, keyframe, options, isTemp) {
|
|
12652
12672
|
super();
|
|
12673
|
+
if (keyframe) {
|
|
12674
|
+
if (keyframe.keyframes)
|
|
12675
|
+
options = keyframe, keyframe = keyframe.keyframes;
|
|
12676
|
+
else if (keyframe.style)
|
|
12677
|
+
options = keyframe, keyframe = keyframe.style;
|
|
12678
|
+
}
|
|
12653
12679
|
this.init(target, keyframe, options, isTemp);
|
|
12654
12680
|
}
|
|
12655
12681
|
init(target, keyframe, options, isTemp) {
|
|
@@ -12665,16 +12691,14 @@ let Animate = class Animate extends Eventer {
|
|
|
12665
12691
|
break;
|
|
12666
12692
|
case 'object': this.config = options, options.event && (this.event = options.event);
|
|
12667
12693
|
}
|
|
12668
|
-
|
|
12669
|
-
return;
|
|
12670
|
-
this.keyframes = keyframe instanceof Array ? keyframe : [keyframe];
|
|
12694
|
+
this.keyframes = keyframe instanceof Array ? keyframe : (keyframe ? [keyframe] : []);
|
|
12671
12695
|
const { easing, attrs } = this;
|
|
12672
12696
|
this.easingFn = AnimateEasing.get(easing);
|
|
12673
12697
|
if (attrs || this.attrsMap)
|
|
12674
12698
|
this.attrsMap = attrs ? attrs.reduce((map, value) => { map[value] = true; return map; }, {}) : undefined;
|
|
12675
12699
|
this.frames = [];
|
|
12676
12700
|
this.create();
|
|
12677
|
-
if (this.autoplay)
|
|
12701
|
+
if (this.autoplay && this.frames.length)
|
|
12678
12702
|
this.timer = setTimeout(() => {
|
|
12679
12703
|
this.timer = 0;
|
|
12680
12704
|
this.play();
|
|
@@ -12723,7 +12747,7 @@ let Animate = class Animate extends Eventer {
|
|
|
12723
12747
|
}
|
|
12724
12748
|
create() {
|
|
12725
12749
|
const { target, frames, keyframes, config } = this, { length } = keyframes, joinBefore = length > 1 ? this.join : true;
|
|
12726
|
-
let
|
|
12750
|
+
let totalTime = 0, totalAutoTime = 0, before, keyframe, item, style, times;
|
|
12727
12751
|
if (length > 1)
|
|
12728
12752
|
this.fromStyle = {}, this.toStyle = {};
|
|
12729
12753
|
for (let i = 0; i < length; i++) {
|
|
@@ -12732,27 +12756,32 @@ let Animate = class Animate extends Eventer {
|
|
|
12732
12756
|
if (!before)
|
|
12733
12757
|
before = joinBefore ? target : style;
|
|
12734
12758
|
item = { style, beforeStyle: {} };
|
|
12759
|
+
times = 1;
|
|
12735
12760
|
if (keyframe.style) {
|
|
12736
|
-
const { duration, autoDuration, delay, autoDelay, easing } = keyframe;
|
|
12761
|
+
const { duration, autoDuration, delay, autoDelay, easing, swing, loop } = keyframe;
|
|
12762
|
+
if (swing)
|
|
12763
|
+
item.swing = typeof swing === 'number' ? swing : 2, times = item.swing * 2 - 1;
|
|
12764
|
+
if (loop)
|
|
12765
|
+
item.loop = times = typeof loop === 'number' ? loop : 2;
|
|
12737
12766
|
if (duration) {
|
|
12738
|
-
item.duration = duration,
|
|
12767
|
+
item.duration = duration, totalTime += duration * times;
|
|
12739
12768
|
if (delay)
|
|
12740
12769
|
item.totalTime = duration + delay;
|
|
12741
12770
|
}
|
|
12742
12771
|
else {
|
|
12743
12772
|
if (autoDuration)
|
|
12744
|
-
item.autoDuration = autoDuration,
|
|
12773
|
+
item.autoDuration = autoDuration, totalAutoTime += autoDuration * times;
|
|
12745
12774
|
}
|
|
12746
12775
|
if (delay)
|
|
12747
|
-
item.delay = delay,
|
|
12776
|
+
item.delay = delay, totalTime += delay * times;
|
|
12748
12777
|
else if (autoDelay)
|
|
12749
|
-
item.autoDelay = autoDelay,
|
|
12778
|
+
item.autoDelay = autoDelay, totalAutoTime += autoDelay * times;
|
|
12750
12779
|
if (easing)
|
|
12751
12780
|
item.easingFn = AnimateEasing.get(easing);
|
|
12752
12781
|
}
|
|
12753
12782
|
if (!item.autoDuration && item.duration === undefined) {
|
|
12754
12783
|
if (length > 1)
|
|
12755
|
-
(i > 0 || joinBefore) ?
|
|
12784
|
+
(i > 0 || joinBefore) ? totalAutoTime += times : item.duration = 0;
|
|
12756
12785
|
else
|
|
12757
12786
|
item.duration = this.duration;
|
|
12758
12787
|
}
|
|
@@ -12768,14 +12797,14 @@ let Animate = class Animate extends Eventer {
|
|
|
12768
12797
|
before = style;
|
|
12769
12798
|
frames.push(item);
|
|
12770
12799
|
}
|
|
12771
|
-
if (
|
|
12772
|
-
if (this.duration <=
|
|
12773
|
-
this.changeDuration(
|
|
12774
|
-
this.allocateTime((this.duration -
|
|
12800
|
+
if (totalAutoTime) {
|
|
12801
|
+
if (this.duration <= totalTime || !(config && config.duration))
|
|
12802
|
+
this.changeDuration(totalTime + frameDuration * totalAutoTime);
|
|
12803
|
+
this.allocateTime((this.duration - totalTime) / totalAutoTime);
|
|
12775
12804
|
}
|
|
12776
12805
|
else {
|
|
12777
|
-
if (
|
|
12778
|
-
this.changeDuration(
|
|
12806
|
+
if (totalTime)
|
|
12807
|
+
this.changeDuration(totalTime);
|
|
12779
12808
|
}
|
|
12780
12809
|
this.emit(AnimateEvent.CREATED, this);
|
|
12781
12810
|
}
|
|
@@ -12802,7 +12831,7 @@ let Animate = class Animate extends Eventer {
|
|
|
12802
12831
|
if (frame.autoDelay)
|
|
12803
12832
|
frame.delay = frame.autoDelay * partTime;
|
|
12804
12833
|
if (frame.delay)
|
|
12805
|
-
frame.totalTime = frame.duration
|
|
12834
|
+
frame.totalTime = frame.duration + frame.delay;
|
|
12806
12835
|
}
|
|
12807
12836
|
}
|
|
12808
12837
|
}
|
|
@@ -12820,7 +12849,7 @@ let Animate = class Animate extends Eventer {
|
|
|
12820
12849
|
if (realTime < duration) {
|
|
12821
12850
|
while (realTime - this.playedTotalTime > this.frameTotalTime) {
|
|
12822
12851
|
this.transition(1);
|
|
12823
|
-
this.
|
|
12852
|
+
this.mainReverse ? this.reverseNextFrame() : this.nextFrame();
|
|
12824
12853
|
}
|
|
12825
12854
|
const itemDelay = this.nowReverse ? 0 : (this.frame.delay || 0);
|
|
12826
12855
|
const itemPlayedTime = realTime - this.playedTotalTime - itemDelay;
|
|
@@ -12844,9 +12873,9 @@ let Animate = class Animate extends Eventer {
|
|
|
12844
12873
|
const { loop, loopDelay, swing } = this;
|
|
12845
12874
|
if (loop !== false || swing) {
|
|
12846
12875
|
this.looped ? this.looped++ : this.looped = 1;
|
|
12847
|
-
if (
|
|
12876
|
+
if (this.needLoop(this.looped, loop, swing)) {
|
|
12848
12877
|
if (swing)
|
|
12849
|
-
this.
|
|
12878
|
+
this.mainReverse = !this.mainReverse;
|
|
12850
12879
|
if (loopDelay)
|
|
12851
12880
|
this.timer = setTimeout(() => { this.timer = 0, this.begin(); }, loopDelay / this.speed * 1000);
|
|
12852
12881
|
else
|
|
@@ -12861,8 +12890,8 @@ let Animate = class Animate extends Eventer {
|
|
|
12861
12890
|
start(seek) {
|
|
12862
12891
|
this.requestAnimateTime = 1;
|
|
12863
12892
|
const { reverse } = this;
|
|
12864
|
-
if (reverse || this.
|
|
12865
|
-
this.
|
|
12893
|
+
if (reverse || this.mainReverse)
|
|
12894
|
+
this.mainReverse = reverse;
|
|
12866
12895
|
if (this.looped)
|
|
12867
12896
|
this.looped = 0;
|
|
12868
12897
|
if (seek)
|
|
@@ -12880,12 +12909,12 @@ let Animate = class Animate extends Eventer {
|
|
|
12880
12909
|
}
|
|
12881
12910
|
begin(seek) {
|
|
12882
12911
|
this.playedTotalTime = this.time = 0;
|
|
12883
|
-
this.
|
|
12912
|
+
this.mainReverse ? this.setTo() : this.setFrom();
|
|
12884
12913
|
if (!seek)
|
|
12885
12914
|
this.requestAnimate();
|
|
12886
12915
|
}
|
|
12887
12916
|
end() {
|
|
12888
|
-
this.
|
|
12917
|
+
this.mainReverse ? this.setFrom() : this.setTo();
|
|
12889
12918
|
}
|
|
12890
12919
|
complete() {
|
|
12891
12920
|
this.requestAnimateTime = 0;
|
|
@@ -12908,15 +12937,19 @@ let Animate = class Animate extends Eventer {
|
|
|
12908
12937
|
this.setStyle(this.toStyle);
|
|
12909
12938
|
}
|
|
12910
12939
|
nextFrame() {
|
|
12940
|
+
if (this.needLoopFrame())
|
|
12941
|
+
return this.increaseTime();
|
|
12911
12942
|
if (this.nowIndex + 1 >= this.frames.length)
|
|
12912
12943
|
return;
|
|
12913
|
-
this.
|
|
12944
|
+
this.increaseTime();
|
|
12914
12945
|
this.nowIndex++;
|
|
12915
12946
|
}
|
|
12916
12947
|
reverseNextFrame() {
|
|
12948
|
+
if (this.needLoopFrame())
|
|
12949
|
+
return this.increaseTime();
|
|
12917
12950
|
if (this.nowIndex - 1 < 0)
|
|
12918
12951
|
return;
|
|
12919
|
-
this.
|
|
12952
|
+
this.increaseTime();
|
|
12920
12953
|
this.nowIndex--;
|
|
12921
12954
|
}
|
|
12922
12955
|
transition(t) {
|
|
@@ -12952,6 +12985,27 @@ let Animate = class Animate extends Eventer {
|
|
|
12952
12985
|
target.__ ? target.set(style, this.isTemp ? 'temp' : false) : Object.assign(target, style);
|
|
12953
12986
|
}
|
|
12954
12987
|
}
|
|
12988
|
+
increaseTime() {
|
|
12989
|
+
this.playedTotalTime += this.frameTotalTime;
|
|
12990
|
+
}
|
|
12991
|
+
needLoop(looped, loop, swing) {
|
|
12992
|
+
return !(this.needStopLoop(looped, loop) || this.needStopLoop(looped, swing, true));
|
|
12993
|
+
}
|
|
12994
|
+
needStopLoop(looped, times, swing) {
|
|
12995
|
+
return typeof times === 'number' && (!times || looped >= (swing ? times * 2 - 1 : times));
|
|
12996
|
+
}
|
|
12997
|
+
needLoopFrame() {
|
|
12998
|
+
const { loop, swing } = this.frame;
|
|
12999
|
+
if (loop || swing) {
|
|
13000
|
+
this.frameLooped ? this.frameLooped++ : this.frameLooped = 1;
|
|
13001
|
+
if (swing)
|
|
13002
|
+
this.frameReverse = !this.frameReverse;
|
|
13003
|
+
if (this.needLoop(this.frameLooped, loop, swing))
|
|
13004
|
+
return true;
|
|
13005
|
+
this.frameLooped = this.frameReverse = undefined;
|
|
13006
|
+
}
|
|
13007
|
+
return false;
|
|
13008
|
+
}
|
|
12955
13009
|
clearTimer(fn) {
|
|
12956
13010
|
if (this.timer) {
|
|
12957
13011
|
clearTimeout(this.timer), this.timer = 0;
|
|
@@ -13011,6 +13065,64 @@ Animate = __decorate([
|
|
|
13011
13065
|
useModule(LeafEventer)
|
|
13012
13066
|
], Animate);
|
|
13013
13067
|
|
|
13068
|
+
let AnimateList = class AnimateList extends Animate {
|
|
13069
|
+
get completed() { return this.list.every(item => item.completed); }
|
|
13070
|
+
get endingStyle() { return this._endingStyle; }
|
|
13071
|
+
constructor(target, animation, isTemp) {
|
|
13072
|
+
super(target, null);
|
|
13073
|
+
this.list = [];
|
|
13074
|
+
this.updateList(animation, isTemp);
|
|
13075
|
+
}
|
|
13076
|
+
updateList(animation, isTemp) {
|
|
13077
|
+
this.fromStyle = {};
|
|
13078
|
+
this.toStyle = {};
|
|
13079
|
+
this._endingStyle = {};
|
|
13080
|
+
if (!animation)
|
|
13081
|
+
animation = this.list.filter(item => {
|
|
13082
|
+
const { completed } = item;
|
|
13083
|
+
if (completed)
|
|
13084
|
+
item.destroy();
|
|
13085
|
+
return !completed;
|
|
13086
|
+
});
|
|
13087
|
+
this.list = animation.map(item => {
|
|
13088
|
+
const animate = item.target ? item : new Animate(this.target, item, isTemp);
|
|
13089
|
+
Object.assign(this.fromStyle, animate.fromStyle);
|
|
13090
|
+
Object.assign(this.toStyle, animate.toStyle);
|
|
13091
|
+
Object.assign(this._endingStyle, animate.endingStyle);
|
|
13092
|
+
return animate;
|
|
13093
|
+
});
|
|
13094
|
+
}
|
|
13095
|
+
play() {
|
|
13096
|
+
this.each(item => item.play());
|
|
13097
|
+
}
|
|
13098
|
+
pause() {
|
|
13099
|
+
this.each(item => item.pause());
|
|
13100
|
+
}
|
|
13101
|
+
stop() {
|
|
13102
|
+
this.each(item => item.stop());
|
|
13103
|
+
}
|
|
13104
|
+
seek(time) {
|
|
13105
|
+
this.each(item => item.seek(time));
|
|
13106
|
+
}
|
|
13107
|
+
kill(complete, killStyle) {
|
|
13108
|
+
this.each(item => item.kill(complete, killStyle));
|
|
13109
|
+
this.destroy();
|
|
13110
|
+
}
|
|
13111
|
+
each(func) {
|
|
13112
|
+
this.list.forEach(func);
|
|
13113
|
+
}
|
|
13114
|
+
destroy(complete) {
|
|
13115
|
+
const { list } = this;
|
|
13116
|
+
if (list.length) {
|
|
13117
|
+
this.each(item => item.destroy(complete));
|
|
13118
|
+
list.length = 0;
|
|
13119
|
+
}
|
|
13120
|
+
}
|
|
13121
|
+
};
|
|
13122
|
+
AnimateList = __decorate([
|
|
13123
|
+
useModule(LeafEventer)
|
|
13124
|
+
], AnimateList);
|
|
13125
|
+
|
|
13014
13126
|
const colorNames = {
|
|
13015
13127
|
transparent: 'FFF0',
|
|
13016
13128
|
aliceblue: 'F0F8FF',
|
|
@@ -13391,23 +13503,40 @@ dataType()(ui$2, 'transitionOut');
|
|
|
13391
13503
|
ui$2.animate = function (keyframe, options, kill, isTemp) {
|
|
13392
13504
|
if (keyframe === undefined)
|
|
13393
13505
|
return this.__animate;
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13506
|
+
const isAnimationList = keyframe instanceof Array && !options && kill;
|
|
13507
|
+
let nextAnimate = isAnimationList ? new AnimateList(this, keyframe, isTemp) : new Animate(this, keyframe, options, isTemp);
|
|
13508
|
+
this.killAnimate(kill, nextAnimate.toStyle);
|
|
13509
|
+
const animate = this.__animate;
|
|
13510
|
+
if (animate) {
|
|
13511
|
+
if (nextAnimate instanceof AnimateList)
|
|
13512
|
+
nextAnimate.list.unshift(animate);
|
|
13513
|
+
else
|
|
13514
|
+
nextAnimate = new AnimateList(this, [animate, nextAnimate]);
|
|
13515
|
+
}
|
|
13516
|
+
return this.__animate = nextAnimate;
|
|
13403
13517
|
};
|
|
13404
|
-
ui$2.killAnimate = function (_type,
|
|
13518
|
+
ui$2.killAnimate = function (_type, nextStyle) {
|
|
13405
13519
|
const animate = this.__animate;
|
|
13406
|
-
if (animate)
|
|
13407
|
-
|
|
13520
|
+
if (animate) {
|
|
13521
|
+
let kill = false;
|
|
13522
|
+
if (nextStyle && !animate.completed) {
|
|
13523
|
+
if (animate instanceof AnimateList)
|
|
13524
|
+
animate.updateList();
|
|
13525
|
+
const { toStyle } = animate;
|
|
13526
|
+
for (let key in nextStyle)
|
|
13527
|
+
if (key in toStyle) {
|
|
13528
|
+
kill = true;
|
|
13529
|
+
break;
|
|
13530
|
+
}
|
|
13531
|
+
}
|
|
13532
|
+
else
|
|
13533
|
+
kill = true;
|
|
13534
|
+
if (kill)
|
|
13535
|
+
animate.kill(true, nextStyle), this.__animate = null;
|
|
13536
|
+
}
|
|
13408
13537
|
};
|
|
13409
13538
|
ui$2.__runAnimation = function (type, complete) {
|
|
13410
|
-
this.animate(type === 'in' ? this.animation : this.animationOut);
|
|
13539
|
+
this.animate(type === 'in' ? this.animation : this.animationOut, undefined, 'animation');
|
|
13411
13540
|
if (complete)
|
|
13412
13541
|
this.__animate.on(AnimateEvent.COMPLETED, complete);
|
|
13413
13542
|
};
|
|
@@ -13901,4 +14030,4 @@ Creator.finder = function (target) {
|
|
|
13901
14030
|
return new Finder(target);
|
|
13902
14031
|
};
|
|
13903
14032
|
|
|
13904
|
-
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Finder, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Robot, RobotData, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$4 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
14033
|
+
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent$1 as DragEvent, Dragger, DropEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Finder, Frame, FrameData, Group, GroupData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image$1 as Image, ImageData, ImageEvent, ImageManager, IncrementId, Interaction, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, MoveEvent, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent$1 as PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Robot, RobotData, RotateEvent, Run, Selector, Star, StarData, State, StringNumberMap, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, ZoomEvent, affectRenderBoundsType, affectStrokeBoundsType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isNull, layoutProcessor, maskType, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$4 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|