leafer-game 1.6.0 → 1.6.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.cjs +0 -1
- package/dist/web.esm.js +0 -1
- package/dist/web.js +139 -83
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +135 -83
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +10 -10
- package/dist/web.cjs.map +0 -1
- package/dist/web.esm.js.map +0 -1
- package/dist/web.js.map +0 -1
- package/dist/web.module.js.map +0 -1
package/dist/web.cjs
CHANGED
package/dist/web.esm.js
CHANGED
package/dist/web.js
CHANGED
|
@@ -2592,7 +2592,11 @@ var LeaferUI = (function (exports) {
|
|
|
2592
2592
|
const point = {};
|
|
2593
2593
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, point);
|
|
2594
2594
|
return point;
|
|
2595
|
-
}
|
|
2595
|
+
},
|
|
2596
|
+
getDerivative(t, fromV, v1, v2, toV) {
|
|
2597
|
+
const o = 1 - t;
|
|
2598
|
+
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
2599
|
+
},
|
|
2596
2600
|
};
|
|
2597
2601
|
const { getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$6 } = BezierHelper;
|
|
2598
2602
|
|
|
@@ -3773,8 +3777,11 @@ var LeaferUI = (function (exports) {
|
|
|
3773
3777
|
load(onSuccess, onError) {
|
|
3774
3778
|
if (!this.loading) {
|
|
3775
3779
|
this.loading = true;
|
|
3780
|
+
let { loadImage, loadImageWithProgress } = Platform.origin, onProgress = this.config.showProgress && loadImageWithProgress && this.onProgress.bind(this);
|
|
3781
|
+
if (onProgress)
|
|
3782
|
+
loadImage = loadImageWithProgress;
|
|
3776
3783
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
3777
|
-
return yield
|
|
3784
|
+
return yield loadImage(this.url, onProgress).then(img => this.setView(img)).catch((e) => {
|
|
3778
3785
|
this.error = e;
|
|
3779
3786
|
this.onComplete(false);
|
|
3780
3787
|
});
|
|
@@ -3799,6 +3806,9 @@ var LeaferUI = (function (exports) {
|
|
|
3799
3806
|
this.view = img;
|
|
3800
3807
|
this.onComplete(true);
|
|
3801
3808
|
}
|
|
3809
|
+
onProgress(progress) {
|
|
3810
|
+
this.progress = progress;
|
|
3811
|
+
}
|
|
3802
3812
|
onComplete(isSuccess) {
|
|
3803
3813
|
let odd;
|
|
3804
3814
|
this.waitComplete.forEach((item, index) => {
|
|
@@ -4264,13 +4274,20 @@ var LeaferUI = (function (exports) {
|
|
|
4264
4274
|
if (leaf.isBranch) {
|
|
4265
4275
|
const { children } = leaf;
|
|
4266
4276
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
4267
|
-
updateAllWorldOpacity
|
|
4277
|
+
updateAllWorldOpacity(children[i]);
|
|
4268
4278
|
}
|
|
4269
4279
|
}
|
|
4270
4280
|
},
|
|
4271
|
-
|
|
4272
|
-
|
|
4281
|
+
updateChange(leaf) {
|
|
4282
|
+
const layout = leaf.__layout;
|
|
4283
|
+
if (layout.stateStyleChanged)
|
|
4284
|
+
leaf.updateState();
|
|
4285
|
+
if (layout.opacityChanged)
|
|
4286
|
+
updateAllWorldOpacity(leaf);
|
|
4273
4287
|
leaf.__updateChange();
|
|
4288
|
+
},
|
|
4289
|
+
updateAllChange(leaf) {
|
|
4290
|
+
updateChange$1(leaf);
|
|
4274
4291
|
if (leaf.isBranch) {
|
|
4275
4292
|
const { children } = leaf;
|
|
4276
4293
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -4406,7 +4423,7 @@ var LeaferUI = (function (exports) {
|
|
|
4406
4423
|
}
|
|
4407
4424
|
};
|
|
4408
4425
|
const L$1 = LeafHelper;
|
|
4409
|
-
const { updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$3, updateAllWorldOpacity:
|
|
4426
|
+
const { updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$3, updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1 } = L$1;
|
|
4410
4427
|
function getTempLocal(t, world) {
|
|
4411
4428
|
t.__layout.update();
|
|
4412
4429
|
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
@@ -6128,7 +6145,7 @@ var LeaferUI = (function (exports) {
|
|
|
6128
6145
|
}
|
|
6129
6146
|
}
|
|
6130
6147
|
|
|
6131
|
-
const version = "1.6.
|
|
6148
|
+
const version = "1.6.2";
|
|
6132
6149
|
|
|
6133
6150
|
const debug$5 = Debug.get('LeaferCanvas');
|
|
6134
6151
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -6494,7 +6511,7 @@ var LeaferUI = (function (exports) {
|
|
|
6494
6511
|
}
|
|
6495
6512
|
}
|
|
6496
6513
|
|
|
6497
|
-
const { updateAllMatrix: updateAllMatrix$2, updateBounds: updateOneBounds,
|
|
6514
|
+
const { updateAllMatrix: updateAllMatrix$2, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
|
|
6498
6515
|
const { pushAllChildBranch, pushAllParent } = BranchHelper;
|
|
6499
6516
|
function updateMatrix$1(updateList, levelList) {
|
|
6500
6517
|
let layout;
|
|
@@ -6537,15 +6554,7 @@ var LeaferUI = (function (exports) {
|
|
|
6537
6554
|
});
|
|
6538
6555
|
}
|
|
6539
6556
|
function updateChange(updateList) {
|
|
6540
|
-
|
|
6541
|
-
updateList.list.forEach(leaf => {
|
|
6542
|
-
layout = leaf.__layout;
|
|
6543
|
-
if (layout.opacityChanged)
|
|
6544
|
-
updateAllWorldOpacity(leaf);
|
|
6545
|
-
if (layout.stateStyleChanged)
|
|
6546
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6547
|
-
leaf.__updateChange();
|
|
6548
|
-
});
|
|
6557
|
+
updateList.list.forEach(updateOneChange);
|
|
6549
6558
|
}
|
|
6550
6559
|
|
|
6551
6560
|
const { worldBounds } = LeafBoundsHelper;
|
|
@@ -6766,6 +6775,15 @@ var LeaferUI = (function (exports) {
|
|
|
6766
6775
|
}
|
|
6767
6776
|
checkRender() {
|
|
6768
6777
|
if (this.running) {
|
|
6778
|
+
const { target } = this;
|
|
6779
|
+
if (target.isApp) {
|
|
6780
|
+
target.emit(RenderEvent.CHILD_START, target);
|
|
6781
|
+
target.children.forEach(leafer => {
|
|
6782
|
+
leafer.renderer.FPS = this.FPS;
|
|
6783
|
+
leafer.renderer.checkRender();
|
|
6784
|
+
});
|
|
6785
|
+
target.emit(RenderEvent.CHILD_END, target);
|
|
6786
|
+
}
|
|
6769
6787
|
if (this.changed && this.canvas.view)
|
|
6770
6788
|
this.render();
|
|
6771
6789
|
this.target.emit(RenderEvent.NEXT);
|
|
@@ -6851,7 +6869,7 @@ var LeaferUI = (function (exports) {
|
|
|
6851
6869
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
6852
6870
|
canvas.clearWorld(bounds, true);
|
|
6853
6871
|
canvas.clipWorld(bounds, true);
|
|
6854
|
-
this.__render(bounds,
|
|
6872
|
+
this.__render(bounds, realBounds);
|
|
6855
6873
|
canvas.restore();
|
|
6856
6874
|
Run.end(t);
|
|
6857
6875
|
}
|
|
@@ -6860,12 +6878,12 @@ var LeaferUI = (function (exports) {
|
|
|
6860
6878
|
const { canvas } = this;
|
|
6861
6879
|
canvas.save();
|
|
6862
6880
|
canvas.clear();
|
|
6863
|
-
this.__render(canvas.bounds
|
|
6881
|
+
this.__render(canvas.bounds);
|
|
6864
6882
|
canvas.restore();
|
|
6865
6883
|
Run.end(t);
|
|
6866
6884
|
}
|
|
6867
|
-
__render(bounds,
|
|
6868
|
-
const { canvas } = this, options = includes ? { includes } : { bounds, includes };
|
|
6885
|
+
__render(bounds, realBounds) {
|
|
6886
|
+
const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
|
|
6869
6887
|
if (this.needFill)
|
|
6870
6888
|
canvas.fillWorld(bounds, this.config.fill);
|
|
6871
6889
|
if (Debug.showRepaint)
|
|
@@ -6892,22 +6910,14 @@ var LeaferUI = (function (exports) {
|
|
|
6892
6910
|
}
|
|
6893
6911
|
__requestRender() {
|
|
6894
6912
|
const target = this.target;
|
|
6895
|
-
if (target
|
|
6896
|
-
return target.parentApp.renderer.update(false);
|
|
6897
|
-
if (this.requestTime)
|
|
6913
|
+
if (this.requestTime || !target)
|
|
6898
6914
|
return;
|
|
6915
|
+
if (target.parentApp)
|
|
6916
|
+
return target.parentApp.requestRender(false);
|
|
6899
6917
|
const requestTime = this.requestTime = Date.now();
|
|
6900
6918
|
Platform.requestRender(() => {
|
|
6901
6919
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
|
|
6902
6920
|
this.requestTime = 0;
|
|
6903
|
-
if (target.isApp) {
|
|
6904
|
-
target.emit(RenderEvent.CHILD_START, target);
|
|
6905
|
-
target.children.forEach(leafer => {
|
|
6906
|
-
leafer.renderer.FPS = this.FPS;
|
|
6907
|
-
leafer.renderer.checkRender();
|
|
6908
|
-
});
|
|
6909
|
-
target.emit(RenderEvent.CHILD_END, target);
|
|
6910
|
-
}
|
|
6911
6921
|
this.checkRender();
|
|
6912
6922
|
});
|
|
6913
6923
|
}
|
|
@@ -7389,13 +7399,11 @@ var LeaferUI = (function (exports) {
|
|
|
7389
7399
|
setFontWeight(value) {
|
|
7390
7400
|
if (typeof value === 'string') {
|
|
7391
7401
|
this.__setInput('fontWeight', value);
|
|
7392
|
-
|
|
7393
|
-
}
|
|
7394
|
-
else {
|
|
7395
|
-
if (this.__input)
|
|
7396
|
-
this.__removeInput('fontWeight');
|
|
7397
|
-
this._fontWeight = value;
|
|
7402
|
+
value = fontWeightMap[value] || 400;
|
|
7398
7403
|
}
|
|
7404
|
+
else if (this.__input)
|
|
7405
|
+
this.__removeInput('fontWeight');
|
|
7406
|
+
this._fontWeight = value;
|
|
7399
7407
|
}
|
|
7400
7408
|
setBoxStyle(value) {
|
|
7401
7409
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7722,6 +7730,9 @@ var LeaferUI = (function (exports) {
|
|
|
7722
7730
|
else
|
|
7723
7731
|
drawer.rect(x, y, width, height);
|
|
7724
7732
|
}
|
|
7733
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7734
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7735
|
+
}
|
|
7725
7736
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7726
7737
|
return Plugin.need('animate');
|
|
7727
7738
|
}
|
|
@@ -7958,6 +7969,9 @@ var LeaferUI = (function (exports) {
|
|
|
7958
7969
|
__decorate([
|
|
7959
7970
|
effectType()
|
|
7960
7971
|
], exports.UI.prototype, "filter", void 0);
|
|
7972
|
+
__decorate([
|
|
7973
|
+
surfaceType()
|
|
7974
|
+
], exports.UI.prototype, "placeholderColor", void 0);
|
|
7961
7975
|
__decorate([
|
|
7962
7976
|
dataType({})
|
|
7963
7977
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8788,10 +8802,11 @@ var LeaferUI = (function (exports) {
|
|
|
8788
8802
|
get ready() { return this.image ? this.image.ready : false; }
|
|
8789
8803
|
constructor(data) {
|
|
8790
8804
|
super(data);
|
|
8791
|
-
this.
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8805
|
+
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8806
|
+
}
|
|
8807
|
+
__onLoaded(e) {
|
|
8808
|
+
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8809
|
+
this.image = e.image;
|
|
8795
8810
|
}
|
|
8796
8811
|
destroy() {
|
|
8797
8812
|
this.image = null;
|
|
@@ -8905,7 +8920,7 @@ var LeaferUI = (function (exports) {
|
|
|
8905
8920
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8906
8921
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8907
8922
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8908
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8923
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8909
8924
|
}
|
|
8910
8925
|
__updateBoxBounds() {
|
|
8911
8926
|
const data = this.__;
|
|
@@ -9003,6 +9018,9 @@ var LeaferUI = (function (exports) {
|
|
|
9003
9018
|
__decorate([
|
|
9004
9019
|
boundsType('')
|
|
9005
9020
|
], exports.Text.prototype, "text", void 0);
|
|
9021
|
+
__decorate([
|
|
9022
|
+
boundsType('')
|
|
9023
|
+
], exports.Text.prototype, "placeholder", void 0);
|
|
9006
9024
|
__decorate([
|
|
9007
9025
|
boundsType('caption')
|
|
9008
9026
|
], exports.Text.prototype, "fontFamily", void 0);
|
|
@@ -9878,8 +9896,7 @@ var LeaferUI = (function (exports) {
|
|
|
9878
9896
|
if (this.downData) {
|
|
9879
9897
|
const canDrag = PointHelper.getDistance(this.downData, data) > this.p.dragDistance;
|
|
9880
9898
|
if (canDrag) {
|
|
9881
|
-
|
|
9882
|
-
this.pointerWaitCancel();
|
|
9899
|
+
this.pointerWaitCancel();
|
|
9883
9900
|
this.waitRightTap = false;
|
|
9884
9901
|
}
|
|
9885
9902
|
this.dragger.checkDrag(data, canDrag);
|
|
@@ -10161,9 +10178,11 @@ var LeaferUI = (function (exports) {
|
|
|
10161
10178
|
this.waitTap = true;
|
|
10162
10179
|
}
|
|
10163
10180
|
tapWaitCancel() {
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10181
|
+
if (this.waitTap) {
|
|
10182
|
+
clearTimeout(this.tapTimer);
|
|
10183
|
+
this.waitTap = false;
|
|
10184
|
+
this.tapCount = 0;
|
|
10185
|
+
}
|
|
10167
10186
|
}
|
|
10168
10187
|
longPressWait(data) {
|
|
10169
10188
|
clearTimeout(this.longPressTimer);
|
|
@@ -10183,8 +10202,10 @@ var LeaferUI = (function (exports) {
|
|
|
10183
10202
|
return hasLong;
|
|
10184
10203
|
}
|
|
10185
10204
|
longPressWaitCancel() {
|
|
10186
|
-
|
|
10187
|
-
|
|
10205
|
+
if (this.longPressTimer) {
|
|
10206
|
+
clearTimeout(this.longPressTimer);
|
|
10207
|
+
this.longPressed = false;
|
|
10208
|
+
}
|
|
10188
10209
|
}
|
|
10189
10210
|
__onResize() {
|
|
10190
10211
|
const { dragOut } = this.m;
|
|
@@ -10734,8 +10755,10 @@ var LeaferUI = (function (exports) {
|
|
|
10734
10755
|
}
|
|
10735
10756
|
|
|
10736
10757
|
function fillText(ui, canvas) {
|
|
10737
|
-
|
|
10738
|
-
|
|
10758
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
10759
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
10760
|
+
canvas.fillStyle = data.placeholderColor;
|
|
10761
|
+
let row;
|
|
10739
10762
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10740
10763
|
row = rows[i];
|
|
10741
10764
|
if (row.text)
|
|
@@ -10744,7 +10767,7 @@ var LeaferUI = (function (exports) {
|
|
|
10744
10767
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10745
10768
|
}
|
|
10746
10769
|
if (decorationY) {
|
|
10747
|
-
const { decorationColor, decorationHeight } = data;
|
|
10770
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
10748
10771
|
if (decorationColor)
|
|
10749
10772
|
canvas.fillStyle = decorationColor;
|
|
10750
10773
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -10753,38 +10776,44 @@ var LeaferUI = (function (exports) {
|
|
|
10753
10776
|
|
|
10754
10777
|
function fill(fill, ui, canvas) {
|
|
10755
10778
|
canvas.fillStyle = fill;
|
|
10756
|
-
|
|
10779
|
+
fillPathOrText(ui, canvas);
|
|
10757
10780
|
}
|
|
10758
10781
|
function fills(fills, ui, canvas) {
|
|
10759
10782
|
let item;
|
|
10760
|
-
const { windingRule, __font } = ui.__;
|
|
10761
10783
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
10762
10784
|
item = fills[i];
|
|
10763
|
-
if (item.image
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
if (item.blendMode)
|
|
10771
|
-
canvas.blendMode = item.blendMode;
|
|
10772
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
10773
|
-
canvas.restore();
|
|
10785
|
+
if (item.image) {
|
|
10786
|
+
if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
10787
|
+
continue;
|
|
10788
|
+
if (!item.style) {
|
|
10789
|
+
if (!i && item.image.isPlacehold)
|
|
10790
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
10791
|
+
continue;
|
|
10774
10792
|
}
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10793
|
+
}
|
|
10794
|
+
canvas.fillStyle = item.style;
|
|
10795
|
+
if (item.transform) {
|
|
10796
|
+
canvas.save();
|
|
10797
|
+
canvas.transform(item.transform);
|
|
10798
|
+
if (item.blendMode)
|
|
10799
|
+
canvas.blendMode = item.blendMode;
|
|
10800
|
+
fillPathOrText(ui, canvas);
|
|
10801
|
+
canvas.restore();
|
|
10802
|
+
}
|
|
10803
|
+
else {
|
|
10804
|
+
if (item.blendMode) {
|
|
10805
|
+
canvas.saveBlendMode(item.blendMode);
|
|
10806
|
+
fillPathOrText(ui, canvas);
|
|
10807
|
+
canvas.restoreBlendMode();
|
|
10784
10808
|
}
|
|
10809
|
+
else
|
|
10810
|
+
fillPathOrText(ui, canvas);
|
|
10785
10811
|
}
|
|
10786
10812
|
}
|
|
10787
10813
|
}
|
|
10814
|
+
function fillPathOrText(ui, canvas) {
|
|
10815
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
10816
|
+
}
|
|
10788
10817
|
|
|
10789
10818
|
function strokeText(stroke, ui, canvas) {
|
|
10790
10819
|
const { strokeAlign } = ui.__;
|
|
@@ -11024,6 +11053,7 @@ var LeaferUI = (function (exports) {
|
|
|
11024
11053
|
compute,
|
|
11025
11054
|
fill,
|
|
11026
11055
|
fills,
|
|
11056
|
+
fillPathOrText,
|
|
11027
11057
|
fillText,
|
|
11028
11058
|
stroke,
|
|
11029
11059
|
strokes,
|
|
@@ -11216,6 +11246,13 @@ var LeaferUI = (function (exports) {
|
|
|
11216
11246
|
onLoadError(ui, event, error);
|
|
11217
11247
|
leafPaint.loadId = null;
|
|
11218
11248
|
});
|
|
11249
|
+
if (ui.placeholderColor)
|
|
11250
|
+
setTimeout(() => {
|
|
11251
|
+
if (!(image.ready || image.isPlacehold)) {
|
|
11252
|
+
image.isPlacehold = true;
|
|
11253
|
+
ui.forceUpdate('surface');
|
|
11254
|
+
}
|
|
11255
|
+
}, 100);
|
|
11219
11256
|
}
|
|
11220
11257
|
return leafPaint;
|
|
11221
11258
|
}
|
|
@@ -12415,7 +12452,10 @@ var LeaferUI = (function (exports) {
|
|
|
12415
12452
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
12416
12453
|
set(value) {
|
|
12417
12454
|
this.__setAttr(key, value);
|
|
12418
|
-
|
|
12455
|
+
if (this.leaferIsReady)
|
|
12456
|
+
styleName ? State.setStyleName(this, styleName, value) : State.set(this, value);
|
|
12457
|
+
else
|
|
12458
|
+
this.__layout.stateStyleChanged = true;
|
|
12419
12459
|
}
|
|
12420
12460
|
}));
|
|
12421
12461
|
}
|
|
@@ -12512,6 +12552,9 @@ var LeaferUI = (function (exports) {
|
|
|
12512
12552
|
const selectedStyle = style.selectedStyle || leaf.selectedStyle;
|
|
12513
12553
|
if (selectedStyle && State.isSelected(leaf, button))
|
|
12514
12554
|
exist = assign(style, selectedStyle);
|
|
12555
|
+
const placeholderStyle = style.placeholderStyle || leaf.placeholderStyle;
|
|
12556
|
+
if (placeholderStyle && State.isPlacehold(leaf, button))
|
|
12557
|
+
exist = assign(style, placeholderStyle);
|
|
12515
12558
|
if (State.isDisabled(leaf, button)) {
|
|
12516
12559
|
const disabledStyle = style.disabledStyle || leaf.disabledStyle;
|
|
12517
12560
|
if (disabledStyle)
|
|
@@ -12691,12 +12734,14 @@ var LeaferUI = (function (exports) {
|
|
|
12691
12734
|
transitionOut: 1,
|
|
12692
12735
|
states: 1,
|
|
12693
12736
|
state: 1,
|
|
12737
|
+
placeholder: 1,
|
|
12694
12738
|
normalStyle: 1,
|
|
12695
12739
|
hoverStyle: 1,
|
|
12696
12740
|
pressStyle: 1,
|
|
12697
12741
|
focusStyle: 1,
|
|
12698
12742
|
selectedStyle: 1,
|
|
12699
|
-
disabledStyle: 1
|
|
12743
|
+
disabledStyle: 1,
|
|
12744
|
+
placeholderStyle: 1
|
|
12700
12745
|
};
|
|
12701
12746
|
State.isState = function (state, leaf, button) { return checkState(state, leaf, button); };
|
|
12702
12747
|
State.isSelected = function (leaf, button) { return checkFixedState('selected', leaf, button); };
|
|
@@ -12704,6 +12749,7 @@ var LeaferUI = (function (exports) {
|
|
|
12704
12749
|
State.isFocus = function (leaf, button) { return checkPointerState('isFocus', leaf, button); };
|
|
12705
12750
|
State.isHover = function (leaf, button) { return checkPointerState('isHover', leaf, button); };
|
|
12706
12751
|
State.isPress = function (leaf, button) { return checkPointerState('isPress', leaf, button); };
|
|
12752
|
+
State.isPlacehold = function (leaf, _button) { return leaf.__.__isPlacehold; };
|
|
12707
12753
|
State.isDrag = function (leaf, button) { return checkPointerState('isDrag', leaf, button); };
|
|
12708
12754
|
State.setStyleName = function (leaf, stateType, value) { value ? setState(leaf, stateType, leaf[stateType]) : unsetState(leaf, stateType, leaf[stateType]); };
|
|
12709
12755
|
State.set = function (leaf, stateName) { const style = leaf.states[stateName]; style ? setState(leaf, stateName, style) : unsetState(leaf, stateName, style); };
|
|
@@ -12721,6 +12767,7 @@ var LeaferUI = (function (exports) {
|
|
|
12721
12767
|
exports.UI.addAttr('focusStyle', undefined, stateStyleType);
|
|
12722
12768
|
exports.UI.addAttr('selectedStyle', undefined, stateStyleType);
|
|
12723
12769
|
exports.UI.addAttr('disabledStyle', undefined, stateStyleType);
|
|
12770
|
+
exports.UI.addAttr('placeholderStyle', undefined, stateStyleType);
|
|
12724
12771
|
exports.UI.addAttr('button', false, dataType);
|
|
12725
12772
|
ui$3.focus = function (value = true) {
|
|
12726
12773
|
this.waitLeafer(() => {
|
|
@@ -12739,6 +12786,15 @@ var LeaferUI = (function (exports) {
|
|
|
12739
12786
|
ui$3.updateState = function () {
|
|
12740
12787
|
State.updateStyle(this, undefined, 'in');
|
|
12741
12788
|
};
|
|
12789
|
+
const text = exports.Text.prototype, textKey = 'text';
|
|
12790
|
+
defineKey(text, textKey, Object.assign(Object.assign({}, getDescriptor(text, textKey)), { set(value) {
|
|
12791
|
+
const t = this, oldValue = t.text;
|
|
12792
|
+
if (t.__setAttr(textKey, value)) {
|
|
12793
|
+
doBoundsType(t);
|
|
12794
|
+
if (t.placeholderStyle && t.placeholder && (oldValue === '' || value === ''))
|
|
12795
|
+
t.__layout.stateStyleChanged = true;
|
|
12796
|
+
}
|
|
12797
|
+
} }));
|
|
12742
12798
|
|
|
12743
12799
|
const { cos, sin, pow, sqrt: sqrt$1, abs, ceil, floor, round: round$2, PI } = Math;
|
|
12744
12800
|
const PIx5 = PI * 5;
|
|
@@ -13793,6 +13849,7 @@ var LeaferUI = (function (exports) {
|
|
|
13793
13849
|
const gaussNodes = [0.1488743389, 0.4333953941, 0.6794095682, 0.8650633666, 0.9739065285];
|
|
13794
13850
|
const gaussWeights = [0.2955242247, 0.2692667193, 0.2190863625, 0.1494513491, 0.0666713443];
|
|
13795
13851
|
const { sqrt } = Math;
|
|
13852
|
+
const { getDerivative } = BezierHelper;
|
|
13796
13853
|
const HighBezierHelper = {
|
|
13797
13854
|
getDistance(fromX, fromY, x1, y1, x2, y2, toX, toY, t = 1) {
|
|
13798
13855
|
let distance = 0, t1, t2, d1X, d1Y, d2X, d2Y, half = t / 2;
|
|
@@ -13807,10 +13864,6 @@ var LeaferUI = (function (exports) {
|
|
|
13807
13864
|
}
|
|
13808
13865
|
return distance * half;
|
|
13809
13866
|
},
|
|
13810
|
-
getDerivative(t, fromV, v1, v2, toV) {
|
|
13811
|
-
const o = 1 - t;
|
|
13812
|
-
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
13813
|
-
},
|
|
13814
13867
|
getRotation(t, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
13815
13868
|
const dx = getDerivative(t, fromX, x1, x2, toX);
|
|
13816
13869
|
const dy = getDerivative(t, fromY, y1, y2, toY);
|
|
@@ -13839,7 +13892,7 @@ var LeaferUI = (function (exports) {
|
|
|
13839
13892
|
data.push(PathCommandMap.C, ax, ay, bx, by, cx, cy);
|
|
13840
13893
|
}
|
|
13841
13894
|
};
|
|
13842
|
-
const {
|
|
13895
|
+
const { getDistance } = HighBezierHelper;
|
|
13843
13896
|
|
|
13844
13897
|
const { M, L, C, Z } = PathCommandMap;
|
|
13845
13898
|
const tempPoint = {}, tempFrom = {};
|
|
@@ -14462,4 +14515,7 @@ var LeaferUI = (function (exports) {
|
|
|
14462
14515
|
return exports;
|
|
14463
14516
|
|
|
14464
14517
|
})({});
|
|
14465
|
-
|
|
14518
|
+
|
|
14519
|
+
function Leafer(opt) { return new LeaferUI.Leafer(opt); }
|
|
14520
|
+
Object.setPrototypeOf(Leafer, LeaferUI);
|
|
14521
|
+
Leafer.prototype = LeaferUI.Leafer.prototype;
|