@leafer-game/worker 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/worker.cjs +0 -1
- package/dist/worker.esm.js +0 -1
- package/dist/worker.js +139 -83
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +135 -83
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +10 -10
- package/dist/worker.cjs.map +0 -1
- package/dist/worker.esm.js.map +0 -1
- package/dist/worker.js.map +0 -1
- package/dist/worker.module.js.map +0 -1
package/dist/worker.cjs
CHANGED
package/dist/worker.esm.js
CHANGED
package/dist/worker.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
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6134
6151
|
get allowBackgroundColor() { return true; }
|
|
@@ -6313,7 +6330,7 @@ var LeaferUI = (function (exports) {
|
|
|
6313
6330
|
}
|
|
6314
6331
|
}
|
|
6315
6332
|
|
|
6316
|
-
const { updateAllMatrix: updateAllMatrix$2, updateBounds: updateOneBounds,
|
|
6333
|
+
const { updateAllMatrix: updateAllMatrix$2, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
|
|
6317
6334
|
const { pushAllChildBranch, pushAllParent } = BranchHelper;
|
|
6318
6335
|
function updateMatrix$1(updateList, levelList) {
|
|
6319
6336
|
let layout;
|
|
@@ -6356,15 +6373,7 @@ var LeaferUI = (function (exports) {
|
|
|
6356
6373
|
});
|
|
6357
6374
|
}
|
|
6358
6375
|
function updateChange(updateList) {
|
|
6359
|
-
|
|
6360
|
-
updateList.list.forEach(leaf => {
|
|
6361
|
-
layout = leaf.__layout;
|
|
6362
|
-
if (layout.opacityChanged)
|
|
6363
|
-
updateAllWorldOpacity(leaf);
|
|
6364
|
-
if (layout.stateStyleChanged)
|
|
6365
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6366
|
-
leaf.__updateChange();
|
|
6367
|
-
});
|
|
6376
|
+
updateList.list.forEach(updateOneChange);
|
|
6368
6377
|
}
|
|
6369
6378
|
|
|
6370
6379
|
const { worldBounds } = LeafBoundsHelper;
|
|
@@ -6585,6 +6594,15 @@ var LeaferUI = (function (exports) {
|
|
|
6585
6594
|
}
|
|
6586
6595
|
checkRender() {
|
|
6587
6596
|
if (this.running) {
|
|
6597
|
+
const { target } = this;
|
|
6598
|
+
if (target.isApp) {
|
|
6599
|
+
target.emit(RenderEvent.CHILD_START, target);
|
|
6600
|
+
target.children.forEach(leafer => {
|
|
6601
|
+
leafer.renderer.FPS = this.FPS;
|
|
6602
|
+
leafer.renderer.checkRender();
|
|
6603
|
+
});
|
|
6604
|
+
target.emit(RenderEvent.CHILD_END, target);
|
|
6605
|
+
}
|
|
6588
6606
|
if (this.changed && this.canvas.view)
|
|
6589
6607
|
this.render();
|
|
6590
6608
|
this.target.emit(RenderEvent.NEXT);
|
|
@@ -6670,7 +6688,7 @@ var LeaferUI = (function (exports) {
|
|
|
6670
6688
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
6671
6689
|
canvas.clearWorld(bounds, true);
|
|
6672
6690
|
canvas.clipWorld(bounds, true);
|
|
6673
|
-
this.__render(bounds,
|
|
6691
|
+
this.__render(bounds, realBounds);
|
|
6674
6692
|
canvas.restore();
|
|
6675
6693
|
Run.end(t);
|
|
6676
6694
|
}
|
|
@@ -6679,12 +6697,12 @@ var LeaferUI = (function (exports) {
|
|
|
6679
6697
|
const { canvas } = this;
|
|
6680
6698
|
canvas.save();
|
|
6681
6699
|
canvas.clear();
|
|
6682
|
-
this.__render(canvas.bounds
|
|
6700
|
+
this.__render(canvas.bounds);
|
|
6683
6701
|
canvas.restore();
|
|
6684
6702
|
Run.end(t);
|
|
6685
6703
|
}
|
|
6686
|
-
__render(bounds,
|
|
6687
|
-
const { canvas } = this, options = includes ? { includes } : { bounds, includes };
|
|
6704
|
+
__render(bounds, realBounds) {
|
|
6705
|
+
const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
|
|
6688
6706
|
if (this.needFill)
|
|
6689
6707
|
canvas.fillWorld(bounds, this.config.fill);
|
|
6690
6708
|
if (Debug.showRepaint)
|
|
@@ -6711,22 +6729,14 @@ var LeaferUI = (function (exports) {
|
|
|
6711
6729
|
}
|
|
6712
6730
|
__requestRender() {
|
|
6713
6731
|
const target = this.target;
|
|
6714
|
-
if (target
|
|
6715
|
-
return target.parentApp.renderer.update(false);
|
|
6716
|
-
if (this.requestTime)
|
|
6732
|
+
if (this.requestTime || !target)
|
|
6717
6733
|
return;
|
|
6734
|
+
if (target.parentApp)
|
|
6735
|
+
return target.parentApp.requestRender(false);
|
|
6718
6736
|
const requestTime = this.requestTime = Date.now();
|
|
6719
6737
|
Platform.requestRender(() => {
|
|
6720
6738
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
|
|
6721
6739
|
this.requestTime = 0;
|
|
6722
|
-
if (target.isApp) {
|
|
6723
|
-
target.emit(RenderEvent.CHILD_START, target);
|
|
6724
|
-
target.children.forEach(leafer => {
|
|
6725
|
-
leafer.renderer.FPS = this.FPS;
|
|
6726
|
-
leafer.renderer.checkRender();
|
|
6727
|
-
});
|
|
6728
|
-
target.emit(RenderEvent.CHILD_END, target);
|
|
6729
|
-
}
|
|
6730
6740
|
this.checkRender();
|
|
6731
6741
|
});
|
|
6732
6742
|
}
|
|
@@ -7208,13 +7218,11 @@ var LeaferUI = (function (exports) {
|
|
|
7208
7218
|
setFontWeight(value) {
|
|
7209
7219
|
if (typeof value === 'string') {
|
|
7210
7220
|
this.__setInput('fontWeight', value);
|
|
7211
|
-
|
|
7212
|
-
}
|
|
7213
|
-
else {
|
|
7214
|
-
if (this.__input)
|
|
7215
|
-
this.__removeInput('fontWeight');
|
|
7216
|
-
this._fontWeight = value;
|
|
7221
|
+
value = fontWeightMap[value] || 400;
|
|
7217
7222
|
}
|
|
7223
|
+
else if (this.__input)
|
|
7224
|
+
this.__removeInput('fontWeight');
|
|
7225
|
+
this._fontWeight = value;
|
|
7218
7226
|
}
|
|
7219
7227
|
setBoxStyle(value) {
|
|
7220
7228
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7541,6 +7549,9 @@ var LeaferUI = (function (exports) {
|
|
|
7541
7549
|
else
|
|
7542
7550
|
drawer.rect(x, y, width, height);
|
|
7543
7551
|
}
|
|
7552
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7553
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7554
|
+
}
|
|
7544
7555
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7545
7556
|
return Plugin.need('animate');
|
|
7546
7557
|
}
|
|
@@ -7777,6 +7788,9 @@ var LeaferUI = (function (exports) {
|
|
|
7777
7788
|
__decorate([
|
|
7778
7789
|
effectType()
|
|
7779
7790
|
], exports.UI.prototype, "filter", void 0);
|
|
7791
|
+
__decorate([
|
|
7792
|
+
surfaceType()
|
|
7793
|
+
], exports.UI.prototype, "placeholderColor", void 0);
|
|
7780
7794
|
__decorate([
|
|
7781
7795
|
dataType({})
|
|
7782
7796
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8607,10 +8621,11 @@ var LeaferUI = (function (exports) {
|
|
|
8607
8621
|
get ready() { return this.image ? this.image.ready : false; }
|
|
8608
8622
|
constructor(data) {
|
|
8609
8623
|
super(data);
|
|
8610
|
-
this.
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8624
|
+
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8625
|
+
}
|
|
8626
|
+
__onLoaded(e) {
|
|
8627
|
+
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8628
|
+
this.image = e.image;
|
|
8614
8629
|
}
|
|
8615
8630
|
destroy() {
|
|
8616
8631
|
this.image = null;
|
|
@@ -8724,7 +8739,7 @@ var LeaferUI = (function (exports) {
|
|
|
8724
8739
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8725
8740
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8726
8741
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8727
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8742
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8728
8743
|
}
|
|
8729
8744
|
__updateBoxBounds() {
|
|
8730
8745
|
const data = this.__;
|
|
@@ -8822,6 +8837,9 @@ var LeaferUI = (function (exports) {
|
|
|
8822
8837
|
__decorate([
|
|
8823
8838
|
boundsType('')
|
|
8824
8839
|
], exports.Text.prototype, "text", void 0);
|
|
8840
|
+
__decorate([
|
|
8841
|
+
boundsType('')
|
|
8842
|
+
], exports.Text.prototype, "placeholder", void 0);
|
|
8825
8843
|
__decorate([
|
|
8826
8844
|
boundsType('caption')
|
|
8827
8845
|
], exports.Text.prototype, "fontFamily", void 0);
|
|
@@ -9697,8 +9715,7 @@ var LeaferUI = (function (exports) {
|
|
|
9697
9715
|
if (this.downData) {
|
|
9698
9716
|
const canDrag = PointHelper.getDistance(this.downData, data) > this.p.dragDistance;
|
|
9699
9717
|
if (canDrag) {
|
|
9700
|
-
|
|
9701
|
-
this.pointerWaitCancel();
|
|
9718
|
+
this.pointerWaitCancel();
|
|
9702
9719
|
this.waitRightTap = false;
|
|
9703
9720
|
}
|
|
9704
9721
|
this.dragger.checkDrag(data, canDrag);
|
|
@@ -9980,9 +9997,11 @@ var LeaferUI = (function (exports) {
|
|
|
9980
9997
|
this.waitTap = true;
|
|
9981
9998
|
}
|
|
9982
9999
|
tapWaitCancel() {
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
10000
|
+
if (this.waitTap) {
|
|
10001
|
+
clearTimeout(this.tapTimer);
|
|
10002
|
+
this.waitTap = false;
|
|
10003
|
+
this.tapCount = 0;
|
|
10004
|
+
}
|
|
9986
10005
|
}
|
|
9987
10006
|
longPressWait(data) {
|
|
9988
10007
|
clearTimeout(this.longPressTimer);
|
|
@@ -10002,8 +10021,10 @@ var LeaferUI = (function (exports) {
|
|
|
10002
10021
|
return hasLong;
|
|
10003
10022
|
}
|
|
10004
10023
|
longPressWaitCancel() {
|
|
10005
|
-
|
|
10006
|
-
|
|
10024
|
+
if (this.longPressTimer) {
|
|
10025
|
+
clearTimeout(this.longPressTimer);
|
|
10026
|
+
this.longPressed = false;
|
|
10027
|
+
}
|
|
10007
10028
|
}
|
|
10008
10029
|
__onResize() {
|
|
10009
10030
|
const { dragOut } = this.m;
|
|
@@ -10244,8 +10265,10 @@ var LeaferUI = (function (exports) {
|
|
|
10244
10265
|
};
|
|
10245
10266
|
|
|
10246
10267
|
function fillText(ui, canvas) {
|
|
10247
|
-
|
|
10248
|
-
|
|
10268
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
10269
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
10270
|
+
canvas.fillStyle = data.placeholderColor;
|
|
10271
|
+
let row;
|
|
10249
10272
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10250
10273
|
row = rows[i];
|
|
10251
10274
|
if (row.text)
|
|
@@ -10254,7 +10277,7 @@ var LeaferUI = (function (exports) {
|
|
|
10254
10277
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10255
10278
|
}
|
|
10256
10279
|
if (decorationY) {
|
|
10257
|
-
const { decorationColor, decorationHeight } = data;
|
|
10280
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
10258
10281
|
if (decorationColor)
|
|
10259
10282
|
canvas.fillStyle = decorationColor;
|
|
10260
10283
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -10263,38 +10286,44 @@ var LeaferUI = (function (exports) {
|
|
|
10263
10286
|
|
|
10264
10287
|
function fill(fill, ui, canvas) {
|
|
10265
10288
|
canvas.fillStyle = fill;
|
|
10266
|
-
|
|
10289
|
+
fillPathOrText(ui, canvas);
|
|
10267
10290
|
}
|
|
10268
10291
|
function fills(fills, ui, canvas) {
|
|
10269
10292
|
let item;
|
|
10270
|
-
const { windingRule, __font } = ui.__;
|
|
10271
10293
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
10272
10294
|
item = fills[i];
|
|
10273
|
-
if (item.image
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
if (item.blendMode)
|
|
10281
|
-
canvas.blendMode = item.blendMode;
|
|
10282
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
10283
|
-
canvas.restore();
|
|
10295
|
+
if (item.image) {
|
|
10296
|
+
if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
10297
|
+
continue;
|
|
10298
|
+
if (!item.style) {
|
|
10299
|
+
if (!i && item.image.isPlacehold)
|
|
10300
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
10301
|
+
continue;
|
|
10284
10302
|
}
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10303
|
+
}
|
|
10304
|
+
canvas.fillStyle = item.style;
|
|
10305
|
+
if (item.transform) {
|
|
10306
|
+
canvas.save();
|
|
10307
|
+
canvas.transform(item.transform);
|
|
10308
|
+
if (item.blendMode)
|
|
10309
|
+
canvas.blendMode = item.blendMode;
|
|
10310
|
+
fillPathOrText(ui, canvas);
|
|
10311
|
+
canvas.restore();
|
|
10312
|
+
}
|
|
10313
|
+
else {
|
|
10314
|
+
if (item.blendMode) {
|
|
10315
|
+
canvas.saveBlendMode(item.blendMode);
|
|
10316
|
+
fillPathOrText(ui, canvas);
|
|
10317
|
+
canvas.restoreBlendMode();
|
|
10294
10318
|
}
|
|
10319
|
+
else
|
|
10320
|
+
fillPathOrText(ui, canvas);
|
|
10295
10321
|
}
|
|
10296
10322
|
}
|
|
10297
10323
|
}
|
|
10324
|
+
function fillPathOrText(ui, canvas) {
|
|
10325
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
10326
|
+
}
|
|
10298
10327
|
|
|
10299
10328
|
function strokeText(stroke, ui, canvas) {
|
|
10300
10329
|
const { strokeAlign } = ui.__;
|
|
@@ -10534,6 +10563,7 @@ var LeaferUI = (function (exports) {
|
|
|
10534
10563
|
compute,
|
|
10535
10564
|
fill,
|
|
10536
10565
|
fills,
|
|
10566
|
+
fillPathOrText,
|
|
10537
10567
|
fillText,
|
|
10538
10568
|
stroke,
|
|
10539
10569
|
strokes,
|
|
@@ -10726,6 +10756,13 @@ var LeaferUI = (function (exports) {
|
|
|
10726
10756
|
onLoadError(ui, event, error);
|
|
10727
10757
|
leafPaint.loadId = null;
|
|
10728
10758
|
});
|
|
10759
|
+
if (ui.placeholderColor)
|
|
10760
|
+
setTimeout(() => {
|
|
10761
|
+
if (!(image.ready || image.isPlacehold)) {
|
|
10762
|
+
image.isPlacehold = true;
|
|
10763
|
+
ui.forceUpdate('surface');
|
|
10764
|
+
}
|
|
10765
|
+
}, 100);
|
|
10729
10766
|
}
|
|
10730
10767
|
return leafPaint;
|
|
10731
10768
|
}
|
|
@@ -11925,7 +11962,10 @@ var LeaferUI = (function (exports) {
|
|
|
11925
11962
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
11926
11963
|
set(value) {
|
|
11927
11964
|
this.__setAttr(key, value);
|
|
11928
|
-
|
|
11965
|
+
if (this.leaferIsReady)
|
|
11966
|
+
styleName ? State.setStyleName(this, styleName, value) : State.set(this, value);
|
|
11967
|
+
else
|
|
11968
|
+
this.__layout.stateStyleChanged = true;
|
|
11929
11969
|
}
|
|
11930
11970
|
}));
|
|
11931
11971
|
}
|
|
@@ -12022,6 +12062,9 @@ var LeaferUI = (function (exports) {
|
|
|
12022
12062
|
const selectedStyle = style.selectedStyle || leaf.selectedStyle;
|
|
12023
12063
|
if (selectedStyle && State.isSelected(leaf, button))
|
|
12024
12064
|
exist = assign(style, selectedStyle);
|
|
12065
|
+
const placeholderStyle = style.placeholderStyle || leaf.placeholderStyle;
|
|
12066
|
+
if (placeholderStyle && State.isPlacehold(leaf, button))
|
|
12067
|
+
exist = assign(style, placeholderStyle);
|
|
12025
12068
|
if (State.isDisabled(leaf, button)) {
|
|
12026
12069
|
const disabledStyle = style.disabledStyle || leaf.disabledStyle;
|
|
12027
12070
|
if (disabledStyle)
|
|
@@ -12201,12 +12244,14 @@ var LeaferUI = (function (exports) {
|
|
|
12201
12244
|
transitionOut: 1,
|
|
12202
12245
|
states: 1,
|
|
12203
12246
|
state: 1,
|
|
12247
|
+
placeholder: 1,
|
|
12204
12248
|
normalStyle: 1,
|
|
12205
12249
|
hoverStyle: 1,
|
|
12206
12250
|
pressStyle: 1,
|
|
12207
12251
|
focusStyle: 1,
|
|
12208
12252
|
selectedStyle: 1,
|
|
12209
|
-
disabledStyle: 1
|
|
12253
|
+
disabledStyle: 1,
|
|
12254
|
+
placeholderStyle: 1
|
|
12210
12255
|
};
|
|
12211
12256
|
State.isState = function (state, leaf, button) { return checkState(state, leaf, button); };
|
|
12212
12257
|
State.isSelected = function (leaf, button) { return checkFixedState('selected', leaf, button); };
|
|
@@ -12214,6 +12259,7 @@ var LeaferUI = (function (exports) {
|
|
|
12214
12259
|
State.isFocus = function (leaf, button) { return checkPointerState('isFocus', leaf, button); };
|
|
12215
12260
|
State.isHover = function (leaf, button) { return checkPointerState('isHover', leaf, button); };
|
|
12216
12261
|
State.isPress = function (leaf, button) { return checkPointerState('isPress', leaf, button); };
|
|
12262
|
+
State.isPlacehold = function (leaf, _button) { return leaf.__.__isPlacehold; };
|
|
12217
12263
|
State.isDrag = function (leaf, button) { return checkPointerState('isDrag', leaf, button); };
|
|
12218
12264
|
State.setStyleName = function (leaf, stateType, value) { value ? setState(leaf, stateType, leaf[stateType]) : unsetState(leaf, stateType, leaf[stateType]); };
|
|
12219
12265
|
State.set = function (leaf, stateName) { const style = leaf.states[stateName]; style ? setState(leaf, stateName, style) : unsetState(leaf, stateName, style); };
|
|
@@ -12231,6 +12277,7 @@ var LeaferUI = (function (exports) {
|
|
|
12231
12277
|
exports.UI.addAttr('focusStyle', undefined, stateStyleType);
|
|
12232
12278
|
exports.UI.addAttr('selectedStyle', undefined, stateStyleType);
|
|
12233
12279
|
exports.UI.addAttr('disabledStyle', undefined, stateStyleType);
|
|
12280
|
+
exports.UI.addAttr('placeholderStyle', undefined, stateStyleType);
|
|
12234
12281
|
exports.UI.addAttr('button', false, dataType);
|
|
12235
12282
|
ui$3.focus = function (value = true) {
|
|
12236
12283
|
this.waitLeafer(() => {
|
|
@@ -12249,6 +12296,15 @@ var LeaferUI = (function (exports) {
|
|
|
12249
12296
|
ui$3.updateState = function () {
|
|
12250
12297
|
State.updateStyle(this, undefined, 'in');
|
|
12251
12298
|
};
|
|
12299
|
+
const text = exports.Text.prototype, textKey = 'text';
|
|
12300
|
+
defineKey(text, textKey, Object.assign(Object.assign({}, getDescriptor(text, textKey)), { set(value) {
|
|
12301
|
+
const t = this, oldValue = t.text;
|
|
12302
|
+
if (t.__setAttr(textKey, value)) {
|
|
12303
|
+
doBoundsType(t);
|
|
12304
|
+
if (t.placeholderStyle && t.placeholder && (oldValue === '' || value === ''))
|
|
12305
|
+
t.__layout.stateStyleChanged = true;
|
|
12306
|
+
}
|
|
12307
|
+
} }));
|
|
12252
12308
|
|
|
12253
12309
|
const { cos, sin, pow, sqrt: sqrt$1, abs, ceil, floor, round: round$2, PI } = Math;
|
|
12254
12310
|
const PIx5 = PI * 5;
|
|
@@ -13303,6 +13359,7 @@ var LeaferUI = (function (exports) {
|
|
|
13303
13359
|
const gaussNodes = [0.1488743389, 0.4333953941, 0.6794095682, 0.8650633666, 0.9739065285];
|
|
13304
13360
|
const gaussWeights = [0.2955242247, 0.2692667193, 0.2190863625, 0.1494513491, 0.0666713443];
|
|
13305
13361
|
const { sqrt } = Math;
|
|
13362
|
+
const { getDerivative } = BezierHelper;
|
|
13306
13363
|
const HighBezierHelper = {
|
|
13307
13364
|
getDistance(fromX, fromY, x1, y1, x2, y2, toX, toY, t = 1) {
|
|
13308
13365
|
let distance = 0, t1, t2, d1X, d1Y, d2X, d2Y, half = t / 2;
|
|
@@ -13317,10 +13374,6 @@ var LeaferUI = (function (exports) {
|
|
|
13317
13374
|
}
|
|
13318
13375
|
return distance * half;
|
|
13319
13376
|
},
|
|
13320
|
-
getDerivative(t, fromV, v1, v2, toV) {
|
|
13321
|
-
const o = 1 - t;
|
|
13322
|
-
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
13323
|
-
},
|
|
13324
13377
|
getRotation(t, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
13325
13378
|
const dx = getDerivative(t, fromX, x1, x2, toX);
|
|
13326
13379
|
const dy = getDerivative(t, fromY, y1, y2, toY);
|
|
@@ -13349,7 +13402,7 @@ var LeaferUI = (function (exports) {
|
|
|
13349
13402
|
data.push(PathCommandMap.C, ax, ay, bx, by, cx, cy);
|
|
13350
13403
|
}
|
|
13351
13404
|
};
|
|
13352
|
-
const {
|
|
13405
|
+
const { getDistance } = HighBezierHelper;
|
|
13353
13406
|
|
|
13354
13407
|
const { M, L, C, Z } = PathCommandMap;
|
|
13355
13408
|
const tempPoint = {}, tempFrom = {};
|
|
@@ -13971,4 +14024,7 @@ var LeaferUI = (function (exports) {
|
|
|
13971
14024
|
return exports;
|
|
13972
14025
|
|
|
13973
14026
|
})({});
|
|
13974
|
-
|
|
14027
|
+
|
|
14028
|
+
function Leafer(opt) { return new LeaferUI.Leafer(opt); }
|
|
14029
|
+
Object.setPrototypeOf(Leafer, LeaferUI);
|
|
14030
|
+
Leafer.prototype = LeaferUI.Leafer.prototype;
|