@leafer/worker 1.6.1 → 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 +123 -65
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +119 -65
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +20 -20
- 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$4 = LeafHelper;
|
|
4409
|
-
const { updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity:
|
|
4426
|
+
const { updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1 } = L$4;
|
|
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$2(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: worldBounds$1 } = LeafBoundsHelper;
|
|
@@ -7209,13 +7218,11 @@ var LeaferUI = (function (exports) {
|
|
|
7209
7218
|
setFontWeight(value) {
|
|
7210
7219
|
if (typeof value === 'string') {
|
|
7211
7220
|
this.__setInput('fontWeight', value);
|
|
7212
|
-
|
|
7213
|
-
}
|
|
7214
|
-
else {
|
|
7215
|
-
if (this.__input)
|
|
7216
|
-
this.__removeInput('fontWeight');
|
|
7217
|
-
this._fontWeight = value;
|
|
7221
|
+
value = fontWeightMap[value] || 400;
|
|
7218
7222
|
}
|
|
7223
|
+
else if (this.__input)
|
|
7224
|
+
this.__removeInput('fontWeight');
|
|
7225
|
+
this._fontWeight = value;
|
|
7219
7226
|
}
|
|
7220
7227
|
setBoxStyle(value) {
|
|
7221
7228
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7542,6 +7549,9 @@ var LeaferUI = (function (exports) {
|
|
|
7542
7549
|
else
|
|
7543
7550
|
drawer.rect(x, y, width, height);
|
|
7544
7551
|
}
|
|
7552
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7553
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7554
|
+
}
|
|
7545
7555
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7546
7556
|
return Plugin.need('animate');
|
|
7547
7557
|
}
|
|
@@ -7778,6 +7788,9 @@ var LeaferUI = (function (exports) {
|
|
|
7778
7788
|
__decorate([
|
|
7779
7789
|
effectType()
|
|
7780
7790
|
], exports.UI.prototype, "filter", void 0);
|
|
7791
|
+
__decorate([
|
|
7792
|
+
surfaceType()
|
|
7793
|
+
], exports.UI.prototype, "placeholderColor", void 0);
|
|
7781
7794
|
__decorate([
|
|
7782
7795
|
dataType({})
|
|
7783
7796
|
], exports.UI.prototype, "data", void 0);
|
|
@@ -8608,10 +8621,11 @@ var LeaferUI = (function (exports) {
|
|
|
8608
8621
|
get ready() { return this.image ? this.image.ready : false; }
|
|
8609
8622
|
constructor(data) {
|
|
8610
8623
|
super(data);
|
|
8611
|
-
this.
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
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;
|
|
8615
8629
|
}
|
|
8616
8630
|
destroy() {
|
|
8617
8631
|
this.image = null;
|
|
@@ -8725,7 +8739,7 @@ var LeaferUI = (function (exports) {
|
|
|
8725
8739
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8726
8740
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8727
8741
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8728
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8742
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8729
8743
|
}
|
|
8730
8744
|
__updateBoxBounds() {
|
|
8731
8745
|
const data = this.__;
|
|
@@ -8823,6 +8837,9 @@ var LeaferUI = (function (exports) {
|
|
|
8823
8837
|
__decorate([
|
|
8824
8838
|
boundsType('')
|
|
8825
8839
|
], exports.Text.prototype, "text", void 0);
|
|
8840
|
+
__decorate([
|
|
8841
|
+
boundsType('')
|
|
8842
|
+
], exports.Text.prototype, "placeholder", void 0);
|
|
8826
8843
|
__decorate([
|
|
8827
8844
|
boundsType('caption')
|
|
8828
8845
|
], exports.Text.prototype, "fontFamily", void 0);
|
|
@@ -10248,8 +10265,10 @@ var LeaferUI = (function (exports) {
|
|
|
10248
10265
|
};
|
|
10249
10266
|
|
|
10250
10267
|
function fillText(ui, canvas) {
|
|
10251
|
-
|
|
10252
|
-
|
|
10268
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
10269
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
10270
|
+
canvas.fillStyle = data.placeholderColor;
|
|
10271
|
+
let row;
|
|
10253
10272
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10254
10273
|
row = rows[i];
|
|
10255
10274
|
if (row.text)
|
|
@@ -10258,7 +10277,7 @@ var LeaferUI = (function (exports) {
|
|
|
10258
10277
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10259
10278
|
}
|
|
10260
10279
|
if (decorationY) {
|
|
10261
|
-
const { decorationColor, decorationHeight } = data;
|
|
10280
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
10262
10281
|
if (decorationColor)
|
|
10263
10282
|
canvas.fillStyle = decorationColor;
|
|
10264
10283
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -10267,38 +10286,44 @@ var LeaferUI = (function (exports) {
|
|
|
10267
10286
|
|
|
10268
10287
|
function fill(fill, ui, canvas) {
|
|
10269
10288
|
canvas.fillStyle = fill;
|
|
10270
|
-
|
|
10289
|
+
fillPathOrText(ui, canvas);
|
|
10271
10290
|
}
|
|
10272
10291
|
function fills(fills, ui, canvas) {
|
|
10273
10292
|
let item;
|
|
10274
|
-
const { windingRule, __font } = ui.__;
|
|
10275
10293
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
10276
10294
|
item = fills[i];
|
|
10277
|
-
if (item.image
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
if (item.blendMode)
|
|
10285
|
-
canvas.blendMode = item.blendMode;
|
|
10286
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
10287
|
-
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;
|
|
10288
10302
|
}
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
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();
|
|
10298
10318
|
}
|
|
10319
|
+
else
|
|
10320
|
+
fillPathOrText(ui, canvas);
|
|
10299
10321
|
}
|
|
10300
10322
|
}
|
|
10301
10323
|
}
|
|
10324
|
+
function fillPathOrText(ui, canvas) {
|
|
10325
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
10326
|
+
}
|
|
10302
10327
|
|
|
10303
10328
|
function strokeText(stroke, ui, canvas) {
|
|
10304
10329
|
const { strokeAlign } = ui.__;
|
|
@@ -10538,6 +10563,7 @@ var LeaferUI = (function (exports) {
|
|
|
10538
10563
|
compute,
|
|
10539
10564
|
fill,
|
|
10540
10565
|
fills,
|
|
10566
|
+
fillPathOrText,
|
|
10541
10567
|
fillText,
|
|
10542
10568
|
stroke,
|
|
10543
10569
|
strokes,
|
|
@@ -10730,6 +10756,13 @@ var LeaferUI = (function (exports) {
|
|
|
10730
10756
|
onLoadError(ui, event, error);
|
|
10731
10757
|
leafPaint.loadId = null;
|
|
10732
10758
|
});
|
|
10759
|
+
if (ui.placeholderColor)
|
|
10760
|
+
setTimeout(() => {
|
|
10761
|
+
if (!(image.ready || image.isPlacehold)) {
|
|
10762
|
+
image.isPlacehold = true;
|
|
10763
|
+
ui.forceUpdate('surface');
|
|
10764
|
+
}
|
|
10765
|
+
}, 100);
|
|
10733
10766
|
}
|
|
10734
10767
|
return leafPaint;
|
|
10735
10768
|
}
|
|
@@ -12283,8 +12316,10 @@ var LeaferUI = (function (exports) {
|
|
|
12283
12316
|
align = 'top-right';
|
|
12284
12317
|
}
|
|
12285
12318
|
if (lockRatio) {
|
|
12286
|
-
|
|
12287
|
-
|
|
12319
|
+
if (lockRatio === 'corner' && direction % 2) {
|
|
12320
|
+
lockRatio = false;
|
|
12321
|
+
}
|
|
12322
|
+
else {
|
|
12288
12323
|
let scale;
|
|
12289
12324
|
switch (direction) {
|
|
12290
12325
|
case top$1:
|
|
@@ -14238,6 +14273,8 @@ ${filterStyle$1}
|
|
|
14238
14273
|
const { editTarget: text, editor, editDom: dom } = this;
|
|
14239
14274
|
if (text) {
|
|
14240
14275
|
this.onInput();
|
|
14276
|
+
if (text.text === '\n')
|
|
14277
|
+
text.text = '';
|
|
14241
14278
|
text.textEditing = undefined;
|
|
14242
14279
|
if (editor.app)
|
|
14243
14280
|
editor.app.config.keyEvent = this._keyEvent;
|
|
@@ -16737,6 +16774,7 @@ ${filterStyle$1}
|
|
|
16737
16774
|
const gaussNodes = [0.1488743389, 0.4333953941, 0.6794095682, 0.8650633666, 0.9739065285];
|
|
16738
16775
|
const gaussWeights = [0.2955242247, 0.2692667193, 0.2190863625, 0.1494513491, 0.0666713443];
|
|
16739
16776
|
const { sqrt } = Math;
|
|
16777
|
+
const { getDerivative } = BezierHelper;
|
|
16740
16778
|
const HighBezierHelper = {
|
|
16741
16779
|
getDistance(fromX, fromY, x1, y1, x2, y2, toX, toY, t = 1) {
|
|
16742
16780
|
let distance = 0, t1, t2, d1X, d1Y, d2X, d2Y, half = t / 2;
|
|
@@ -16751,10 +16789,6 @@ ${filterStyle$1}
|
|
|
16751
16789
|
}
|
|
16752
16790
|
return distance * half;
|
|
16753
16791
|
},
|
|
16754
|
-
getDerivative(t, fromV, v1, v2, toV) {
|
|
16755
|
-
const o = 1 - t;
|
|
16756
|
-
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
16757
|
-
},
|
|
16758
16792
|
getRotation(t, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
16759
16793
|
const dx = getDerivative(t, fromX, x1, x2, toX);
|
|
16760
16794
|
const dy = getDerivative(t, fromY, y1, y2, toY);
|
|
@@ -16783,7 +16817,7 @@ ${filterStyle$1}
|
|
|
16783
16817
|
data.push(PathCommandMap.C, ax, ay, bx, by, cx, cy);
|
|
16784
16818
|
}
|
|
16785
16819
|
};
|
|
16786
|
-
const {
|
|
16820
|
+
const { getDistance } = HighBezierHelper;
|
|
16787
16821
|
|
|
16788
16822
|
const { M, L, C, Z } = PathCommandMap;
|
|
16789
16823
|
const tempPoint = {}, tempFrom = {};
|
|
@@ -17081,7 +17115,10 @@ ${filterStyle$1}
|
|
|
17081
17115
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
17082
17116
|
set(value) {
|
|
17083
17117
|
this.__setAttr(key, value);
|
|
17084
|
-
|
|
17118
|
+
if (this.leaferIsReady)
|
|
17119
|
+
styleName ? State.setStyleName(this, styleName, value) : State.set(this, value);
|
|
17120
|
+
else
|
|
17121
|
+
this.__layout.stateStyleChanged = true;
|
|
17085
17122
|
}
|
|
17086
17123
|
}));
|
|
17087
17124
|
}
|
|
@@ -17178,6 +17215,9 @@ ${filterStyle$1}
|
|
|
17178
17215
|
const selectedStyle = style.selectedStyle || leaf.selectedStyle;
|
|
17179
17216
|
if (selectedStyle && State.isSelected(leaf, button))
|
|
17180
17217
|
exist = assign(style, selectedStyle);
|
|
17218
|
+
const placeholderStyle = style.placeholderStyle || leaf.placeholderStyle;
|
|
17219
|
+
if (placeholderStyle && State.isPlacehold(leaf, button))
|
|
17220
|
+
exist = assign(style, placeholderStyle);
|
|
17181
17221
|
if (State.isDisabled(leaf, button)) {
|
|
17182
17222
|
const disabledStyle = style.disabledStyle || leaf.disabledStyle;
|
|
17183
17223
|
if (disabledStyle)
|
|
@@ -17357,12 +17397,14 @@ ${filterStyle$1}
|
|
|
17357
17397
|
transitionOut: 1,
|
|
17358
17398
|
states: 1,
|
|
17359
17399
|
state: 1,
|
|
17400
|
+
placeholder: 1,
|
|
17360
17401
|
normalStyle: 1,
|
|
17361
17402
|
hoverStyle: 1,
|
|
17362
17403
|
pressStyle: 1,
|
|
17363
17404
|
focusStyle: 1,
|
|
17364
17405
|
selectedStyle: 1,
|
|
17365
|
-
disabledStyle: 1
|
|
17406
|
+
disabledStyle: 1,
|
|
17407
|
+
placeholderStyle: 1
|
|
17366
17408
|
};
|
|
17367
17409
|
State.isState = function (state, leaf, button) { return checkState(state, leaf, button); };
|
|
17368
17410
|
State.isSelected = function (leaf, button) { return checkFixedState('selected', leaf, button); };
|
|
@@ -17370,6 +17412,7 @@ ${filterStyle$1}
|
|
|
17370
17412
|
State.isFocus = function (leaf, button) { return checkPointerState('isFocus', leaf, button); };
|
|
17371
17413
|
State.isHover = function (leaf, button) { return checkPointerState('isHover', leaf, button); };
|
|
17372
17414
|
State.isPress = function (leaf, button) { return checkPointerState('isPress', leaf, button); };
|
|
17415
|
+
State.isPlacehold = function (leaf, _button) { return leaf.__.__isPlacehold; };
|
|
17373
17416
|
State.isDrag = function (leaf, button) { return checkPointerState('isDrag', leaf, button); };
|
|
17374
17417
|
State.setStyleName = function (leaf, stateType, value) { value ? setState(leaf, stateType, leaf[stateType]) : unsetState(leaf, stateType, leaf[stateType]); };
|
|
17375
17418
|
State.set = function (leaf, stateName) { const style = leaf.states[stateName]; style ? setState(leaf, stateName, style) : unsetState(leaf, stateName, style); };
|
|
@@ -17387,6 +17430,7 @@ ${filterStyle$1}
|
|
|
17387
17430
|
exports.UI.addAttr('focusStyle', undefined, stateStyleType);
|
|
17388
17431
|
exports.UI.addAttr('selectedStyle', undefined, stateStyleType);
|
|
17389
17432
|
exports.UI.addAttr('disabledStyle', undefined, stateStyleType);
|
|
17433
|
+
exports.UI.addAttr('placeholderStyle', undefined, stateStyleType);
|
|
17390
17434
|
exports.UI.addAttr('button', false, dataType);
|
|
17391
17435
|
ui$1.focus = function (value = true) {
|
|
17392
17436
|
this.waitLeafer(() => {
|
|
@@ -17405,6 +17449,15 @@ ${filterStyle$1}
|
|
|
17405
17449
|
ui$1.updateState = function () {
|
|
17406
17450
|
State.updateStyle(this, undefined, 'in');
|
|
17407
17451
|
};
|
|
17452
|
+
const text = exports.Text.prototype, textKey = 'text';
|
|
17453
|
+
defineKey(text, textKey, Object.assign(Object.assign({}, getDescriptor(text, textKey)), { set(value) {
|
|
17454
|
+
const t = this, oldValue = t.text;
|
|
17455
|
+
if (t.__setAttr(textKey, value)) {
|
|
17456
|
+
doBoundsType(t);
|
|
17457
|
+
if (t.placeholderStyle && t.placeholder && (oldValue === '' || value === ''))
|
|
17458
|
+
t.__layout.stateStyleChanged = true;
|
|
17459
|
+
}
|
|
17460
|
+
} }));
|
|
17408
17461
|
|
|
17409
17462
|
class RobotData extends UIData {
|
|
17410
17463
|
get __drawAfterFill() { return true; }
|
|
@@ -17748,7 +17801,7 @@ ${filterStyle$1}
|
|
|
17748
17801
|
else {
|
|
17749
17802
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
17750
17803
|
const { worldTransform, isLeafer, leafer, isFrame } = leaf;
|
|
17751
|
-
const { slice, trim, padding, onCanvas } = options;
|
|
17804
|
+
const { slice, clip, trim, padding, onCanvas } = options;
|
|
17752
17805
|
const smooth = options.smooth === undefined ? (leafer ? leafer.config.smooth : true) : options.smooth;
|
|
17753
17806
|
const contextSettings = options.contextSettings || (leafer ? leafer.config.contextSettings : undefined);
|
|
17754
17807
|
const screenshot = options.screenshot || leaf.isApp;
|
|
@@ -17792,7 +17845,9 @@ ${filterStyle$1}
|
|
|
17792
17845
|
scaleData.scaleY *= pixelRatio;
|
|
17793
17846
|
pixelRatio = leaf.app.pixelRatio;
|
|
17794
17847
|
}
|
|
17795
|
-
|
|
17848
|
+
let { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
17849
|
+
if (clip)
|
|
17850
|
+
x += clip.x, y += clip.y, width = clip.width, height = clip.height;
|
|
17796
17851
|
const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
|
|
17797
17852
|
let canvas = Creator.canvas({ width: Math.floor(width), height: Math.floor(height), pixelRatio, smooth, contextSettings });
|
|
17798
17853
|
let sliceLeaf;
|
|
@@ -18164,4 +18219,7 @@ ${filterStyle$1}
|
|
|
18164
18219
|
return exports;
|
|
18165
18220
|
|
|
18166
18221
|
})({});
|
|
18167
|
-
|
|
18222
|
+
|
|
18223
|
+
function Leafer(opt) { return new LeaferUI.Leafer(opt); }
|
|
18224
|
+
Object.setPrototypeOf(Leafer, LeaferUI);
|
|
18225
|
+
Leafer.prototype = LeaferUI.Leafer.prototype;
|