@leafer/miniapp 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/miniapp.cjs +0 -1
- package/dist/miniapp.esm.js +0 -1
- package/dist/miniapp.module.js +144 -87
- package/dist/miniapp.module.min.js +1 -1
- package/dist/miniapp.module.min.js.map +1 -1
- package/package.json +18 -18
- package/dist/miniapp.cjs.map +0 -1
- package/dist/miniapp.esm.js.map +0 -1
- package/dist/miniapp.module.js.map +0 -1
package/dist/miniapp.cjs
CHANGED
package/dist/miniapp.esm.js
CHANGED
package/dist/miniapp.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 false; }
|
|
@@ -6449,7 +6466,7 @@ class Watcher {
|
|
|
6449
6466
|
}
|
|
6450
6467
|
}
|
|
6451
6468
|
|
|
6452
|
-
const { updateAllMatrix: updateAllMatrix$2, updateBounds: updateOneBounds,
|
|
6469
|
+
const { updateAllMatrix: updateAllMatrix$2, updateBounds: updateOneBounds, updateChange: updateOneChange } = LeafHelper;
|
|
6453
6470
|
const { pushAllChildBranch, pushAllParent } = BranchHelper;
|
|
6454
6471
|
function updateMatrix$2(updateList, levelList) {
|
|
6455
6472
|
let layout;
|
|
@@ -6492,15 +6509,7 @@ function updateBounds$1(boundsList) {
|
|
|
6492
6509
|
});
|
|
6493
6510
|
}
|
|
6494
6511
|
function updateChange(updateList) {
|
|
6495
|
-
|
|
6496
|
-
updateList.list.forEach(leaf => {
|
|
6497
|
-
layout = leaf.__layout;
|
|
6498
|
-
if (layout.opacityChanged)
|
|
6499
|
-
updateAllWorldOpacity(leaf);
|
|
6500
|
-
if (layout.stateStyleChanged)
|
|
6501
|
-
setTimeout(() => layout.stateStyleChanged && leaf.updateState());
|
|
6502
|
-
leaf.__updateChange();
|
|
6503
|
-
});
|
|
6512
|
+
updateList.list.forEach(updateOneChange);
|
|
6504
6513
|
}
|
|
6505
6514
|
|
|
6506
6515
|
const { worldBounds: worldBounds$1 } = LeafBoundsHelper;
|
|
@@ -6721,6 +6730,15 @@ class Renderer {
|
|
|
6721
6730
|
}
|
|
6722
6731
|
checkRender() {
|
|
6723
6732
|
if (this.running) {
|
|
6733
|
+
const { target } = this;
|
|
6734
|
+
if (target.isApp) {
|
|
6735
|
+
target.emit(RenderEvent.CHILD_START, target);
|
|
6736
|
+
target.children.forEach(leafer => {
|
|
6737
|
+
leafer.renderer.FPS = this.FPS;
|
|
6738
|
+
leafer.renderer.checkRender();
|
|
6739
|
+
});
|
|
6740
|
+
target.emit(RenderEvent.CHILD_END, target);
|
|
6741
|
+
}
|
|
6724
6742
|
if (this.changed && this.canvas.view)
|
|
6725
6743
|
this.render();
|
|
6726
6744
|
this.target.emit(RenderEvent.NEXT);
|
|
@@ -6806,7 +6824,7 @@ class Renderer {
|
|
|
6806
6824
|
bounds.spread(Renderer.clipSpread).ceil();
|
|
6807
6825
|
canvas.clearWorld(bounds, true);
|
|
6808
6826
|
canvas.clipWorld(bounds, true);
|
|
6809
|
-
this.__render(bounds,
|
|
6827
|
+
this.__render(bounds, realBounds);
|
|
6810
6828
|
canvas.restore();
|
|
6811
6829
|
Run.end(t);
|
|
6812
6830
|
}
|
|
@@ -6815,12 +6833,12 @@ class Renderer {
|
|
|
6815
6833
|
const { canvas } = this;
|
|
6816
6834
|
canvas.save();
|
|
6817
6835
|
canvas.clear();
|
|
6818
|
-
this.__render(canvas.bounds
|
|
6836
|
+
this.__render(canvas.bounds);
|
|
6819
6837
|
canvas.restore();
|
|
6820
6838
|
Run.end(t);
|
|
6821
6839
|
}
|
|
6822
|
-
__render(bounds,
|
|
6823
|
-
const { canvas } = this, options = includes ? { includes } : { bounds, includes };
|
|
6840
|
+
__render(bounds, realBounds) {
|
|
6841
|
+
const { canvas } = this, includes = bounds.includes(this.target.__world), options = includes ? { includes } : { bounds, includes };
|
|
6824
6842
|
if (this.needFill)
|
|
6825
6843
|
canvas.fillWorld(bounds, this.config.fill);
|
|
6826
6844
|
if (Debug.showRepaint)
|
|
@@ -6847,22 +6865,14 @@ class Renderer {
|
|
|
6847
6865
|
}
|
|
6848
6866
|
__requestRender() {
|
|
6849
6867
|
const target = this.target;
|
|
6850
|
-
if (target
|
|
6851
|
-
return target.parentApp.renderer.update(false);
|
|
6852
|
-
if (this.requestTime)
|
|
6868
|
+
if (this.requestTime || !target)
|
|
6853
6869
|
return;
|
|
6870
|
+
if (target.parentApp)
|
|
6871
|
+
return target.parentApp.requestRender(false);
|
|
6854
6872
|
const requestTime = this.requestTime = Date.now();
|
|
6855
6873
|
Platform.requestRender(() => {
|
|
6856
6874
|
this.FPS = Math.min(60, Math.ceil(1000 / (Date.now() - requestTime)));
|
|
6857
6875
|
this.requestTime = 0;
|
|
6858
|
-
if (target.isApp) {
|
|
6859
|
-
target.emit(RenderEvent.CHILD_START, target);
|
|
6860
|
-
target.children.forEach(leafer => {
|
|
6861
|
-
leafer.renderer.FPS = this.FPS;
|
|
6862
|
-
leafer.renderer.checkRender();
|
|
6863
|
-
});
|
|
6864
|
-
target.emit(RenderEvent.CHILD_END, target);
|
|
6865
|
-
}
|
|
6866
6876
|
this.checkRender();
|
|
6867
6877
|
});
|
|
6868
6878
|
}
|
|
@@ -7344,13 +7354,11 @@ class TextData extends UIData {
|
|
|
7344
7354
|
setFontWeight(value) {
|
|
7345
7355
|
if (typeof value === 'string') {
|
|
7346
7356
|
this.__setInput('fontWeight', value);
|
|
7347
|
-
|
|
7348
|
-
}
|
|
7349
|
-
else {
|
|
7350
|
-
if (this.__input)
|
|
7351
|
-
this.__removeInput('fontWeight');
|
|
7352
|
-
this._fontWeight = value;
|
|
7357
|
+
value = fontWeightMap[value] || 400;
|
|
7353
7358
|
}
|
|
7359
|
+
else if (this.__input)
|
|
7360
|
+
this.__removeInput('fontWeight');
|
|
7361
|
+
this._fontWeight = value;
|
|
7354
7362
|
}
|
|
7355
7363
|
setBoxStyle(value) {
|
|
7356
7364
|
let t = this.__leaf, box = t.__box;
|
|
@@ -7677,6 +7685,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
7677
7685
|
else
|
|
7678
7686
|
drawer.rect(x, y, width, height);
|
|
7679
7687
|
}
|
|
7688
|
+
drawImagePlaceholder(canvas, _image) {
|
|
7689
|
+
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
7690
|
+
}
|
|
7680
7691
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7681
7692
|
return Plugin.need('animate');
|
|
7682
7693
|
}
|
|
@@ -7913,6 +7924,9 @@ __decorate([
|
|
|
7913
7924
|
__decorate([
|
|
7914
7925
|
effectType()
|
|
7915
7926
|
], UI.prototype, "filter", void 0);
|
|
7927
|
+
__decorate([
|
|
7928
|
+
surfaceType()
|
|
7929
|
+
], UI.prototype, "placeholderColor", void 0);
|
|
7916
7930
|
__decorate([
|
|
7917
7931
|
dataType({})
|
|
7918
7932
|
], UI.prototype, "data", void 0);
|
|
@@ -8743,10 +8757,11 @@ let Image = class Image extends Rect {
|
|
|
8743
8757
|
get ready() { return this.image ? this.image.ready : false; }
|
|
8744
8758
|
constructor(data) {
|
|
8745
8759
|
super(data);
|
|
8746
|
-
this.
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8760
|
+
this.on_(ImageEvent.LOADED, this.__onLoaded, this);
|
|
8761
|
+
}
|
|
8762
|
+
__onLoaded(e) {
|
|
8763
|
+
if (e.attrName === 'fill' && e.attrValue.url === this.url)
|
|
8764
|
+
this.image = e.image;
|
|
8750
8765
|
}
|
|
8751
8766
|
destroy() {
|
|
8752
8767
|
this.image = null;
|
|
@@ -8860,7 +8875,7 @@ let Text = class Text extends UI {
|
|
|
8860
8875
|
data.__baseLine = data.__lineHeight - (data.__lineHeight - fontSize * 0.7) / 2;
|
|
8861
8876
|
data.__font = `${italic ? 'italic ' : ''}${textCase === 'small-caps' ? 'small-caps ' : ''}${fontWeight !== 'normal' ? fontWeight + ' ' : ''}${fontSize}px ${fontFamily}`;
|
|
8862
8877
|
data.__clipText = textOverflow !== 'show' && !data.__autoSize;
|
|
8863
|
-
data.__textDrawData = TextConvert.getDrawData(data.text, this.__);
|
|
8878
|
+
data.__textDrawData = TextConvert.getDrawData((data.__isPlacehold = data.placeholder && data.text === '') ? data.placeholder : data.text, this.__);
|
|
8864
8879
|
}
|
|
8865
8880
|
__updateBoxBounds() {
|
|
8866
8881
|
const data = this.__;
|
|
@@ -8958,6 +8973,9 @@ __decorate([
|
|
|
8958
8973
|
__decorate([
|
|
8959
8974
|
boundsType('')
|
|
8960
8975
|
], Text.prototype, "text", void 0);
|
|
8976
|
+
__decorate([
|
|
8977
|
+
boundsType('')
|
|
8978
|
+
], Text.prototype, "placeholder", void 0);
|
|
8961
8979
|
__decorate([
|
|
8962
8980
|
boundsType('caption')
|
|
8963
8981
|
], Text.prototype, "fontFamily", void 0);
|
|
@@ -9833,8 +9851,7 @@ class InteractionBase {
|
|
|
9833
9851
|
if (this.downData) {
|
|
9834
9852
|
const canDrag = PointHelper.getDistance(this.downData, data) > this.p.dragDistance;
|
|
9835
9853
|
if (canDrag) {
|
|
9836
|
-
|
|
9837
|
-
this.pointerWaitCancel();
|
|
9854
|
+
this.pointerWaitCancel();
|
|
9838
9855
|
this.waitRightTap = false;
|
|
9839
9856
|
}
|
|
9840
9857
|
this.dragger.checkDrag(data, canDrag);
|
|
@@ -10116,9 +10133,11 @@ class InteractionBase {
|
|
|
10116
10133
|
this.waitTap = true;
|
|
10117
10134
|
}
|
|
10118
10135
|
tapWaitCancel() {
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10136
|
+
if (this.waitTap) {
|
|
10137
|
+
clearTimeout(this.tapTimer);
|
|
10138
|
+
this.waitTap = false;
|
|
10139
|
+
this.tapCount = 0;
|
|
10140
|
+
}
|
|
10122
10141
|
}
|
|
10123
10142
|
longPressWait(data) {
|
|
10124
10143
|
clearTimeout(this.longPressTimer);
|
|
@@ -10138,8 +10157,10 @@ class InteractionBase {
|
|
|
10138
10157
|
return hasLong;
|
|
10139
10158
|
}
|
|
10140
10159
|
longPressWaitCancel() {
|
|
10141
|
-
|
|
10142
|
-
|
|
10160
|
+
if (this.longPressTimer) {
|
|
10161
|
+
clearTimeout(this.longPressTimer);
|
|
10162
|
+
this.longPressed = false;
|
|
10163
|
+
}
|
|
10143
10164
|
}
|
|
10144
10165
|
__onResize() {
|
|
10145
10166
|
const { dragOut } = this.m;
|
|
@@ -10485,8 +10506,10 @@ class Interaction extends InteractionBase {
|
|
|
10485
10506
|
}
|
|
10486
10507
|
|
|
10487
10508
|
function fillText(ui, canvas) {
|
|
10488
|
-
|
|
10489
|
-
|
|
10509
|
+
const data = ui.__, { rows, decorationY } = data.__textDrawData;
|
|
10510
|
+
if (data.__isPlacehold && data.placeholderColor)
|
|
10511
|
+
canvas.fillStyle = data.placeholderColor;
|
|
10512
|
+
let row;
|
|
10490
10513
|
for (let i = 0, len = rows.length; i < len; i++) {
|
|
10491
10514
|
row = rows[i];
|
|
10492
10515
|
if (row.text)
|
|
@@ -10495,7 +10518,7 @@ function fillText(ui, canvas) {
|
|
|
10495
10518
|
row.data.forEach(charData => { canvas.fillText(charData.char, charData.x, row.y); });
|
|
10496
10519
|
}
|
|
10497
10520
|
if (decorationY) {
|
|
10498
|
-
const { decorationColor, decorationHeight } = data;
|
|
10521
|
+
const { decorationColor, decorationHeight } = data.__textDrawData;
|
|
10499
10522
|
if (decorationColor)
|
|
10500
10523
|
canvas.fillStyle = decorationColor;
|
|
10501
10524
|
rows.forEach(row => decorationY.forEach(value => canvas.fillRect(row.x, row.y + value, row.width, decorationHeight)));
|
|
@@ -10504,38 +10527,44 @@ function fillText(ui, canvas) {
|
|
|
10504
10527
|
|
|
10505
10528
|
function fill(fill, ui, canvas) {
|
|
10506
10529
|
canvas.fillStyle = fill;
|
|
10507
|
-
|
|
10530
|
+
fillPathOrText(ui, canvas);
|
|
10508
10531
|
}
|
|
10509
10532
|
function fills(fills, ui, canvas) {
|
|
10510
10533
|
let item;
|
|
10511
|
-
const { windingRule, __font } = ui.__;
|
|
10512
10534
|
for (let i = 0, len = fills.length; i < len; i++) {
|
|
10513
10535
|
item = fills[i];
|
|
10514
|
-
if (item.image
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
|
|
10521
|
-
if (item.blendMode)
|
|
10522
|
-
canvas.blendMode = item.blendMode;
|
|
10523
|
-
__font ? fillText(ui, canvas) : (windingRule ? canvas.fill(windingRule) : canvas.fill());
|
|
10524
|
-
canvas.restore();
|
|
10536
|
+
if (item.image) {
|
|
10537
|
+
if (PaintImage.checkImage(ui, canvas, item, !ui.__.__font))
|
|
10538
|
+
continue;
|
|
10539
|
+
if (!item.style) {
|
|
10540
|
+
if (!i && item.image.isPlacehold)
|
|
10541
|
+
ui.drawImagePlaceholder(canvas, item.image);
|
|
10542
|
+
continue;
|
|
10525
10543
|
}
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
|
|
10533
|
-
|
|
10534
|
-
|
|
10544
|
+
}
|
|
10545
|
+
canvas.fillStyle = item.style;
|
|
10546
|
+
if (item.transform) {
|
|
10547
|
+
canvas.save();
|
|
10548
|
+
canvas.transform(item.transform);
|
|
10549
|
+
if (item.blendMode)
|
|
10550
|
+
canvas.blendMode = item.blendMode;
|
|
10551
|
+
fillPathOrText(ui, canvas);
|
|
10552
|
+
canvas.restore();
|
|
10553
|
+
}
|
|
10554
|
+
else {
|
|
10555
|
+
if (item.blendMode) {
|
|
10556
|
+
canvas.saveBlendMode(item.blendMode);
|
|
10557
|
+
fillPathOrText(ui, canvas);
|
|
10558
|
+
canvas.restoreBlendMode();
|
|
10535
10559
|
}
|
|
10560
|
+
else
|
|
10561
|
+
fillPathOrText(ui, canvas);
|
|
10536
10562
|
}
|
|
10537
10563
|
}
|
|
10538
10564
|
}
|
|
10565
|
+
function fillPathOrText(ui, canvas) {
|
|
10566
|
+
ui.__.__font ? fillText(ui, canvas) : (ui.__.windingRule ? canvas.fill(ui.__.windingRule) : canvas.fill());
|
|
10567
|
+
}
|
|
10539
10568
|
|
|
10540
10569
|
function strokeText(stroke, ui, canvas) {
|
|
10541
10570
|
const { strokeAlign } = ui.__;
|
|
@@ -10775,6 +10804,7 @@ const PaintModule = {
|
|
|
10775
10804
|
compute,
|
|
10776
10805
|
fill,
|
|
10777
10806
|
fills,
|
|
10807
|
+
fillPathOrText,
|
|
10778
10808
|
fillText,
|
|
10779
10809
|
stroke,
|
|
10780
10810
|
strokes,
|
|
@@ -10967,6 +10997,13 @@ function image(ui, attrName, paint, boxBounds, firstUse) {
|
|
|
10967
10997
|
onLoadError(ui, event, error);
|
|
10968
10998
|
leafPaint.loadId = null;
|
|
10969
10999
|
});
|
|
11000
|
+
if (ui.placeholderColor)
|
|
11001
|
+
setTimeout(() => {
|
|
11002
|
+
if (!(image.ready || image.isPlacehold)) {
|
|
11003
|
+
image.isPlacehold = true;
|
|
11004
|
+
ui.forceUpdate('surface');
|
|
11005
|
+
}
|
|
11006
|
+
}, 100);
|
|
10970
11007
|
}
|
|
10971
11008
|
return leafPaint;
|
|
10972
11009
|
}
|
|
@@ -12527,8 +12564,10 @@ const EditDataHelper = {
|
|
|
12527
12564
|
align = 'top-right';
|
|
12528
12565
|
}
|
|
12529
12566
|
if (lockRatio) {
|
|
12530
|
-
|
|
12531
|
-
|
|
12567
|
+
if (lockRatio === 'corner' && direction % 2) {
|
|
12568
|
+
lockRatio = false;
|
|
12569
|
+
}
|
|
12570
|
+
else {
|
|
12532
12571
|
let scale;
|
|
12533
12572
|
switch (direction) {
|
|
12534
12573
|
case top$1:
|
|
@@ -14563,6 +14602,7 @@ interaction.multiTouch = function (data, list) {
|
|
|
14563
14602
|
return;
|
|
14564
14603
|
const { move, rotation, scale, center } = MultiTouchHelper.getData(list);
|
|
14565
14604
|
Object.assign(data, center);
|
|
14605
|
+
this.pointerWaitCancel();
|
|
14566
14606
|
this.rotate(getRotateEventData(rotation, data));
|
|
14567
14607
|
this.zoom(getZoomEventData(scale, data));
|
|
14568
14608
|
this.move(getMoveEventData(move, data));
|
|
@@ -16687,6 +16727,7 @@ ui$3.__runAnimation = function (type, complete) {
|
|
|
16687
16727
|
const gaussNodes = [0.1488743389, 0.4333953941, 0.6794095682, 0.8650633666, 0.9739065285];
|
|
16688
16728
|
const gaussWeights = [0.2955242247, 0.2692667193, 0.2190863625, 0.1494513491, 0.0666713443];
|
|
16689
16729
|
const { sqrt } = Math;
|
|
16730
|
+
const { getDerivative } = BezierHelper;
|
|
16690
16731
|
const HighBezierHelper = {
|
|
16691
16732
|
getDistance(fromX, fromY, x1, y1, x2, y2, toX, toY, t = 1) {
|
|
16692
16733
|
let distance = 0, t1, t2, d1X, d1Y, d2X, d2Y, half = t / 2;
|
|
@@ -16701,10 +16742,6 @@ const HighBezierHelper = {
|
|
|
16701
16742
|
}
|
|
16702
16743
|
return distance * half;
|
|
16703
16744
|
},
|
|
16704
|
-
getDerivative(t, fromV, v1, v2, toV) {
|
|
16705
|
-
const o = 1 - t;
|
|
16706
|
-
return 3 * o * o * (v1 - fromV) + 6 * o * t * (v2 - v1) + 3 * t * t * (toV - v2);
|
|
16707
|
-
},
|
|
16708
16745
|
getRotation(t, fromX, fromY, x1, y1, x2, y2, toX, toY) {
|
|
16709
16746
|
const dx = getDerivative(t, fromX, x1, x2, toX);
|
|
16710
16747
|
const dy = getDerivative(t, fromY, y1, y2, toY);
|
|
@@ -16733,7 +16770,7 @@ const HighBezierHelper = {
|
|
|
16733
16770
|
data.push(PathCommandMap.C, ax, ay, bx, by, cx, cy);
|
|
16734
16771
|
}
|
|
16735
16772
|
};
|
|
16736
|
-
const {
|
|
16773
|
+
const { getDistance } = HighBezierHelper;
|
|
16737
16774
|
|
|
16738
16775
|
const { M, L, C, Z } = PathCommandMap;
|
|
16739
16776
|
const tempPoint = {}, tempFrom = {};
|
|
@@ -17031,7 +17068,10 @@ function stateType(defaultValue, styleName) {
|
|
|
17031
17068
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
17032
17069
|
set(value) {
|
|
17033
17070
|
this.__setAttr(key, value);
|
|
17034
|
-
|
|
17071
|
+
if (this.leaferIsReady)
|
|
17072
|
+
styleName ? State.setStyleName(this, styleName, value) : State.set(this, value);
|
|
17073
|
+
else
|
|
17074
|
+
this.__layout.stateStyleChanged = true;
|
|
17035
17075
|
}
|
|
17036
17076
|
}));
|
|
17037
17077
|
}
|
|
@@ -17128,6 +17168,9 @@ function getStyle(leaf) {
|
|
|
17128
17168
|
const selectedStyle = style.selectedStyle || leaf.selectedStyle;
|
|
17129
17169
|
if (selectedStyle && State.isSelected(leaf, button))
|
|
17130
17170
|
exist = assign(style, selectedStyle);
|
|
17171
|
+
const placeholderStyle = style.placeholderStyle || leaf.placeholderStyle;
|
|
17172
|
+
if (placeholderStyle && State.isPlacehold(leaf, button))
|
|
17173
|
+
exist = assign(style, placeholderStyle);
|
|
17131
17174
|
if (State.isDisabled(leaf, button)) {
|
|
17132
17175
|
const disabledStyle = style.disabledStyle || leaf.disabledStyle;
|
|
17133
17176
|
if (disabledStyle)
|
|
@@ -17307,12 +17350,14 @@ State.animateExcludes = {
|
|
|
17307
17350
|
transitionOut: 1,
|
|
17308
17351
|
states: 1,
|
|
17309
17352
|
state: 1,
|
|
17353
|
+
placeholder: 1,
|
|
17310
17354
|
normalStyle: 1,
|
|
17311
17355
|
hoverStyle: 1,
|
|
17312
17356
|
pressStyle: 1,
|
|
17313
17357
|
focusStyle: 1,
|
|
17314
17358
|
selectedStyle: 1,
|
|
17315
|
-
disabledStyle: 1
|
|
17359
|
+
disabledStyle: 1,
|
|
17360
|
+
placeholderStyle: 1
|
|
17316
17361
|
};
|
|
17317
17362
|
State.isState = function (state, leaf, button) { return checkState(state, leaf, button); };
|
|
17318
17363
|
State.isSelected = function (leaf, button) { return checkFixedState('selected', leaf, button); };
|
|
@@ -17320,6 +17365,7 @@ State.isDisabled = function (leaf, button) { return checkFixedState('disabled',
|
|
|
17320
17365
|
State.isFocus = function (leaf, button) { return checkPointerState('isFocus', leaf, button); };
|
|
17321
17366
|
State.isHover = function (leaf, button) { return checkPointerState('isHover', leaf, button); };
|
|
17322
17367
|
State.isPress = function (leaf, button) { return checkPointerState('isPress', leaf, button); };
|
|
17368
|
+
State.isPlacehold = function (leaf, _button) { return leaf.__.__isPlacehold; };
|
|
17323
17369
|
State.isDrag = function (leaf, button) { return checkPointerState('isDrag', leaf, button); };
|
|
17324
17370
|
State.setStyleName = function (leaf, stateType, value) { value ? setState(leaf, stateType, leaf[stateType]) : unsetState(leaf, stateType, leaf[stateType]); };
|
|
17325
17371
|
State.set = function (leaf, stateName) { const style = leaf.states[stateName]; style ? setState(leaf, stateName, style) : unsetState(leaf, stateName, style); };
|
|
@@ -17337,6 +17383,7 @@ UI.addAttr('pressStyle', undefined, stateStyleType);
|
|
|
17337
17383
|
UI.addAttr('focusStyle', undefined, stateStyleType);
|
|
17338
17384
|
UI.addAttr('selectedStyle', undefined, stateStyleType);
|
|
17339
17385
|
UI.addAttr('disabledStyle', undefined, stateStyleType);
|
|
17386
|
+
UI.addAttr('placeholderStyle', undefined, stateStyleType);
|
|
17340
17387
|
UI.addAttr('button', false, dataType);
|
|
17341
17388
|
ui$1.focus = function (value = true) {
|
|
17342
17389
|
this.waitLeafer(() => {
|
|
@@ -17355,6 +17402,15 @@ ui$1.focus = function (value = true) {
|
|
|
17355
17402
|
ui$1.updateState = function () {
|
|
17356
17403
|
State.updateStyle(this, undefined, 'in');
|
|
17357
17404
|
};
|
|
17405
|
+
const text = Text.prototype, textKey = 'text';
|
|
17406
|
+
defineKey(text, textKey, Object.assign(Object.assign({}, getDescriptor(text, textKey)), { set(value) {
|
|
17407
|
+
const t = this, oldValue = t.text;
|
|
17408
|
+
if (t.__setAttr(textKey, value)) {
|
|
17409
|
+
doBoundsType(t);
|
|
17410
|
+
if (t.placeholderStyle && t.placeholder && (oldValue === '' || value === ''))
|
|
17411
|
+
t.__layout.stateStyleChanged = true;
|
|
17412
|
+
}
|
|
17413
|
+
} }));
|
|
17358
17414
|
|
|
17359
17415
|
class RobotData extends UIData {
|
|
17360
17416
|
get __drawAfterFill() { return true; }
|
|
@@ -17698,7 +17754,7 @@ const ExportModule = {
|
|
|
17698
17754
|
else {
|
|
17699
17755
|
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
17700
17756
|
const { worldTransform, isLeafer, leafer, isFrame } = leaf;
|
|
17701
|
-
const { slice, trim, padding, onCanvas } = options;
|
|
17757
|
+
const { slice, clip, trim, padding, onCanvas } = options;
|
|
17702
17758
|
const smooth = options.smooth === undefined ? (leafer ? leafer.config.smooth : true) : options.smooth;
|
|
17703
17759
|
const contextSettings = options.contextSettings || (leafer ? leafer.config.contextSettings : undefined);
|
|
17704
17760
|
const screenshot = options.screenshot || leaf.isApp;
|
|
@@ -17742,7 +17798,9 @@ const ExportModule = {
|
|
|
17742
17798
|
scaleData.scaleY *= pixelRatio;
|
|
17743
17799
|
pixelRatio = leaf.app.pixelRatio;
|
|
17744
17800
|
}
|
|
17745
|
-
|
|
17801
|
+
let { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
17802
|
+
if (clip)
|
|
17803
|
+
x += clip.x, y += clip.y, width = clip.width, height = clip.height;
|
|
17746
17804
|
const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
|
|
17747
17805
|
let canvas = Creator.canvas({ width: Math.floor(width), height: Math.floor(height), pixelRatio, smooth, contextSettings });
|
|
17748
17806
|
let sliceLeaf;
|
|
@@ -17895,4 +17953,3 @@ Object.assign(Filter, {
|
|
|
17895
17953
|
});
|
|
17896
17954
|
|
|
17897
17955
|
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, HighBezierHelper, HighCurveHelper, HitCanvasManager, Image, ImageData, ImageEvent, ImageManager, IncrementId, InnerEditor, InnerEditorEvent, Interaction, 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, 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 };
|
|
17898
|
-
//# sourceMappingURL=miniapp.module.js.map
|