leafer-game 1.3.0 → 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 +184 -54
- package/dist/web.min.js +1 -1
- package/dist/web.module.js +267 -137
- package/dist/web.module.min.js +1 -1
- package/package.json +10 -10
package/dist/web.js
CHANGED
|
@@ -6010,7 +6010,7 @@ var LeaferUI = (function (exports) {
|
|
|
6010
6010
|
}
|
|
6011
6011
|
}
|
|
6012
6012
|
|
|
6013
|
-
const version = "1.3.
|
|
6013
|
+
const version = "1.3.2";
|
|
6014
6014
|
|
|
6015
6015
|
const debug$5 = Debug.get('LeaferCanvas');
|
|
6016
6016
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6229,7 +6229,7 @@ var LeaferUI = (function (exports) {
|
|
|
6229
6229
|
},
|
|
6230
6230
|
loadImage(src) {
|
|
6231
6231
|
return new Promise((resolve, reject) => {
|
|
6232
|
-
const img = new Image();
|
|
6232
|
+
const img = new Platform.origin.Image();
|
|
6233
6233
|
const { crossOrigin } = Platform.image;
|
|
6234
6234
|
if (crossOrigin) {
|
|
6235
6235
|
img.setAttribute('crossOrigin', crossOrigin);
|
|
@@ -6239,7 +6239,10 @@ var LeaferUI = (function (exports) {
|
|
|
6239
6239
|
img.onerror = (e) => { reject(e); };
|
|
6240
6240
|
img.src = Platform.image.getRealURL(src);
|
|
6241
6241
|
});
|
|
6242
|
-
}
|
|
6242
|
+
},
|
|
6243
|
+
Image,
|
|
6244
|
+
PointerEvent,
|
|
6245
|
+
DragEvent
|
|
6243
6246
|
};
|
|
6244
6247
|
Platform.event = {
|
|
6245
6248
|
stopDefault(origin) { origin.preventDefault(); },
|
|
@@ -6715,7 +6718,7 @@ var LeaferUI = (function (exports) {
|
|
|
6715
6718
|
partRender() {
|
|
6716
6719
|
const { canvas, updateBlocks: list } = this;
|
|
6717
6720
|
if (!list)
|
|
6718
|
-
return
|
|
6721
|
+
return;
|
|
6719
6722
|
this.mergeBlocks();
|
|
6720
6723
|
list.forEach(block => { if (canvas.bounds.hit(block) && !block.isEmpty())
|
|
6721
6724
|
this.clipRender(block); });
|
|
@@ -7571,7 +7574,7 @@ var LeaferUI = (function (exports) {
|
|
|
7571
7574
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7572
7575
|
return Plugin.need('animate');
|
|
7573
7576
|
}
|
|
7574
|
-
killAnimate(_type,
|
|
7577
|
+
killAnimate(_type, _nextStyle) { }
|
|
7575
7578
|
export(_filename, _options) {
|
|
7576
7579
|
return Plugin.need('export');
|
|
7577
7580
|
}
|
|
@@ -8067,8 +8070,6 @@ var LeaferUI = (function (exports) {
|
|
|
8067
8070
|
this.created = true;
|
|
8068
8071
|
}
|
|
8069
8072
|
__onReady() {
|
|
8070
|
-
if (this.ready)
|
|
8071
|
-
return;
|
|
8072
8073
|
this.ready = true;
|
|
8073
8074
|
this.emitLeafer(LeaferEvent.BEFORE_READY);
|
|
8074
8075
|
this.emitLeafer(LeaferEvent.READY);
|
|
@@ -8082,6 +8083,20 @@ var LeaferUI = (function (exports) {
|
|
|
8082
8083
|
this.emitLeafer(LeaferEvent.VIEW_READY);
|
|
8083
8084
|
WaitHelper.run(this.__viewReadyWait);
|
|
8084
8085
|
}
|
|
8086
|
+
__onLayoutEnd() {
|
|
8087
|
+
const { grow, growWidth, growHeight } = this.config;
|
|
8088
|
+
if (grow) {
|
|
8089
|
+
let { width, height, pixelRatio } = this;
|
|
8090
|
+
const bounds = grow === 'box' ? this.worldBoxBounds : this.__world;
|
|
8091
|
+
if (growWidth !== false)
|
|
8092
|
+
width = Math.max(1, bounds.x + bounds.width);
|
|
8093
|
+
if (growHeight !== false)
|
|
8094
|
+
height = Math.max(1, bounds.y + bounds.height);
|
|
8095
|
+
this.__doResize({ width, height, pixelRatio });
|
|
8096
|
+
}
|
|
8097
|
+
if (!this.ready)
|
|
8098
|
+
this.__onReady();
|
|
8099
|
+
}
|
|
8085
8100
|
__onNextRender() {
|
|
8086
8101
|
if (this.viewReady) {
|
|
8087
8102
|
WaitHelper.run(this.__nextRenderWait);
|
|
@@ -8175,10 +8190,9 @@ var LeaferUI = (function (exports) {
|
|
|
8175
8190
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
8176
8191
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
8177
8192
|
this.once(LayoutEvent.START, () => this.updateLazyBounds());
|
|
8178
|
-
this.once(LayoutEvent.END, () => this.__onReady());
|
|
8179
8193
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
8180
8194
|
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
8181
|
-
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
|
|
8195
|
+
this.__eventIds.push(this.on_(WatchEvent.DATA, this.__onWatchData, this), this.on_(LayoutEvent.END, this.__onLayoutEnd, this), this.on_(RenderEvent.NEXT, this.__onNextRender, this));
|
|
8182
8196
|
}
|
|
8183
8197
|
__removeListenEvents() {
|
|
8184
8198
|
this.off_(this.__eventIds);
|
|
@@ -11729,7 +11743,7 @@ var LeaferUI = (function (exports) {
|
|
|
11729
11743
|
rows.forEach(row => {
|
|
11730
11744
|
if (row.words) {
|
|
11731
11745
|
indentWidth = paraIndent && row.paraStart ? paraIndent : 0;
|
|
11732
|
-
addWordWidth = (width && textAlign === 'justify' && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
|
|
11746
|
+
addWordWidth = (width && (textAlign === 'justify' || textAlign === 'both') && row.words.length > 1) ? (width - row.width - indentWidth) / (row.words.length - 1) : 0;
|
|
11733
11747
|
mode = (letterSpacing || row.isOverflow) ? CharMode : (addWordWidth > 0.01 ? WordMode : TextMode);
|
|
11734
11748
|
if (row.isOverflow && !letterSpacing)
|
|
11735
11749
|
row.textMode = true;
|
|
@@ -11751,7 +11765,7 @@ var LeaferUI = (function (exports) {
|
|
|
11751
11765
|
else {
|
|
11752
11766
|
charX = toChar(word.data, charX, row.data, row.isOverflow);
|
|
11753
11767
|
}
|
|
11754
|
-
if (!row.paraEnd
|
|
11768
|
+
if (addWordWidth && (!row.paraEnd || textAlign === 'both')) {
|
|
11755
11769
|
charX += addWordWidth;
|
|
11756
11770
|
row.width += addWordWidth;
|
|
11757
11771
|
}
|
|
@@ -12226,7 +12240,9 @@ var LeaferUI = (function (exports) {
|
|
|
12226
12240
|
type = null;
|
|
12227
12241
|
let transition = type ? getTransition(type, style, leaf) : false;
|
|
12228
12242
|
const fromStyle = transition ? getFromStyle(leaf, style) : undefined;
|
|
12229
|
-
|
|
12243
|
+
const nextStyle = State.canAnimate && getStyle(leaf);
|
|
12244
|
+
if (nextStyle)
|
|
12245
|
+
leaf.killAnimate('transition');
|
|
12230
12246
|
if (normalStyle)
|
|
12231
12247
|
leaf.set(normalStyle, 'temp');
|
|
12232
12248
|
const statesStyle = getStyle(leaf);
|
|
@@ -12599,8 +12615,11 @@ var LeaferUI = (function (exports) {
|
|
|
12599
12615
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
12600
12616
|
set(value) {
|
|
12601
12617
|
this.__setAttr(key, value);
|
|
12602
|
-
if (this.leafer)
|
|
12603
|
-
|
|
12618
|
+
if (this.leafer) {
|
|
12619
|
+
this.killAnimate('animation');
|
|
12620
|
+
if (value)
|
|
12621
|
+
this.animate(value, undefined, 'animation');
|
|
12622
|
+
}
|
|
12604
12623
|
}
|
|
12605
12624
|
}));
|
|
12606
12625
|
}
|
|
@@ -12637,6 +12656,7 @@ var LeaferUI = (function (exports) {
|
|
|
12637
12656
|
get completed() { return this.time >= this.duration && !this.started; }
|
|
12638
12657
|
get frame() { return this.frames[this.nowIndex]; }
|
|
12639
12658
|
get frameTotalTime() { return this.frame.totalTime || this.frame.duration || 0; }
|
|
12659
|
+
get nowReverse() { return (this.mainReverse ? 1 : 0) + (this.frameReverse ? 1 : 0) === 1; }
|
|
12640
12660
|
get realEnding() {
|
|
12641
12661
|
let count;
|
|
12642
12662
|
const { ending, reverse, loop } = this;
|
|
@@ -12653,6 +12673,12 @@ var LeaferUI = (function (exports) {
|
|
|
12653
12673
|
}
|
|
12654
12674
|
constructor(target, keyframe, options, isTemp) {
|
|
12655
12675
|
super();
|
|
12676
|
+
if (keyframe) {
|
|
12677
|
+
if (keyframe.keyframes)
|
|
12678
|
+
options = keyframe, keyframe = keyframe.keyframes;
|
|
12679
|
+
else if (keyframe.style)
|
|
12680
|
+
options = keyframe, keyframe = keyframe.style;
|
|
12681
|
+
}
|
|
12656
12682
|
this.init(target, keyframe, options, isTemp);
|
|
12657
12683
|
}
|
|
12658
12684
|
init(target, keyframe, options, isTemp) {
|
|
@@ -12668,16 +12694,14 @@ var LeaferUI = (function (exports) {
|
|
|
12668
12694
|
break;
|
|
12669
12695
|
case 'object': this.config = options, options.event && (this.event = options.event);
|
|
12670
12696
|
}
|
|
12671
|
-
|
|
12672
|
-
return;
|
|
12673
|
-
this.keyframes = keyframe instanceof Array ? keyframe : [keyframe];
|
|
12697
|
+
this.keyframes = keyframe instanceof Array ? keyframe : (keyframe ? [keyframe] : []);
|
|
12674
12698
|
const { easing, attrs } = this;
|
|
12675
12699
|
this.easingFn = AnimateEasing.get(easing);
|
|
12676
12700
|
if (attrs || this.attrsMap)
|
|
12677
12701
|
this.attrsMap = attrs ? attrs.reduce((map, value) => { map[value] = true; return map; }, {}) : undefined;
|
|
12678
12702
|
this.frames = [];
|
|
12679
12703
|
this.create();
|
|
12680
|
-
if (this.autoplay)
|
|
12704
|
+
if (this.autoplay && this.frames.length)
|
|
12681
12705
|
this.timer = setTimeout(() => {
|
|
12682
12706
|
this.timer = 0;
|
|
12683
12707
|
this.play();
|
|
@@ -12726,7 +12750,7 @@ var LeaferUI = (function (exports) {
|
|
|
12726
12750
|
}
|
|
12727
12751
|
create() {
|
|
12728
12752
|
const { target, frames, keyframes, config } = this, { length } = keyframes, joinBefore = length > 1 ? this.join : true;
|
|
12729
|
-
let
|
|
12753
|
+
let totalTime = 0, totalAutoTime = 0, before, keyframe, item, style, times;
|
|
12730
12754
|
if (length > 1)
|
|
12731
12755
|
this.fromStyle = {}, this.toStyle = {};
|
|
12732
12756
|
for (let i = 0; i < length; i++) {
|
|
@@ -12735,27 +12759,32 @@ var LeaferUI = (function (exports) {
|
|
|
12735
12759
|
if (!before)
|
|
12736
12760
|
before = joinBefore ? target : style;
|
|
12737
12761
|
item = { style, beforeStyle: {} };
|
|
12762
|
+
times = 1;
|
|
12738
12763
|
if (keyframe.style) {
|
|
12739
|
-
const { duration, autoDuration, delay, autoDelay, easing } = keyframe;
|
|
12764
|
+
const { duration, autoDuration, delay, autoDelay, easing, swing, loop } = keyframe;
|
|
12765
|
+
if (swing)
|
|
12766
|
+
item.swing = typeof swing === 'number' ? swing : 2, times = item.swing * 2 - 1;
|
|
12767
|
+
if (loop)
|
|
12768
|
+
item.loop = times = typeof loop === 'number' ? loop : 2;
|
|
12740
12769
|
if (duration) {
|
|
12741
|
-
item.duration = duration,
|
|
12770
|
+
item.duration = duration, totalTime += duration * times;
|
|
12742
12771
|
if (delay)
|
|
12743
12772
|
item.totalTime = duration + delay;
|
|
12744
12773
|
}
|
|
12745
12774
|
else {
|
|
12746
12775
|
if (autoDuration)
|
|
12747
|
-
item.autoDuration = autoDuration,
|
|
12776
|
+
item.autoDuration = autoDuration, totalAutoTime += autoDuration * times;
|
|
12748
12777
|
}
|
|
12749
12778
|
if (delay)
|
|
12750
|
-
item.delay = delay,
|
|
12779
|
+
item.delay = delay, totalTime += delay * times;
|
|
12751
12780
|
else if (autoDelay)
|
|
12752
|
-
item.autoDelay = autoDelay,
|
|
12781
|
+
item.autoDelay = autoDelay, totalAutoTime += autoDelay * times;
|
|
12753
12782
|
if (easing)
|
|
12754
12783
|
item.easingFn = AnimateEasing.get(easing);
|
|
12755
12784
|
}
|
|
12756
12785
|
if (!item.autoDuration && item.duration === undefined) {
|
|
12757
12786
|
if (length > 1)
|
|
12758
|
-
(i > 0 || joinBefore) ?
|
|
12787
|
+
(i > 0 || joinBefore) ? totalAutoTime += times : item.duration = 0;
|
|
12759
12788
|
else
|
|
12760
12789
|
item.duration = this.duration;
|
|
12761
12790
|
}
|
|
@@ -12771,14 +12800,14 @@ var LeaferUI = (function (exports) {
|
|
|
12771
12800
|
before = style;
|
|
12772
12801
|
frames.push(item);
|
|
12773
12802
|
}
|
|
12774
|
-
if (
|
|
12775
|
-
if (this.duration <=
|
|
12776
|
-
this.changeDuration(
|
|
12777
|
-
this.allocateTime((this.duration -
|
|
12803
|
+
if (totalAutoTime) {
|
|
12804
|
+
if (this.duration <= totalTime || !(config && config.duration))
|
|
12805
|
+
this.changeDuration(totalTime + frameDuration * totalAutoTime);
|
|
12806
|
+
this.allocateTime((this.duration - totalTime) / totalAutoTime);
|
|
12778
12807
|
}
|
|
12779
12808
|
else {
|
|
12780
|
-
if (
|
|
12781
|
-
this.changeDuration(
|
|
12809
|
+
if (totalTime)
|
|
12810
|
+
this.changeDuration(totalTime);
|
|
12782
12811
|
}
|
|
12783
12812
|
this.emit(AnimateEvent.CREATED, this);
|
|
12784
12813
|
}
|
|
@@ -12805,7 +12834,7 @@ var LeaferUI = (function (exports) {
|
|
|
12805
12834
|
if (frame.autoDelay)
|
|
12806
12835
|
frame.delay = frame.autoDelay * partTime;
|
|
12807
12836
|
if (frame.delay)
|
|
12808
|
-
frame.totalTime = frame.duration
|
|
12837
|
+
frame.totalTime = frame.duration + frame.delay;
|
|
12809
12838
|
}
|
|
12810
12839
|
}
|
|
12811
12840
|
}
|
|
@@ -12823,7 +12852,7 @@ var LeaferUI = (function (exports) {
|
|
|
12823
12852
|
if (realTime < duration) {
|
|
12824
12853
|
while (realTime - this.playedTotalTime > this.frameTotalTime) {
|
|
12825
12854
|
this.transition(1);
|
|
12826
|
-
this.
|
|
12855
|
+
this.mainReverse ? this.reverseNextFrame() : this.nextFrame();
|
|
12827
12856
|
}
|
|
12828
12857
|
const itemDelay = this.nowReverse ? 0 : (this.frame.delay || 0);
|
|
12829
12858
|
const itemPlayedTime = realTime - this.playedTotalTime - itemDelay;
|
|
@@ -12847,9 +12876,9 @@ var LeaferUI = (function (exports) {
|
|
|
12847
12876
|
const { loop, loopDelay, swing } = this;
|
|
12848
12877
|
if (loop !== false || swing) {
|
|
12849
12878
|
this.looped ? this.looped++ : this.looped = 1;
|
|
12850
|
-
if (
|
|
12879
|
+
if (this.needLoop(this.looped, loop, swing)) {
|
|
12851
12880
|
if (swing)
|
|
12852
|
-
this.
|
|
12881
|
+
this.mainReverse = !this.mainReverse;
|
|
12853
12882
|
if (loopDelay)
|
|
12854
12883
|
this.timer = setTimeout(() => { this.timer = 0, this.begin(); }, loopDelay / this.speed * 1000);
|
|
12855
12884
|
else
|
|
@@ -12864,8 +12893,8 @@ var LeaferUI = (function (exports) {
|
|
|
12864
12893
|
start(seek) {
|
|
12865
12894
|
this.requestAnimateTime = 1;
|
|
12866
12895
|
const { reverse } = this;
|
|
12867
|
-
if (reverse || this.
|
|
12868
|
-
this.
|
|
12896
|
+
if (reverse || this.mainReverse)
|
|
12897
|
+
this.mainReverse = reverse;
|
|
12869
12898
|
if (this.looped)
|
|
12870
12899
|
this.looped = 0;
|
|
12871
12900
|
if (seek)
|
|
@@ -12883,12 +12912,12 @@ var LeaferUI = (function (exports) {
|
|
|
12883
12912
|
}
|
|
12884
12913
|
begin(seek) {
|
|
12885
12914
|
this.playedTotalTime = this.time = 0;
|
|
12886
|
-
this.
|
|
12915
|
+
this.mainReverse ? this.setTo() : this.setFrom();
|
|
12887
12916
|
if (!seek)
|
|
12888
12917
|
this.requestAnimate();
|
|
12889
12918
|
}
|
|
12890
12919
|
end() {
|
|
12891
|
-
this.
|
|
12920
|
+
this.mainReverse ? this.setFrom() : this.setTo();
|
|
12892
12921
|
}
|
|
12893
12922
|
complete() {
|
|
12894
12923
|
this.requestAnimateTime = 0;
|
|
@@ -12911,15 +12940,19 @@ var LeaferUI = (function (exports) {
|
|
|
12911
12940
|
this.setStyle(this.toStyle);
|
|
12912
12941
|
}
|
|
12913
12942
|
nextFrame() {
|
|
12943
|
+
if (this.needLoopFrame())
|
|
12944
|
+
return this.increaseTime();
|
|
12914
12945
|
if (this.nowIndex + 1 >= this.frames.length)
|
|
12915
12946
|
return;
|
|
12916
|
-
this.
|
|
12947
|
+
this.increaseTime();
|
|
12917
12948
|
this.nowIndex++;
|
|
12918
12949
|
}
|
|
12919
12950
|
reverseNextFrame() {
|
|
12951
|
+
if (this.needLoopFrame())
|
|
12952
|
+
return this.increaseTime();
|
|
12920
12953
|
if (this.nowIndex - 1 < 0)
|
|
12921
12954
|
return;
|
|
12922
|
-
this.
|
|
12955
|
+
this.increaseTime();
|
|
12923
12956
|
this.nowIndex--;
|
|
12924
12957
|
}
|
|
12925
12958
|
transition(t) {
|
|
@@ -12955,6 +12988,27 @@ var LeaferUI = (function (exports) {
|
|
|
12955
12988
|
target.__ ? target.set(style, this.isTemp ? 'temp' : false) : Object.assign(target, style);
|
|
12956
12989
|
}
|
|
12957
12990
|
}
|
|
12991
|
+
increaseTime() {
|
|
12992
|
+
this.playedTotalTime += this.frameTotalTime;
|
|
12993
|
+
}
|
|
12994
|
+
needLoop(looped, loop, swing) {
|
|
12995
|
+
return !(this.needStopLoop(looped, loop) || this.needStopLoop(looped, swing, true));
|
|
12996
|
+
}
|
|
12997
|
+
needStopLoop(looped, times, swing) {
|
|
12998
|
+
return typeof times === 'number' && (!times || looped >= (swing ? times * 2 - 1 : times));
|
|
12999
|
+
}
|
|
13000
|
+
needLoopFrame() {
|
|
13001
|
+
const { loop, swing } = this.frame;
|
|
13002
|
+
if (loop || swing) {
|
|
13003
|
+
this.frameLooped ? this.frameLooped++ : this.frameLooped = 1;
|
|
13004
|
+
if (swing)
|
|
13005
|
+
this.frameReverse = !this.frameReverse;
|
|
13006
|
+
if (this.needLoop(this.frameLooped, loop, swing))
|
|
13007
|
+
return true;
|
|
13008
|
+
this.frameLooped = this.frameReverse = undefined;
|
|
13009
|
+
}
|
|
13010
|
+
return false;
|
|
13011
|
+
}
|
|
12958
13012
|
clearTimer(fn) {
|
|
12959
13013
|
if (this.timer) {
|
|
12960
13014
|
clearTimeout(this.timer), this.timer = 0;
|
|
@@ -13014,6 +13068,64 @@ var LeaferUI = (function (exports) {
|
|
|
13014
13068
|
useModule(LeafEventer)
|
|
13015
13069
|
], exports.Animate);
|
|
13016
13070
|
|
|
13071
|
+
exports.AnimateList = class AnimateList extends exports.Animate {
|
|
13072
|
+
get completed() { return this.list.every(item => item.completed); }
|
|
13073
|
+
get endingStyle() { return this._endingStyle; }
|
|
13074
|
+
constructor(target, animation, isTemp) {
|
|
13075
|
+
super(target, null);
|
|
13076
|
+
this.list = [];
|
|
13077
|
+
this.updateList(animation, isTemp);
|
|
13078
|
+
}
|
|
13079
|
+
updateList(animation, isTemp) {
|
|
13080
|
+
this.fromStyle = {};
|
|
13081
|
+
this.toStyle = {};
|
|
13082
|
+
this._endingStyle = {};
|
|
13083
|
+
if (!animation)
|
|
13084
|
+
animation = this.list.filter(item => {
|
|
13085
|
+
const { completed } = item;
|
|
13086
|
+
if (completed)
|
|
13087
|
+
item.destroy();
|
|
13088
|
+
return !completed;
|
|
13089
|
+
});
|
|
13090
|
+
this.list = animation.map(item => {
|
|
13091
|
+
const animate = item.target ? item : new exports.Animate(this.target, item, isTemp);
|
|
13092
|
+
Object.assign(this.fromStyle, animate.fromStyle);
|
|
13093
|
+
Object.assign(this.toStyle, animate.toStyle);
|
|
13094
|
+
Object.assign(this._endingStyle, animate.endingStyle);
|
|
13095
|
+
return animate;
|
|
13096
|
+
});
|
|
13097
|
+
}
|
|
13098
|
+
play() {
|
|
13099
|
+
this.each(item => item.play());
|
|
13100
|
+
}
|
|
13101
|
+
pause() {
|
|
13102
|
+
this.each(item => item.pause());
|
|
13103
|
+
}
|
|
13104
|
+
stop() {
|
|
13105
|
+
this.each(item => item.stop());
|
|
13106
|
+
}
|
|
13107
|
+
seek(time) {
|
|
13108
|
+
this.each(item => item.seek(time));
|
|
13109
|
+
}
|
|
13110
|
+
kill(complete, killStyle) {
|
|
13111
|
+
this.each(item => item.kill(complete, killStyle));
|
|
13112
|
+
this.destroy();
|
|
13113
|
+
}
|
|
13114
|
+
each(func) {
|
|
13115
|
+
this.list.forEach(func);
|
|
13116
|
+
}
|
|
13117
|
+
destroy(complete) {
|
|
13118
|
+
const { list } = this;
|
|
13119
|
+
if (list.length) {
|
|
13120
|
+
this.each(item => item.destroy(complete));
|
|
13121
|
+
list.length = 0;
|
|
13122
|
+
}
|
|
13123
|
+
}
|
|
13124
|
+
};
|
|
13125
|
+
exports.AnimateList = __decorate([
|
|
13126
|
+
useModule(LeafEventer)
|
|
13127
|
+
], exports.AnimateList);
|
|
13128
|
+
|
|
13017
13129
|
const colorNames = {
|
|
13018
13130
|
transparent: 'FFF0',
|
|
13019
13131
|
aliceblue: 'F0F8FF',
|
|
@@ -13394,23 +13506,40 @@ var LeaferUI = (function (exports) {
|
|
|
13394
13506
|
ui$2.animate = function (keyframe, options, kill, isTemp) {
|
|
13395
13507
|
if (keyframe === undefined)
|
|
13396
13508
|
return this.__animate;
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13402
|
-
|
|
13403
|
-
|
|
13404
|
-
|
|
13405
|
-
|
|
13509
|
+
const isAnimationList = keyframe instanceof Array && !options && kill;
|
|
13510
|
+
let nextAnimate = isAnimationList ? new exports.AnimateList(this, keyframe, isTemp) : new exports.Animate(this, keyframe, options, isTemp);
|
|
13511
|
+
this.killAnimate(kill, nextAnimate.toStyle);
|
|
13512
|
+
const animate = this.__animate;
|
|
13513
|
+
if (animate) {
|
|
13514
|
+
if (nextAnimate instanceof exports.AnimateList)
|
|
13515
|
+
nextAnimate.list.unshift(animate);
|
|
13516
|
+
else
|
|
13517
|
+
nextAnimate = new exports.AnimateList(this, [animate, nextAnimate]);
|
|
13518
|
+
}
|
|
13519
|
+
return this.__animate = nextAnimate;
|
|
13406
13520
|
};
|
|
13407
|
-
ui$2.killAnimate = function (_type,
|
|
13521
|
+
ui$2.killAnimate = function (_type, nextStyle) {
|
|
13408
13522
|
const animate = this.__animate;
|
|
13409
|
-
if (animate)
|
|
13410
|
-
|
|
13523
|
+
if (animate) {
|
|
13524
|
+
let kill = false;
|
|
13525
|
+
if (nextStyle && !animate.completed) {
|
|
13526
|
+
if (animate instanceof exports.AnimateList)
|
|
13527
|
+
animate.updateList();
|
|
13528
|
+
const { toStyle } = animate;
|
|
13529
|
+
for (let key in nextStyle)
|
|
13530
|
+
if (key in toStyle) {
|
|
13531
|
+
kill = true;
|
|
13532
|
+
break;
|
|
13533
|
+
}
|
|
13534
|
+
}
|
|
13535
|
+
else
|
|
13536
|
+
kill = true;
|
|
13537
|
+
if (kill)
|
|
13538
|
+
animate.kill(true, nextStyle), this.__animate = null;
|
|
13539
|
+
}
|
|
13411
13540
|
};
|
|
13412
13541
|
ui$2.__runAnimation = function (type, complete) {
|
|
13413
|
-
this.animate(type === 'in' ? this.animation : this.animationOut);
|
|
13542
|
+
this.animate(type === 'in' ? this.animation : this.animationOut, undefined, 'animation');
|
|
13414
13543
|
if (complete)
|
|
13415
13544
|
this.__animate.on(AnimateEvent.COMPLETED, complete);
|
|
13416
13545
|
};
|
|
@@ -13899,6 +14028,7 @@ var LeaferUI = (function (exports) {
|
|
|
13899
14028
|
return getSelector(this).getBy(condition, this, true, options);
|
|
13900
14029
|
};
|
|
13901
14030
|
|
|
14031
|
+
Plugin.add('find');
|
|
13902
14032
|
Creator.finder = function (target) {
|
|
13903
14033
|
return new Finder(target);
|
|
13904
14034
|
};
|