@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.module.js
CHANGED
|
@@ -2589,7 +2589,11 @@ const BezierHelper = {
|
|
|
2589
2589
|
const point = {};
|
|
2590
2590
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, point);
|
|
2591
2591
|
return point;
|
|
2592
|
-
}
|
|
2592
|
+
},
|
|
2593
|
+
getDerivative(t, fromV, v1, v2, toV) {
|
|
2594
|
+
const o = 1 - t;
|
|
2595
|
+
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
2596
|
+
},
|
|
2593
2597
|
};
|
|
2594
2598
|
const { getPointAndSet, toTwoPointBounds: toTwoPointBounds$1, ellipse: ellipse$6 } = BezierHelper;
|
|
2595
2599
|
|
|
@@ -3770,8 +3774,11 @@ class LeaferImage {
|
|
|
3770
3774
|
load(onSuccess, onError) {
|
|
3771
3775
|
if (!this.loading) {
|
|
3772
3776
|
this.loading = true;
|
|
3777
|
+
let { loadImage, loadImageWithProgress } = Platform.origin, onProgress = this.config.showProgress && loadImageWithProgress && this.onProgress.bind(this);
|
|
3778
|
+
if (onProgress)
|
|
3779
|
+
loadImage = loadImageWithProgress;
|
|
3773
3780
|
Resource.tasker.add(() => __awaiter(this, void 0, void 0, function* () {
|
|
3774
|
-
return yield
|
|
3781
|
+
return yield loadImage(this.url, onProgress).then(img => this.setView(img)).catch((e) => {
|
|
3775
3782
|
this.error = e;
|
|
3776
3783
|
this.onComplete(false);
|
|
3777
3784
|
});
|
|
@@ -3796,6 +3803,9 @@ class LeaferImage {
|
|
|
3796
3803
|
this.view = img;
|
|
3797
3804
|
this.onComplete(true);
|
|
3798
3805
|
}
|
|
3806
|
+
onProgress(progress) {
|
|
3807
|
+
this.progress = progress;
|
|
3808
|
+
}
|
|
3799
3809
|
onComplete(isSuccess) {
|
|
3800
3810
|
let odd;
|
|
3801
3811
|
this.waitComplete.forEach((item, index) => {
|
|
@@ -4261,13 +4271,20 @@ const LeafHelper = {
|
|
|
4261
4271
|
if (leaf.isBranch) {
|
|
4262
4272
|
const { children } = leaf;
|
|
4263
4273
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
4264
|
-
updateAllWorldOpacity
|
|
4274
|
+
updateAllWorldOpacity(children[i]);
|
|
4265
4275
|
}
|
|
4266
4276
|
}
|
|
4267
4277
|
},
|
|
4268
|
-
|
|
4269
|
-
|
|
4278
|
+
updateChange(leaf) {
|
|
4279
|
+
const layout = leaf.__layout;
|
|
4280
|
+
if (layout.stateStyleChanged)
|
|
4281
|
+
leaf.updateState();
|
|
4282
|
+
if (layout.opacityChanged)
|
|
4283
|
+
updateAllWorldOpacity(leaf);
|
|
4270
4284
|
leaf.__updateChange();
|
|
4285
|
+
},
|
|
4286
|
+
updateAllChange(leaf) {
|
|
4287
|
+
updateChange$1(leaf);
|
|
4271
4288
|
if (leaf.isBranch) {
|
|
4272
4289
|
const { children } = leaf;
|
|
4273
4290
|
for (let i = 0, len = children.length; i < len; i++) {
|
|
@@ -4403,7 +4420,7 @@ const LeafHelper = {
|
|
|
4403
4420
|
}
|
|
4404
4421
|
};
|
|
4405
4422
|
const L$4 = LeafHelper;
|
|
4406
|
-
const { updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity:
|
|
4423
|
+
const { updateAllMatrix: updateAllMatrix$4, updateMatrix: updateMatrix$4, updateAllWorldOpacity, updateAllChange: updateAllChange$1, updateChange: updateChange$1 } = L$4;
|
|
4407
4424
|
function getTempLocal(t, world) {
|
|
4408
4425
|
t.__layout.update();
|
|
4409
4426
|
return t.parent ? PointHelper.tempToInnerOf(world, t.parent.__world) : world;
|
|
@@ -6125,7 +6142,7 @@ class LeafLevelList {
|
|
|
6125
6142
|
}
|
|
6126
6143
|
}
|
|
6127
6144
|
|
|
6128
|
-
const version = "1.6.
|
|
6145
|
+
const version = "1.6.2";
|
|
6129
6146
|
|
|
6130
6147
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6131
6148
|
get allowBackgroundColor() { return true; }
|
|
@@ -6310,7 +6327,7 @@ class Watcher {
|
|
|
6310
6327
|
}
|
|
6311
6328
|
}
|
|
6312
6329
|
|
|
6313
|
-
const { updateAllMatrix: updateAllMatrix$2, updateBounds: updateOneBounds,
|
|
6330
|
+
const { updateAllMatrix: updateAllMatrix$2, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
|
|
6314
6331
|
const { pushAllChildBranch, pushAllParent } = BranchHelper;
|
|
6315
6332
|
function updateMatrix$2(updateList, levelList) {
|
|
6316
6333
|
let layout;
|
|
@@ -6353,15 +6370,7 @@ function updateBounds$1(boundsList) {
|
|
|
6353
6370
|
});
|
|
6354
6371
|
}
|
|
6355
6372
|
function updateChange(updateList) {
|
|
6356
|
-
|
|
6357
|
-
updateList.list.forEach(leaf => {
|
|
6358
|
-
layout = leaf.__layout;
|
|
6359
|
-
if (layout.opacityChanged)
|
|
6360
|
-
updateAllWorldOpacity(leaf);
|
|
6361
|
-
if (layout.stateStyleChanged)
|
|
6362
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6363
|
-
leaf.__updateChange();
|
|
6364
|
-
});
|
|
6373
|
+
updateList.list.forEach(updateOneChange);
|
|
6365
6374
|
}
|
|
6366
6375
|
|
|
6367
6376
|
const { worldBounds: worldBounds$1 } = LeafBoundsHelper;
|
|
@@ -7206,13 +7215,11 @@ class TextData extends UIData {
|
|
|
7206
7215
|
setFontWeight(value) {
|
|
7207
7216
|
if (typeof value === 'string') {
|
|
7208
7217
|
this.__setInput('fontWeight', value);
|
|
7209
|
-
|
|
7210
|
-
}
|
|
7211
|
-
else {
|
|
7212
|
-
if (this.__input)
|
|
7213
|
-
this.__removeInput('fontWeight');
|
|
7214
|
-
this._fontWeight = value;
|
|
7218
|
+
value = fontWeightMap[value] || 400;
|
|
7215
7219
|
}
|
|
7220
|
+
else if (this.__input)
|
|
7221
|
+
this.__removeInput('fontWeight');
|
|
7222
|
+
this._fontWeight = value;
|
|
7216
7223
|
}
|
|
7217
7224
|
setBoxStyle(value) {
|
|
7218
7225
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7539,6 +7546,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7539
7546
|
else
|
|
7540
7547
|
drawer.rect(x, y, width, height);
|
|
7541
7548
|
}
|
|
7549
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7550
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7551
|
+
}
|
|
7542
7552
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7543
7553
|
return Plugin.need('animate');
|
|
7544
7554
|
}
|
|
@@ -7775,6 +7785,9 @@ __decorate([
|
|
|
7775
7785
|
__decorate([
|
|
7776
7786
|
effectType()
|
|
7777
7787
|
], UI.prototype, "filter", void 0);
|
|
7788
|
+
__decorate([
|
|
7789
|
+
surfaceType()
|
|
7790
|
+
], UI.prototype, "placeholderColor", void 0);
|
|
7778
7791
|
__decorate([
|
|
7779
7792
|
dataType({})
|
|
7780
7793
|
], UI.prototype, "data", void 0);
|
|
@@ -8605,10 +8618,11 @@ let Image = class Image extends Rect {
|
|
|
8605
8618
|
get ready() { return this.image ? this.image.ready : false; }
|
|
8606
8619
|
constructor(data) {
|
|
8607
8620
|
super(data);
|
|
8608
|
-
this.
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8621
|
+
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8622
|
+
}
|
|
8623
|
+
__onLoaded(e) {
|
|
8624
|
+
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8625
|
+
this.image = e.image;
|
|
8612
8626
|
}
|
|
8613
8627
|
destroy() {
|
|
8614
8628
|
this.image = null;
|
|
@@ -8722,7 +8736,7 @@ let Text = class Text extends UI {
|
|
|
8722
8736
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8723
8737
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8724
8738
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8725
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8739
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8726
8740
|
}
|
|
8727
8741
|
__updateBoxBounds() {
|
|
8728
8742
|
const data = this.__;
|
|
@@ -8820,6 +8834,9 @@ __decorate([
|
|
|
8820
8834
|
__decorate([
|
|
8821
8835
|
boundsType('')
|
|
8822
8836
|
], Text.prototype, "text", void 0);
|
|
8837
|
+
__decorate([
|
|
8838
|
+
boundsType('')
|
|
8839
|
+
], Text.prototype, "placeholder", void 0);
|
|
8823
8840
|
__decorate([
|
|
8824
8841
|
boundsType('caption')
|
|
8825
8842
|
], Text.prototype, "fontFamily", void 0);
|
|
@@ -10245,8 +10262,10 @@ canvas$1.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
|
10245
10262
|
};
|
|
10246
10263
|
|
|
10247
10264
|
function fillText(ui, canvas) {
|
|
10248
|
-
|
|
10249
|
-
|
|
10265
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
10266
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
10267
|
+
canvas.fillStyle = data.placeholderColor;
|
|
10268
|
+
let row;
|
|
10250
10269
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10251
10270
|
row = rows[i];
|
|
10252
10271
|
if (row.text)
|
|
@@ -10255,7 +10274,7 @@ function fillText(ui, canvas) {
|
|
|
10255
10274
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10256
10275
|
}
|
|
10257
10276
|
if (decorationY) {
|
|
10258
|
-
const { decorationColor, decorationHeight } = data;
|
|
10277
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
10259
10278
|
if (decorationColor)
|
|
10260
10279
|
canvas.fillStyle = decorationColor;
|
|
10261
10280
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -10264,38 +10283,44 @@ function fillText(ui, canvas) {
|
|
|
10264
10283
|
|
|
10265
10284
|
function fill(fill, ui, canvas) {
|
|
10266
10285
|
canvas.fillStyle = fill;
|
|
10267
|
-
|
|
10286
|
+
fillPathOrText(ui, canvas);
|
|
10268
10287
|
}
|
|
10269
10288
|
function fills(fills, ui, canvas) {
|
|
10270
10289
|
let item;
|
|
10271
|
-
const { windingRule, __font } = ui.__;
|
|
10272
10290
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
10273
10291
|
item = fills[i];
|
|
10274
|
-
if (item.image
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
if (item.blendMode)
|
|
10282
|
-
canvas.blendMode = item.blendMode;
|
|
10283
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
10284
|
-
canvas.restore();
|
|
10292
|
+
if (item.image) {
|
|
10293
|
+
if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
10294
|
+
continue;
|
|
10295
|
+
if (!item.style) {
|
|
10296
|
+
if (!i && item.image.isPlacehold)
|
|
10297
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
10298
|
+
continue;
|
|
10285
10299
|
}
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10300
|
+
}
|
|
10301
|
+
canvas.fillStyle = item.style;
|
|
10302
|
+
if (item.transform) {
|
|
10303
|
+
canvas.save();
|
|
10304
|
+
canvas.transform(item.transform);
|
|
10305
|
+
if (item.blendMode)
|
|
10306
|
+
canvas.blendMode = item.blendMode;
|
|
10307
|
+
fillPathOrText(ui, canvas);
|
|
10308
|
+
canvas.restore();
|
|
10309
|
+
}
|
|
10310
|
+
else {
|
|
10311
|
+
if (item.blendMode) {
|
|
10312
|
+
canvas.saveBlendMode(item.blendMode);
|
|
10313
|
+
fillPathOrText(ui, canvas);
|
|
10314
|
+
canvas.restoreBlendMode();
|
|
10295
10315
|
}
|
|
10316
|
+
else
|
|
10317
|
+
fillPathOrText(ui, canvas);
|
|
10296
10318
|
}
|
|
10297
10319
|
}
|
|
10298
10320
|
}
|
|
10321
|
+
function fillPathOrText(ui, canvas) {
|
|
10322
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
10323
|
+
}
|
|
10299
10324
|
|
|
10300
10325
|
function strokeText(stroke, ui, canvas) {
|
|
10301
10326
|
const { strokeAlign } = ui.__;
|
|
@@ -10535,6 +10560,7 @@ const PaintModule = {
|
|
|
10535
10560
|
compute,
|
|
10536
10561
|
fill,
|
|
10537
10562
|
fills,
|
|
10563
|
+
fillPathOrText,
|
|
10538
10564
|
fillText,
|
|
10539
10565
|
stroke,
|
|
10540
10566
|
strokes,
|
|
@@ -10727,6 +10753,13 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10727
10753
|
onLoadError(ui, event, error);
|
|
10728
10754
|
leafPaint.loadId = null;
|
|
10729
10755
|
});
|
|
10756
|
+
if (ui.placeholderColor)
|
|
10757
|
+
setTimeout(() => {
|
|
10758
|
+
if (!(image.ready || image.isPlacehold)) {
|
|
10759
|
+
image.isPlacehold = true;
|
|
10760
|
+
ui.forceUpdate('surface');
|
|
10761
|
+
}
|
|
10762
|
+
}, 100);
|
|
10730
10763
|
}
|
|
10731
10764
|
return leafPaint;
|
|
10732
10765
|
}
|
|
@@ -12280,8 +12313,10 @@ const EditDataHelper = {
|
|
|
12280
12313
|
align = 'top-right';
|
|
12281
12314
|
}
|
|
12282
12315
|
if (lockRatio) {
|
|
12283
|
-
|
|
12284
|
-
|
|
12316
|
+
if (lockRatio === 'corner' && direction % 2) {
|
|
12317
|
+
lockRatio = false;
|
|
12318
|
+
}
|
|
12319
|
+
else {
|
|
12285
12320
|
let scale;
|
|
12286
12321
|
switch (direction) {
|
|
12287
12322
|
case top$1:
|
|
@@ -14235,6 +14270,8 @@ let TextEditor = class TextEditor extends InnerEditor {
|
|
|
14235
14270
|
const { editTarget: text, editor, editDom: dom } = this;
|
|
14236
14271
|
if (text) {
|
|
14237
14272
|
this.onInput();
|
|
14273
|
+
if (text.text === '\n')
|
|
14274
|
+
text.text = '';
|
|
14238
14275
|
text.textEditing = undefined;
|
|
14239
14276
|
if (editor.app)
|
|
14240
14277
|
editor.app.config.keyEvent = this._keyEvent;
|
|
@@ -16734,6 +16771,7 @@ ui$3.__runAnimation = function (type, complete) {
|
|
|
16734
16771
|
const gaussNodes = [0.1488743389, 0.4333953941, 0.6794095682, 0.8650633666, 0.9739065285];
|
|
16735
16772
|
const gaussWeights = [0.2955242247, 0.2692667193, 0.2190863625, 0.1494513491, 0.0666713443];
|
|
16736
16773
|
const { sqrt } = Math;
|
|
16774
|
+
const { getDerivative } = BezierHelper;
|
|
16737
16775
|
const HighBezierHelper = {
|
|
16738
16776
|
getDistance(fromX, fromY, x1, y1, x2, y2, toX, toY, t = 1) {
|
|
16739
16777
|
let distance = 0, t1, t2, d1X, d1Y, d2X, d2Y, half = t / 2;
|
|
@@ -16748,10 +16786,6 @@ const HighBezierHelper = {
|
|
|
16748
16786
|
}
|
|
16749
16787
|
return distance * half;
|
|
16750
16788
|
},
|
|
16751
|
-
getDerivative(t, fromV, v1, v2, toV) {
|
|
16752
|
-
const o = 1 - t;
|
|
16753
|
-
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
16754
|
-
},
|
|
16755
16789
|
getRotation(t, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
16756
16790
|
const dx = getDerivative(t, fromX, x1, x2, toX);
|
|
16757
16791
|
const dy = getDerivative(t, fromY, y1, y2, toY);
|
|
@@ -16780,7 +16814,7 @@ const HighBezierHelper = {
|
|
|
16780
16814
|
data.push(PathCommandMap.C, ax, ay, bx, by, cx, cy);
|
|
16781
16815
|
}
|
|
16782
16816
|
};
|
|
16783
|
-
const {
|
|
16817
|
+
const { getDistance } = HighBezierHelper;
|
|
16784
16818
|
|
|
16785
16819
|
const { M, L, C, Z } = PathCommandMap;
|
|
16786
16820
|
const tempPoint = {}, tempFrom = {};
|
|
@@ -17078,7 +17112,10 @@ function stateType(defaultValue, styleName) {
|
|
|
17078
17112
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
17079
17113
|
set(value) {
|
|
17080
17114
|
this.__setAttr(key, value);
|
|
17081
|
-
|
|
17115
|
+
if (this.leaferIsReady)
|
|
17116
|
+
styleName ? State.setStyleName(this, styleName, value) : State.set(this, value);
|
|
17117
|
+
else
|
|
17118
|
+
this.__layout.stateStyleChanged = true;
|
|
17082
17119
|
}
|
|
17083
17120
|
}));
|
|
17084
17121
|
}
|
|
@@ -17175,6 +17212,9 @@ function getStyle(leaf) {
|
|
|
17175
17212
|
const selectedStyle = style.selectedStyle || leaf.selectedStyle;
|
|
17176
17213
|
if (selectedStyle && State.isSelected(leaf, button))
|
|
17177
17214
|
exist = assign(style, selectedStyle);
|
|
17215
|
+
const placeholderStyle = style.placeholderStyle || leaf.placeholderStyle;
|
|
17216
|
+
if (placeholderStyle && State.isPlacehold(leaf, button))
|
|
17217
|
+
exist = assign(style, placeholderStyle);
|
|
17178
17218
|
if (State.isDisabled(leaf, button)) {
|
|
17179
17219
|
const disabledStyle = style.disabledStyle || leaf.disabledStyle;
|
|
17180
17220
|
if (disabledStyle)
|
|
@@ -17354,12 +17394,14 @@ State.animateExcludes = {
|
|
|
17354
17394
|
transitionOut: 1,
|
|
17355
17395
|
states: 1,
|
|
17356
17396
|
state: 1,
|
|
17397
|
+
placeholder: 1,
|
|
17357
17398
|
normalStyle: 1,
|
|
17358
17399
|
hoverStyle: 1,
|
|
17359
17400
|
pressStyle: 1,
|
|
17360
17401
|
focusStyle: 1,
|
|
17361
17402
|
selectedStyle: 1,
|
|
17362
|
-
disabledStyle: 1
|
|
17403
|
+
disabledStyle: 1,
|
|
17404
|
+
placeholderStyle: 1
|
|
17363
17405
|
};
|
|
17364
17406
|
State.isState = function (state, leaf, button) { return checkState(state, leaf, button); };
|
|
17365
17407
|
State.isSelected = function (leaf, button) { return checkFixedState('selected', leaf, button); };
|
|
@@ -17367,6 +17409,7 @@ State.isDisabled = function (leaf, button) { return checkFixedState('disabled',
|
|
|
17367
17409
|
State.isFocus = function (leaf, button) { return checkPointerState('isFocus', leaf, button); };
|
|
17368
17410
|
State.isHover = function (leaf, button) { return checkPointerState('isHover', leaf, button); };
|
|
17369
17411
|
State.isPress = function (leaf, button) { return checkPointerState('isPress', leaf, button); };
|
|
17412
|
+
State.isPlacehold = function (leaf, _button) { return leaf.__.__isPlacehold; };
|
|
17370
17413
|
State.isDrag = function (leaf, button) { return checkPointerState('isDrag', leaf, button); };
|
|
17371
17414
|
State.setStyleName = function (leaf, stateType, value) { value ? setState(leaf, stateType, leaf[stateType]) : unsetState(leaf, stateType, leaf[stateType]); };
|
|
17372
17415
|
State.set = function (leaf, stateName) { const style = leaf.states[stateName]; style ? setState(leaf, stateName, style) : unsetState(leaf, stateName, style); };
|
|
@@ -17384,6 +17427,7 @@ UI.addAttr('pressStyle', undefined, stateStyleType);
|
|
|
17384
17427
|
UI.addAttr('focusStyle', undefined, stateStyleType);
|
|
17385
17428
|
UI.addAttr('selectedStyle', undefined, stateStyleType);
|
|
17386
17429
|
UI.addAttr('disabledStyle', undefined, stateStyleType);
|
|
17430
|
+
UI.addAttr('placeholderStyle', undefined, stateStyleType);
|
|
17387
17431
|
UI.addAttr('button', false, dataType);
|
|
17388
17432
|
ui$1.focus = function (value = true) {
|
|
17389
17433
|
this.waitLeafer(() => {
|
|
@@ -17402,6 +17446,15 @@ ui$1.focus = function (value = true) {
|
|
|
17402
17446
|
ui$1.updateState = function () {
|
|
17403
17447
|
State.updateStyle(this, undefined, 'in');
|
|
17404
17448
|
};
|
|
17449
|
+
const text = Text.prototype, textKey = 'text';
|
|
17450
|
+
defineKey(text, textKey, Object.assign(Object.assign({}, getDescriptor(text, textKey)), { set(value) {
|
|
17451
|
+
const t = this, oldValue = t.text;
|
|
17452
|
+
if (t.__setAttr(textKey, value)) {
|
|
17453
|
+
doBoundsType(t);
|
|
17454
|
+
if (t.placeholderStyle && t.placeholder && (oldValue === '' || value === ''))
|
|
17455
|
+
t.__layout.stateStyleChanged = true;
|
|
17456
|
+
}
|
|
17457
|
+
} }));
|
|
17405
17458
|
|
|
17406
17459
|
class RobotData extends UIData {
|
|
17407
17460
|
get __drawAfterFill() { return true; }
|
|
@@ -17745,7 +17798,7 @@ const ExportModule = {
|
|
|
17745
17798
|
else {
|
|
17746
17799
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
17747
17800
|
const { worldTransform, isLeafer, leafer, isFrame } = leaf;
|
|
17748
|
-
const { slice, trim, padding, onCanvas } = options;
|
|
17801
|
+
const { slice, clip, trim, padding, onCanvas } = options;
|
|
17749
17802
|
const smooth = options.smooth === undefined ? (leafer ? leafer.config.smooth : true) : options.smooth;
|
|
17750
17803
|
const contextSettings = options.contextSettings || (leafer ? leafer.config.contextSettings : undefined);
|
|
17751
17804
|
const screenshot = options.screenshot || leaf.isApp;
|
|
@@ -17789,7 +17842,9 @@ const ExportModule = {
|
|
|
17789
17842
|
scaleData.scaleY *= pixelRatio;
|
|
17790
17843
|
pixelRatio = leaf.app.pixelRatio;
|
|
17791
17844
|
}
|
|
17792
|
-
|
|
17845
|
+
let { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
17846
|
+
if (clip)
|
|
17847
|
+
x += clip.x, y += clip.y, width = clip.width, height = clip.height;
|
|
17793
17848
|
const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
|
|
17794
17849
|
let canvas = Creator.canvas({ width: Math.floor(width), height: Math.floor(height), pixelRatio, smooth, contextSettings });
|
|
17795
17850
|
let sliceLeaf;
|
|
@@ -17942,4 +17997,3 @@ Object.assign(Filter, {
|
|
|
17942
17997
|
});
|
|
17943
17998
|
|
|
17944
17999
|
export { AlignHelper, Animate, AnimateEasing, AnimateEvent, AnimateList, Answer, App, AroundHelper, Arrow, ArrowData, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, Cursor, DataHelper, Debug, Direction4, Direction9, DragEvent, Dragger, DropEvent, EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Eventer, Export, FileHelper, Filter, Finder, Flow, Frame, FrameData, Group, GroupData, HTMLText, HTMLTextData, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, InteractionBase, InteractionHelper, KeyEvent, Keyboard, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, LeaferTypeCreator, Line, LineData, LineEditTool, MathHelper, Matrix, MatrixHelper, MoveEvent, MultiTouchHelper, MyDragEvent, MyImage, MyPointerEvent, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathArrowModule, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathMatrixHelper, PathNumberCommandLengthMap, PathNumberCommandMap, PathScaler, Pen, PenData, Picker, Platform, Plugin, Point, PointHelper, PointerButton, PointerEvent, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Resource, Robot, RobotData, RotateEvent, Run, ScrollBar, SelectArea, Selector, Star, StarData, State, StringNumberMap, Stroker, SwipeEvent, TaskItem, TaskProcessor, Text, TextConvert, TextData, TextEditor, Transformer, Transition, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIEvent, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, WheelEventHelper, ZoomEvent, addViewport, addViewportConfig, affectRenderBoundsType, affectStrokeBoundsType, arrowType, attr, autoLayoutType, boundsType, canvasPatch, canvasSizeAttrs, cursorType, dataProcessor, dataType, decorateLeafAttr, defineDataProcessor, defineKey, defineLeafAttr, doBoundsType, doStrokeType, effectType, emptyData, eraserType, getBoundsData, getDescriptor, getMatrixData, getPointData, hitType, isEmptyData, isNull, layoutProcessor, maskType, motionPathType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerEditTool, registerInnerEditor, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleResize, scaleResizeFontSize, scaleResizeGroup, scaleResizePath, scaleResizePoints, scaleType, sortType, stateStyleType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$4 as tempPoint, useCanvas, useModule, version, visibleType, zoomLayerType };
|
|
17945
|
-
//# sourceMappingURL=worker.module.js.map
|