@leafer/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 +150 -87
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +146 -87
- 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;
|
|
@@ -6582,6 +6591,15 @@ class Renderer {
|
|
|
6582
6591
|
}
|
|
6583
6592
|
checkRender() {
|
|
6584
6593
|
if (this.running) {
|
|
6594
|
+
const { target } = this;
|
|
6595
|
+
if (target.isApp) {
|
|
6596
|
+
target.emit(RenderEvent.CHILD_START, target);
|
|
6597
|
+
target.children.forEach(leafer => {
|
|
6598
|
+
leafer.renderer.FPS = this.FPS;
|
|
6599
|
+
leafer.renderer.checkRender();
|
|
6600
|
+
});
|
|
6601
|
+
target.emit(RenderEvent.CHILD_END, target);
|
|
6602
|
+
}
|
|
6585
6603
|
if (this.changed && this.canvas.view)
|
|
6586
6604
|
this.render();
|
|
6587
6605
|
this.target.emit(RenderEvent.NEXT);
|
|
@@ -6667,7 +6685,7 @@ class Renderer {
|
|
|
6667
6685
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
6668
6686
|
canvas.clearWorld(bounds, true);
|
|
6669
6687
|
canvas.clipWorld(bounds, true);
|
|
6670
|
-
this.__render(bounds,
|
|
6688
|
+
this.__render(bounds, realBounds);
|
|
6671
6689
|
canvas.restore();
|
|
6672
6690
|
Run.end(t);
|
|
6673
6691
|
}
|
|
@@ -6676,12 +6694,12 @@ class Renderer {
|
|
|
6676
6694
|
const { canvas } = this;
|
|
6677
6695
|
canvas.save();
|
|
6678
6696
|
canvas.clear();
|
|
6679
|
-
this.__render(canvas.bounds
|
|
6697
|
+
this.__render(canvas.bounds);
|
|
6680
6698
|
canvas.restore();
|
|
6681
6699
|
Run.end(t);
|
|
6682
6700
|
}
|
|
6683
|
-
__render(bounds,
|
|
6684
|
-
const { canvas } = this, options = includes ? { includes } : { bounds, includes };
|
|
6701
|
+
__render(bounds, realBounds) {
|
|
6702
|
+
const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
|
|
6685
6703
|
if (this.needFill)
|
|
6686
6704
|
canvas.fillWorld(bounds, this.config.fill);
|
|
6687
6705
|
if (Debug.showRepaint)
|
|
@@ -6708,22 +6726,14 @@ class Renderer {
|
|
|
6708
6726
|
}
|
|
6709
6727
|
__requestRender() {
|
|
6710
6728
|
const target = this.target;
|
|
6711
|
-
if (target
|
|
6712
|
-
return target.parentApp.renderer.update(false);
|
|
6713
|
-
if (this.requestTime)
|
|
6729
|
+
if (this.requestTime || !target)
|
|
6714
6730
|
return;
|
|
6731
|
+
if (target.parentApp)
|
|
6732
|
+
return target.parentApp.requestRender(false);
|
|
6715
6733
|
const requestTime = this.requestTime = Date.now();
|
|
6716
6734
|
Platform.requestRender(() => {
|
|
6717
6735
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
|
|
6718
6736
|
this.requestTime = 0;
|
|
6719
|
-
if (target.isApp) {
|
|
6720
|
-
target.emit(RenderEvent.CHILD_START, target);
|
|
6721
|
-
target.children.forEach(leafer => {
|
|
6722
|
-
leafer.renderer.FPS = this.FPS;
|
|
6723
|
-
leafer.renderer.checkRender();
|
|
6724
|
-
});
|
|
6725
|
-
target.emit(RenderEvent.CHILD_END, target);
|
|
6726
|
-
}
|
|
6727
6737
|
this.checkRender();
|
|
6728
6738
|
});
|
|
6729
6739
|
}
|
|
@@ -7205,13 +7215,11 @@ class TextData extends UIData {
|
|
|
7205
7215
|
setFontWeight(value) {
|
|
7206
7216
|
if (typeof value === 'string') {
|
|
7207
7217
|
this.__setInput('fontWeight', value);
|
|
7208
|
-
|
|
7209
|
-
}
|
|
7210
|
-
else {
|
|
7211
|
-
if (this.__input)
|
|
7212
|
-
this.__removeInput('fontWeight');
|
|
7213
|
-
this._fontWeight = value;
|
|
7218
|
+
value = fontWeightMap[value] || 400;
|
|
7214
7219
|
}
|
|
7220
|
+
else if (this.__input)
|
|
7221
|
+
this.__removeInput('fontWeight');
|
|
7222
|
+
this._fontWeight = value;
|
|
7215
7223
|
}
|
|
7216
7224
|
setBoxStyle(value) {
|
|
7217
7225
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7538,6 +7546,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7538
7546
|
else
|
|
7539
7547
|
drawer.rect(x, y, width, height);
|
|
7540
7548
|
}
|
|
7549
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7550
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7551
|
+
}
|
|
7541
7552
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7542
7553
|
return Plugin.need('animate');
|
|
7543
7554
|
}
|
|
@@ -7774,6 +7785,9 @@ __decorate([
|
|
|
7774
7785
|
__decorate([
|
|
7775
7786
|
effectType()
|
|
7776
7787
|
], UI.prototype, "filter", void 0);
|
|
7788
|
+
__decorate([
|
|
7789
|
+
surfaceType()
|
|
7790
|
+
], UI.prototype, "placeholderColor", void 0);
|
|
7777
7791
|
__decorate([
|
|
7778
7792
|
dataType({})
|
|
7779
7793
|
], UI.prototype, "data", void 0);
|
|
@@ -8604,10 +8618,11 @@ let Image = class Image extends Rect {
|
|
|
8604
8618
|
get ready() { return this.image ? this.image.ready : false; }
|
|
8605
8619
|
constructor(data) {
|
|
8606
8620
|
super(data);
|
|
8607
|
-
this.
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
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;
|
|
8611
8626
|
}
|
|
8612
8627
|
destroy() {
|
|
8613
8628
|
this.image = null;
|
|
@@ -8721,7 +8736,7 @@ let Text = class Text extends UI {
|
|
|
8721
8736
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8722
8737
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8723
8738
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8724
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8739
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8725
8740
|
}
|
|
8726
8741
|
__updateBoxBounds() {
|
|
8727
8742
|
const data = this.__;
|
|
@@ -8819,6 +8834,9 @@ __decorate([
|
|
|
8819
8834
|
__decorate([
|
|
8820
8835
|
boundsType('')
|
|
8821
8836
|
], Text.prototype, "text", void 0);
|
|
8837
|
+
__decorate([
|
|
8838
|
+
boundsType('')
|
|
8839
|
+
], Text.prototype, "placeholder", void 0);
|
|
8822
8840
|
__decorate([
|
|
8823
8841
|
boundsType('caption')
|
|
8824
8842
|
], Text.prototype, "fontFamily", void 0);
|
|
@@ -9694,8 +9712,7 @@ class InteractionBase {
|
|
|
9694
9712
|
if (this.downData) {
|
|
9695
9713
|
const canDrag = PointHelper.getDistance(this.downData, data) > this.p.dragDistance;
|
|
9696
9714
|
if (canDrag) {
|
|
9697
|
-
|
|
9698
|
-
this.pointerWaitCancel();
|
|
9715
|
+
this.pointerWaitCancel();
|
|
9699
9716
|
this.waitRightTap = false;
|
|
9700
9717
|
}
|
|
9701
9718
|
this.dragger.checkDrag(data, canDrag);
|
|
@@ -9977,9 +9994,11 @@ class InteractionBase {
|
|
|
9977
9994
|
this.waitTap = true;
|
|
9978
9995
|
}
|
|
9979
9996
|
tapWaitCancel() {
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
|
|
9997
|
+
if (this.waitTap) {
|
|
9998
|
+
clearTimeout(this.tapTimer);
|
|
9999
|
+
this.waitTap = false;
|
|
10000
|
+
this.tapCount = 0;
|
|
10001
|
+
}
|
|
9983
10002
|
}
|
|
9984
10003
|
longPressWait(data) {
|
|
9985
10004
|
clearTimeout(this.longPressTimer);
|
|
@@ -9999,8 +10018,10 @@ class InteractionBase {
|
|
|
9999
10018
|
return hasLong;
|
|
10000
10019
|
}
|
|
10001
10020
|
longPressWaitCancel() {
|
|
10002
|
-
|
|
10003
|
-
|
|
10021
|
+
if (this.longPressTimer) {
|
|
10022
|
+
clearTimeout(this.longPressTimer);
|
|
10023
|
+
this.longPressed = false;
|
|
10024
|
+
}
|
|
10004
10025
|
}
|
|
10005
10026
|
__onResize() {
|
|
10006
10027
|
const { dragOut } = this.m;
|
|
@@ -10241,8 +10262,10 @@ canvas$1.hitPixel = function (radiusPoint, offset, scale = 1) {
|
|
|
10241
10262
|
};
|
|
10242
10263
|
|
|
10243
10264
|
function fillText(ui, canvas) {
|
|
10244
|
-
|
|
10245
|
-
|
|
10265
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
10266
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
10267
|
+
canvas.fillStyle = data.placeholderColor;
|
|
10268
|
+
let row;
|
|
10246
10269
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10247
10270
|
row = rows[i];
|
|
10248
10271
|
if (row.text)
|
|
@@ -10251,7 +10274,7 @@ function fillText(ui, canvas) {
|
|
|
10251
10274
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10252
10275
|
}
|
|
10253
10276
|
if (decorationY) {
|
|
10254
|
-
const { decorationColor, decorationHeight } = data;
|
|
10277
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
10255
10278
|
if (decorationColor)
|
|
10256
10279
|
canvas.fillStyle = decorationColor;
|
|
10257
10280
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -10260,38 +10283,44 @@ function fillText(ui, canvas) {
|
|
|
10260
10283
|
|
|
10261
10284
|
function fill(fill, ui, canvas) {
|
|
10262
10285
|
canvas.fillStyle = fill;
|
|
10263
|
-
|
|
10286
|
+
fillPathOrText(ui, canvas);
|
|
10264
10287
|
}
|
|
10265
10288
|
function fills(fills, ui, canvas) {
|
|
10266
10289
|
let item;
|
|
10267
|
-
const { windingRule, __font } = ui.__;
|
|
10268
10290
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
10269
10291
|
item = fills[i];
|
|
10270
|
-
if (item.image
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
if (item.blendMode)
|
|
10278
|
-
canvas.blendMode = item.blendMode;
|
|
10279
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
10280
|
-
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;
|
|
10281
10299
|
}
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
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();
|
|
10291
10315
|
}
|
|
10316
|
+
else
|
|
10317
|
+
fillPathOrText(ui, canvas);
|
|
10292
10318
|
}
|
|
10293
10319
|
}
|
|
10294
10320
|
}
|
|
10321
|
+
function fillPathOrText(ui, canvas) {
|
|
10322
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
10323
|
+
}
|
|
10295
10324
|
|
|
10296
10325
|
function strokeText(stroke, ui, canvas) {
|
|
10297
10326
|
const { strokeAlign } = ui.__;
|
|
@@ -10531,6 +10560,7 @@ const PaintModule = {
|
|
|
10531
10560
|
compute,
|
|
10532
10561
|
fill,
|
|
10533
10562
|
fills,
|
|
10563
|
+
fillPathOrText,
|
|
10534
10564
|
fillText,
|
|
10535
10565
|
stroke,
|
|
10536
10566
|
strokes,
|
|
@@ -10723,6 +10753,13 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10723
10753
|
onLoadError(ui, event, error);
|
|
10724
10754
|
leafPaint.loadId = null;
|
|
10725
10755
|
});
|
|
10756
|
+
if (ui.placeholderColor)
|
|
10757
|
+
setTimeout(() => {
|
|
10758
|
+
if (!(image.ready || image.isPlacehold)) {
|
|
10759
|
+
image.isPlacehold = true;
|
|
10760
|
+
ui.forceUpdate('surface');
|
|
10761
|
+
}
|
|
10762
|
+
}, 100);
|
|
10726
10763
|
}
|
|
10727
10764
|
return leafPaint;
|
|
10728
10765
|
}
|
|
@@ -12276,8 +12313,10 @@ const EditDataHelper = {
|
|
|
12276
12313
|
align = 'top-right';
|
|
12277
12314
|
}
|
|
12278
12315
|
if (lockRatio) {
|
|
12279
|
-
|
|
12280
|
-
|
|
12316
|
+
if (lockRatio === 'corner' && direction % 2) {
|
|
12317
|
+
lockRatio = false;
|
|
12318
|
+
}
|
|
12319
|
+
else {
|
|
12281
12320
|
let scale;
|
|
12282
12321
|
switch (direction) {
|
|
12283
12322
|
case top$1:
|
|
@@ -14231,6 +14270,8 @@ let TextEditor = class TextEditor extends InnerEditor {
|
|
|
14231
14270
|
const { editTarget: text, editor, editDom: dom } = this;
|
|
14232
14271
|
if (text) {
|
|
14233
14272
|
this.onInput();
|
|
14273
|
+
if (text.text === '\n')
|
|
14274
|
+
text.text = '';
|
|
14234
14275
|
text.textEditing = undefined;
|
|
14235
14276
|
if (editor.app)
|
|
14236
14277
|
editor.app.config.keyEvent = this._keyEvent;
|
|
@@ -14543,6 +14584,7 @@ interaction.multiTouch = function (data, list) {
|
|
|
14543
14584
|
return;
|
|
14544
14585
|
const { move, rotation, scale, center } = MultiTouchHelper.getData(list);
|
|
14545
14586
|
Object.assign(data, center);
|
|
14587
|
+
this.pointerWaitCancel();
|
|
14546
14588
|
this.rotate(getRotateEventData(rotation, data));
|
|
14547
14589
|
this.zoom(getZoomEventData(scale, data));
|
|
14548
14590
|
this.move(getMoveEventData(move, data));
|
|
@@ -16729,6 +16771,7 @@ ui$3.__runAnimation = function (type, complete) {
|
|
|
16729
16771
|
const gaussNodes = [0.1488743389, 0.4333953941, 0.6794095682, 0.8650633666, 0.9739065285];
|
|
16730
16772
|
const gaussWeights = [0.2955242247, 0.2692667193, 0.2190863625, 0.1494513491, 0.0666713443];
|
|
16731
16773
|
const { sqrt } = Math;
|
|
16774
|
+
const { getDerivative } = BezierHelper;
|
|
16732
16775
|
const HighBezierHelper = {
|
|
16733
16776
|
getDistance(fromX, fromY, x1, y1, x2, y2, toX, toY, t = 1) {
|
|
16734
16777
|
let distance = 0, t1, t2, d1X, d1Y, d2X, d2Y, half = t / 2;
|
|
@@ -16743,10 +16786,6 @@ const HighBezierHelper = {
|
|
|
16743
16786
|
}
|
|
16744
16787
|
return distance * half;
|
|
16745
16788
|
},
|
|
16746
|
-
getDerivative(t, fromV, v1, v2, toV) {
|
|
16747
|
-
const o = 1 - t;
|
|
16748
|
-
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
16749
|
-
},
|
|
16750
16789
|
getRotation(t, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
16751
16790
|
const dx = getDerivative(t, fromX, x1, x2, toX);
|
|
16752
16791
|
const dy = getDerivative(t, fromY, y1, y2, toY);
|
|
@@ -16775,7 +16814,7 @@ const HighBezierHelper = {
|
|
|
16775
16814
|
data.push(PathCommandMap.C, ax, ay, bx, by, cx, cy);
|
|
16776
16815
|
}
|
|
16777
16816
|
};
|
|
16778
|
-
const {
|
|
16817
|
+
const { getDistance } = HighBezierHelper;
|
|
16779
16818
|
|
|
16780
16819
|
const { M, L, C, Z } = PathCommandMap;
|
|
16781
16820
|
const tempPoint = {}, tempFrom = {};
|
|
@@ -17073,7 +17112,10 @@ function stateType(defaultValue, styleName) {
|
|
|
17073
17112
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
17074
17113
|
set(value) {
|
|
17075
17114
|
this.__setAttr(key, value);
|
|
17076
|
-
|
|
17115
|
+
if (this.leaferIsReady)
|
|
17116
|
+
styleName ? State.setStyleName(this, styleName, value) : State.set(this, value);
|
|
17117
|
+
else
|
|
17118
|
+
this.__layout.stateStyleChanged = true;
|
|
17077
17119
|
}
|
|
17078
17120
|
}));
|
|
17079
17121
|
}
|
|
@@ -17170,6 +17212,9 @@ function getStyle(leaf) {
|
|
|
17170
17212
|
const selectedStyle = style.selectedStyle || leaf.selectedStyle;
|
|
17171
17213
|
if (selectedStyle && State.isSelected(leaf, button))
|
|
17172
17214
|
exist = assign(style, selectedStyle);
|
|
17215
|
+
const placeholderStyle = style.placeholderStyle || leaf.placeholderStyle;
|
|
17216
|
+
if (placeholderStyle && State.isPlacehold(leaf, button))
|
|
17217
|
+
exist = assign(style, placeholderStyle);
|
|
17173
17218
|
if (State.isDisabled(leaf, button)) {
|
|
17174
17219
|
const disabledStyle = style.disabledStyle || leaf.disabledStyle;
|
|
17175
17220
|
if (disabledStyle)
|
|
@@ -17349,12 +17394,14 @@ State.animateExcludes = {
|
|
|
17349
17394
|
transitionOut: 1,
|
|
17350
17395
|
states: 1,
|
|
17351
17396
|
state: 1,
|
|
17397
|
+
placeholder: 1,
|
|
17352
17398
|
normalStyle: 1,
|
|
17353
17399
|
hoverStyle: 1,
|
|
17354
17400
|
pressStyle: 1,
|
|
17355
17401
|
focusStyle: 1,
|
|
17356
17402
|
selectedStyle: 1,
|
|
17357
|
-
disabledStyle: 1
|
|
17403
|
+
disabledStyle: 1,
|
|
17404
|
+
placeholderStyle: 1
|
|
17358
17405
|
};
|
|
17359
17406
|
State.isState = function (state, leaf, button) { return checkState(state, leaf, button); };
|
|
17360
17407
|
State.isSelected = function (leaf, button) { return checkFixedState('selected', leaf, button); };
|
|
@@ -17362,6 +17409,7 @@ State.isDisabled = function (leaf, button) { return checkFixedState('disabled',
|
|
|
17362
17409
|
State.isFocus = function (leaf, button) { return checkPointerState('isFocus', leaf, button); };
|
|
17363
17410
|
State.isHover = function (leaf, button) { return checkPointerState('isHover', leaf, button); };
|
|
17364
17411
|
State.isPress = function (leaf, button) { return checkPointerState('isPress', leaf, button); };
|
|
17412
|
+
State.isPlacehold = function (leaf, _button) { return leaf.__.__isPlacehold; };
|
|
17365
17413
|
State.isDrag = function (leaf, button) { return checkPointerState('isDrag', leaf, button); };
|
|
17366
17414
|
State.setStyleName = function (leaf, stateType, value) { value ? setState(leaf, stateType, leaf[stateType]) : unsetState(leaf, stateType, leaf[stateType]); };
|
|
17367
17415
|
State.set = function (leaf, stateName) { const style = leaf.states[stateName]; style ? setState(leaf, stateName, style) : unsetState(leaf, stateName, style); };
|
|
@@ -17379,6 +17427,7 @@ UI.addAttr('pressStyle', undefined, stateStyleType);
|
|
|
17379
17427
|
UI.addAttr('focusStyle', undefined, stateStyleType);
|
|
17380
17428
|
UI.addAttr('selectedStyle', undefined, stateStyleType);
|
|
17381
17429
|
UI.addAttr('disabledStyle', undefined, stateStyleType);
|
|
17430
|
+
UI.addAttr('placeholderStyle', undefined, stateStyleType);
|
|
17382
17431
|
UI.addAttr('button', false, dataType);
|
|
17383
17432
|
ui$1.focus = function (value = true) {
|
|
17384
17433
|
this.waitLeafer(() => {
|
|
@@ -17397,6 +17446,15 @@ ui$1.focus = function (value = true) {
|
|
|
17397
17446
|
ui$1.updateState = function () {
|
|
17398
17447
|
State.updateStyle(this, undefined, 'in');
|
|
17399
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
|
+
} }));
|
|
17400
17458
|
|
|
17401
17459
|
class RobotData extends UIData {
|
|
17402
17460
|
get __drawAfterFill() { return true; }
|
|
@@ -17740,7 +17798,7 @@ const ExportModule = {
|
|
|
17740
17798
|
else {
|
|
17741
17799
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
17742
17800
|
const { worldTransform, isLeafer, leafer, isFrame } = leaf;
|
|
17743
|
-
const { slice, trim, padding, onCanvas } = options;
|
|
17801
|
+
const { slice, clip, trim, padding, onCanvas } = options;
|
|
17744
17802
|
const smooth = options.smooth === undefined ? (leafer ? leafer.config.smooth : true) : options.smooth;
|
|
17745
17803
|
const contextSettings = options.contextSettings || (leafer ? leafer.config.contextSettings : undefined);
|
|
17746
17804
|
const screenshot = options.screenshot || leaf.isApp;
|
|
@@ -17784,7 +17842,9 @@ const ExportModule = {
|
|
|
17784
17842
|
scaleData.scaleY *= pixelRatio;
|
|
17785
17843
|
pixelRatio = leaf.app.pixelRatio;
|
|
17786
17844
|
}
|
|
17787
|
-
|
|
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;
|
|
17788
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) };
|
|
17789
17849
|
let canvas = Creator.canvas({ width: Math.floor(width), height: Math.floor(height), pixelRatio, smooth, contextSettings });
|
|
17790
17850
|
let sliceLeaf;
|
|
@@ -17937,4 +17997,3 @@ Object.assign(Filter, {
|
|
|
17937
17997
|
});
|
|
17938
17998
|
|
|
17939
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 };
|
|
17940
|
-
//# sourceMappingURL=worker.module.js.map
|