@leafer-ui/miniapp 1.0.0-rc.24 → 1.0.0-rc.26
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.esm.js +78 -50
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.module.js +167 -75
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +10 -10
package/dist/miniapp.module.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
const Platform = {
|
|
2
|
+
toURL(text, fileType) {
|
|
3
|
+
let url = encodeURIComponent(text);
|
|
4
|
+
if (fileType === 'text')
|
|
5
|
+
url = 'data:text/plain;charset=utf-8,' + url;
|
|
6
|
+
else if (fileType === 'svg')
|
|
7
|
+
url = 'data:image/svg+xml,' + url;
|
|
8
|
+
return url;
|
|
9
|
+
},
|
|
2
10
|
image: {
|
|
3
11
|
hitCanvasSize: 100,
|
|
4
12
|
maxCacheSize: 2560 * 1600,
|
|
@@ -956,6 +964,9 @@ const BoundsHelper = {
|
|
|
956
964
|
points.forEach((point, index) => index === 0 ? setPoint$3(tempPointBounds$1, point.x, point.y) : addPoint$3(tempPointBounds$1, point.x, point.y));
|
|
957
965
|
toBounds$4(tempPointBounds$1, t);
|
|
958
966
|
},
|
|
967
|
+
setPoint(t, point) {
|
|
968
|
+
B.set(t, point.x, point.y);
|
|
969
|
+
},
|
|
959
970
|
addPoint(t, point) {
|
|
960
971
|
add$1(t, point, true);
|
|
961
972
|
},
|
|
@@ -1104,6 +1115,10 @@ class Bounds {
|
|
|
1104
1115
|
BoundsHelper.setListWithFn(this, list, boundsDataFn);
|
|
1105
1116
|
return this;
|
|
1106
1117
|
}
|
|
1118
|
+
setPoint(point) {
|
|
1119
|
+
BoundsHelper.setPoint(this, point);
|
|
1120
|
+
return this;
|
|
1121
|
+
}
|
|
1107
1122
|
setPoints(points) {
|
|
1108
1123
|
BoundsHelper.setPoints(this, points);
|
|
1109
1124
|
return this;
|
|
@@ -1207,10 +1222,10 @@ directionData.forEach(item => item.type = 'percent');
|
|
|
1207
1222
|
const AroundHelper = {
|
|
1208
1223
|
directionData,
|
|
1209
1224
|
tempPoint: {},
|
|
1210
|
-
get: get$
|
|
1225
|
+
get: get$4,
|
|
1211
1226
|
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1212
1227
|
to || (to = {});
|
|
1213
|
-
const point = get$
|
|
1228
|
+
const point = get$4(around);
|
|
1214
1229
|
to.x = point.x;
|
|
1215
1230
|
to.y = point.y;
|
|
1216
1231
|
if (point.type === 'percent') {
|
|
@@ -1231,7 +1246,7 @@ const AroundHelper = {
|
|
|
1231
1246
|
}
|
|
1232
1247
|
}
|
|
1233
1248
|
};
|
|
1234
|
-
function get$
|
|
1249
|
+
function get$4(around) {
|
|
1235
1250
|
return typeof around === 'string' ? directionData[Direction9[around]] : around;
|
|
1236
1251
|
}
|
|
1237
1252
|
|
|
@@ -3808,6 +3823,7 @@ function hitType(defaultValue) {
|
|
|
3808
3823
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
3809
3824
|
set(value) {
|
|
3810
3825
|
if (this.__setAttr(key, value)) {
|
|
3826
|
+
this.__layout.hitCanvasChanged = true;
|
|
3811
3827
|
if (Debug.showHitView) {
|
|
3812
3828
|
this.__layout.surfaceChanged || this.__layout.surfaceChange();
|
|
3813
3829
|
}
|
|
@@ -3950,7 +3966,7 @@ function registerUIEvent() {
|
|
|
3950
3966
|
};
|
|
3951
3967
|
}
|
|
3952
3968
|
|
|
3953
|
-
const { copy: copy$7, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$
|
|
3969
|
+
const { copy: copy$7, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
3954
3970
|
const matrix$1 = {};
|
|
3955
3971
|
const LeafHelper = {
|
|
3956
3972
|
updateAllMatrix(leaf, checkAutoLayout, waitAutoLayout) {
|
|
@@ -4036,7 +4052,7 @@ const LeafHelper = {
|
|
|
4036
4052
|
},
|
|
4037
4053
|
zoomOfLocal(t, origin, scaleX, scaleY = scaleX, resize) {
|
|
4038
4054
|
copy$7(matrix$1, t.__localMatrix);
|
|
4039
|
-
scaleOfOuter$
|
|
4055
|
+
scaleOfOuter$2(matrix$1, origin, scaleX, scaleY);
|
|
4040
4056
|
moveByMatrix(t, matrix$1);
|
|
4041
4057
|
t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4042
4058
|
},
|
|
@@ -4045,7 +4061,7 @@ const LeafHelper = {
|
|
|
4045
4061
|
},
|
|
4046
4062
|
rotateOfLocal(t, origin, angle) {
|
|
4047
4063
|
copy$7(matrix$1, t.__localMatrix);
|
|
4048
|
-
rotateOfOuter$
|
|
4064
|
+
rotateOfOuter$2(matrix$1, origin, angle);
|
|
4049
4065
|
moveByMatrix(t, matrix$1);
|
|
4050
4066
|
t.rotation = MathHelper.formatRotation(t.rotation + angle);
|
|
4051
4067
|
},
|
|
@@ -4072,11 +4088,24 @@ const LeafHelper = {
|
|
|
4072
4088
|
setTransform(t, transform, resize) {
|
|
4073
4089
|
const layout = getLayout(transform);
|
|
4074
4090
|
if (resize) {
|
|
4075
|
-
|
|
4091
|
+
const scaleX = layout.scaleX / t.scaleX;
|
|
4092
|
+
const scaleY = layout.scaleY / t.scaleY;
|
|
4076
4093
|
delete layout.scaleX;
|
|
4077
4094
|
delete layout.scaleY;
|
|
4095
|
+
t.set(layout);
|
|
4096
|
+
t.scaleResize(scaleX, scaleY, resize !== true);
|
|
4078
4097
|
}
|
|
4079
|
-
|
|
4098
|
+
else {
|
|
4099
|
+
t.set(layout);
|
|
4100
|
+
}
|
|
4101
|
+
},
|
|
4102
|
+
getLocalOrigin(t, origin) {
|
|
4103
|
+
return PointHelper.tempToOuterOf(L.getInnerOrigin(t, origin), t.localTransform);
|
|
4104
|
+
},
|
|
4105
|
+
getInnerOrigin(t, origin) {
|
|
4106
|
+
if (typeof origin === 'string')
|
|
4107
|
+
AroundHelper.toPoint(origin, t.boxBounds, origin = {});
|
|
4108
|
+
return origin;
|
|
4080
4109
|
},
|
|
4081
4110
|
getRelativeWorld(t, relative, temp) {
|
|
4082
4111
|
copy$7(matrix$1, t.worldTransform);
|
|
@@ -5072,8 +5101,8 @@ const BranchRender = {
|
|
|
5072
5101
|
const { LEAF, create } = IncrementId;
|
|
5073
5102
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper;
|
|
5074
5103
|
const { toOuterOf } = BoundsHelper;
|
|
5075
|
-
const {
|
|
5076
|
-
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getRelativeWorld, drop } = LeafHelper;
|
|
5104
|
+
const { copy: copy$4 } = PointHelper;
|
|
5105
|
+
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper;
|
|
5077
5106
|
let Leaf = class Leaf {
|
|
5078
5107
|
get tag() { return this.__tag; }
|
|
5079
5108
|
set tag(_value) { }
|
|
@@ -5166,6 +5195,9 @@ let Leaf = class Leaf {
|
|
|
5166
5195
|
toString() {
|
|
5167
5196
|
return JSON.stringify(this.toJSON());
|
|
5168
5197
|
}
|
|
5198
|
+
toSVG() { return undefined; }
|
|
5199
|
+
__SVG(_data) { }
|
|
5200
|
+
toHTML() { return undefined; }
|
|
5169
5201
|
__setAttr(_attrName, _newValue) { return true; }
|
|
5170
5202
|
__getAttr(_attrName) { return undefined; }
|
|
5171
5203
|
setProxyAttr(_attrName, _newValue) { }
|
|
@@ -5331,13 +5363,13 @@ let Leaf = class Leaf {
|
|
|
5331
5363
|
moveLocal(this, x, y);
|
|
5332
5364
|
}
|
|
5333
5365
|
scaleOf(origin, scaleX, scaleY, resize) {
|
|
5334
|
-
zoomOfLocal(this,
|
|
5366
|
+
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize);
|
|
5335
5367
|
}
|
|
5336
5368
|
rotateOf(origin, rotation) {
|
|
5337
|
-
rotateOfLocal(this,
|
|
5369
|
+
rotateOfLocal(this, getLocalOrigin(this, origin), rotation);
|
|
5338
5370
|
}
|
|
5339
5371
|
skewOf(origin, skewX, skewY, resize) {
|
|
5340
|
-
skewOfLocal(this,
|
|
5372
|
+
skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize);
|
|
5341
5373
|
}
|
|
5342
5374
|
transformWorld(worldTransform, resize) {
|
|
5343
5375
|
transformWorld(this, worldTransform, resize);
|
|
@@ -5359,6 +5391,14 @@ let Leaf = class Leaf {
|
|
|
5359
5391
|
this.scaleY *= scaleY;
|
|
5360
5392
|
}
|
|
5361
5393
|
__scaleResize(_scaleX, _scaleY) { }
|
|
5394
|
+
resizeWidth(width) {
|
|
5395
|
+
const scale = width / this.__localBoxBounds.width;
|
|
5396
|
+
this.scaleResize(scale, this.__.lockRatio ? scale : 1);
|
|
5397
|
+
}
|
|
5398
|
+
resizeHeight(height) {
|
|
5399
|
+
const scale = height / this.__localBoxBounds.height;
|
|
5400
|
+
this.scaleResize(this.__.lockRatio ? scale : 1, scale);
|
|
5401
|
+
}
|
|
5362
5402
|
__hitWorld(_point) { return true; }
|
|
5363
5403
|
__hit(_local) { return true; }
|
|
5364
5404
|
__hitFill(_inner) { return true; }
|
|
@@ -5709,7 +5749,7 @@ class LeafLevelList {
|
|
|
5709
5749
|
}
|
|
5710
5750
|
}
|
|
5711
5751
|
|
|
5712
|
-
const version = "1.0.0-rc.
|
|
5752
|
+
const version = "1.0.0-rc.26";
|
|
5713
5753
|
const inviteCode = {};
|
|
5714
5754
|
|
|
5715
5755
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
@@ -5834,9 +5874,12 @@ function useCanvas(_canvasType, app) {
|
|
|
5834
5874
|
if (toAlbum) {
|
|
5835
5875
|
Platform.miniapp.saveToAlbum(filePath).then(() => {
|
|
5836
5876
|
fs.unlink({ filePath });
|
|
5877
|
+
resolve();
|
|
5837
5878
|
});
|
|
5838
5879
|
}
|
|
5839
|
-
|
|
5880
|
+
else {
|
|
5881
|
+
resolve();
|
|
5882
|
+
}
|
|
5840
5883
|
},
|
|
5841
5884
|
fail(error) {
|
|
5842
5885
|
reject(error);
|
|
@@ -6607,8 +6650,12 @@ class Picker {
|
|
|
6607
6650
|
hitChild(child, point, proxy) {
|
|
6608
6651
|
if (this.exclude && this.exclude.has(child))
|
|
6609
6652
|
return;
|
|
6610
|
-
if (child.__hitWorld(point))
|
|
6653
|
+
if (child.__hitWorld(point)) {
|
|
6654
|
+
const { parent } = child;
|
|
6655
|
+
if (parent && parent.__hasMask && !child.__.mask && !parent.children.some(item => item.__.mask && item.__hitWorld(point)))
|
|
6656
|
+
return;
|
|
6611
6657
|
this.findList.add(proxy || child);
|
|
6658
|
+
}
|
|
6612
6659
|
}
|
|
6613
6660
|
clear() {
|
|
6614
6661
|
this.point = null;
|
|
@@ -7369,7 +7416,7 @@ __decorate([
|
|
|
7369
7416
|
stateType(false)
|
|
7370
7417
|
], UI.prototype, "disabled", void 0);
|
|
7371
7418
|
__decorate([
|
|
7372
|
-
|
|
7419
|
+
surfaceType(false)
|
|
7373
7420
|
], UI.prototype, "locked", void 0);
|
|
7374
7421
|
__decorate([
|
|
7375
7422
|
sortType(0)
|
|
@@ -7451,10 +7498,10 @@ __decorate([
|
|
|
7451
7498
|
], UI.prototype, "gap", void 0);
|
|
7452
7499
|
__decorate([
|
|
7453
7500
|
boundsType('top-left')
|
|
7454
|
-
], UI.prototype, "
|
|
7501
|
+
], UI.prototype, "flowAlign", void 0);
|
|
7455
7502
|
__decorate([
|
|
7456
7503
|
boundsType(false)
|
|
7457
|
-
], UI.prototype, "
|
|
7504
|
+
], UI.prototype, "flowWrap", void 0);
|
|
7458
7505
|
__decorate([
|
|
7459
7506
|
boundsType('box')
|
|
7460
7507
|
], UI.prototype, "itemBox", void 0);
|
|
@@ -7467,6 +7514,9 @@ __decorate([
|
|
|
7467
7514
|
__decorate([
|
|
7468
7515
|
boundsType()
|
|
7469
7516
|
], UI.prototype, "autoHeight", void 0);
|
|
7517
|
+
__decorate([
|
|
7518
|
+
boundsType()
|
|
7519
|
+
], UI.prototype, "lockRatio", void 0);
|
|
7470
7520
|
__decorate([
|
|
7471
7521
|
boundsType()
|
|
7472
7522
|
], UI.prototype, "autoBox", void 0);
|
|
@@ -8056,9 +8106,9 @@ let Box = class Box extends Group {
|
|
|
8056
8106
|
if (!data.__autoSize) {
|
|
8057
8107
|
const b = this.__layout.boxBounds;
|
|
8058
8108
|
if (!data.__autoWidth)
|
|
8059
|
-
b.
|
|
8109
|
+
b.height += b.y, b.width = data.width, b.x = b.y = 0;
|
|
8060
8110
|
if (!data.__autoHeight)
|
|
8061
|
-
b.
|
|
8111
|
+
b.width += b.x, b.height = data.height, b.y = b.x = 0;
|
|
8062
8112
|
}
|
|
8063
8113
|
}
|
|
8064
8114
|
else {
|
|
@@ -8128,6 +8178,9 @@ let Box = class Box extends Group {
|
|
|
8128
8178
|
__decorate([
|
|
8129
8179
|
dataProcessor(BoxData)
|
|
8130
8180
|
], Box.prototype, "__", void 0);
|
|
8181
|
+
__decorate([
|
|
8182
|
+
dataType(false)
|
|
8183
|
+
], Box.prototype, "resizeChildren", void 0);
|
|
8131
8184
|
__decorate([
|
|
8132
8185
|
affectRenderBoundsType('show')
|
|
8133
8186
|
], Box.prototype, "overflow", void 0);
|
|
@@ -8237,7 +8290,7 @@ Ellipse = __decorate([
|
|
|
8237
8290
|
], Ellipse);
|
|
8238
8291
|
|
|
8239
8292
|
const { moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1 } = PathCommandDataHelper;
|
|
8240
|
-
const { rotate: rotate$1, getAngle: getAngle$
|
|
8293
|
+
const { rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint } = PointHelper;
|
|
8241
8294
|
const { toBounds: toBounds$1 } = PathBounds;
|
|
8242
8295
|
let Line = class Line extends UI {
|
|
8243
8296
|
get __tag() { return 'Line'; }
|
|
@@ -8252,7 +8305,7 @@ let Line = class Line extends UI {
|
|
|
8252
8305
|
}
|
|
8253
8306
|
set toPoint(value) {
|
|
8254
8307
|
this.width = getDistance$2(defaultPoint, value);
|
|
8255
|
-
this.rotation = getAngle$
|
|
8308
|
+
this.rotation = getAngle$1(defaultPoint, value);
|
|
8256
8309
|
if (this.height)
|
|
8257
8310
|
this.height = 0;
|
|
8258
8311
|
}
|
|
@@ -8599,6 +8652,9 @@ __decorate([
|
|
|
8599
8652
|
__decorate([
|
|
8600
8653
|
boundsType(0)
|
|
8601
8654
|
], Text.prototype, "height", void 0);
|
|
8655
|
+
__decorate([
|
|
8656
|
+
dataType(false)
|
|
8657
|
+
], Text.prototype, "resizeFontSize", void 0);
|
|
8602
8658
|
__decorate([
|
|
8603
8659
|
surfaceType('#000000')
|
|
8604
8660
|
], Text.prototype, "fill", void 0);
|
|
@@ -8998,6 +9054,14 @@ let DragEvent = class DragEvent extends PointerEvent {
|
|
|
8998
9054
|
getLocalTotal(relative) {
|
|
8999
9055
|
return this.getLocalMove(relative, true);
|
|
9000
9056
|
}
|
|
9057
|
+
getPageBounds() {
|
|
9058
|
+
const total = this.getPageTotal();
|
|
9059
|
+
const start = this.getPage();
|
|
9060
|
+
const bounds = {};
|
|
9061
|
+
BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y);
|
|
9062
|
+
BoundsHelper.unsign(bounds);
|
|
9063
|
+
return bounds;
|
|
9064
|
+
}
|
|
9001
9065
|
assignMove(total) {
|
|
9002
9066
|
move.x = total ? this.totalX : this.moveX;
|
|
9003
9067
|
move.y = total ? this.totalY : this.moveY;
|
|
@@ -9614,7 +9678,8 @@ const config = {
|
|
|
9614
9678
|
swipeDistance: 20,
|
|
9615
9679
|
preventDefaultMenu: true
|
|
9616
9680
|
},
|
|
9617
|
-
cursor: {}
|
|
9681
|
+
cursor: {},
|
|
9682
|
+
keyEvent: true
|
|
9618
9683
|
};
|
|
9619
9684
|
|
|
9620
9685
|
const { pathHasEventType, getMoveEventData, getZoomEventData, getRotateEventData } = InteractionHelper;
|
|
@@ -9764,6 +9829,8 @@ class InteractionBase {
|
|
|
9764
9829
|
this.transformer.transformEnd();
|
|
9765
9830
|
}
|
|
9766
9831
|
keyDown(data) {
|
|
9832
|
+
if (!this.config.keyEvent)
|
|
9833
|
+
return;
|
|
9767
9834
|
const { code } = data;
|
|
9768
9835
|
if (!this.downKeyMap[code]) {
|
|
9769
9836
|
this.downKeyMap[code] = true;
|
|
@@ -9777,6 +9844,8 @@ class InteractionBase {
|
|
|
9777
9844
|
this.emit(KeyEvent.DOWN, data, this.defaultPath);
|
|
9778
9845
|
}
|
|
9779
9846
|
keyUp(data) {
|
|
9847
|
+
if (!this.config.keyEvent)
|
|
9848
|
+
return;
|
|
9780
9849
|
const { code } = data;
|
|
9781
9850
|
this.downKeyMap[code] = false;
|
|
9782
9851
|
Keyboard.setUpCode(code);
|
|
@@ -10166,11 +10235,11 @@ ui$2.__hit = function (inner) {
|
|
|
10166
10235
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10167
10236
|
return true;
|
|
10168
10237
|
const { hitFill } = data;
|
|
10169
|
-
const needHitFillPath = (
|
|
10238
|
+
const needHitFillPath = (data.fill && hitFill && hitFill !== 'none') || hitFill === 'all';
|
|
10170
10239
|
if (needHitFillPath && this.__hitFill(inner))
|
|
10171
10240
|
return true;
|
|
10172
10241
|
const { hitStroke, __strokeWidth } = data;
|
|
10173
|
-
const needHitStrokePath = (
|
|
10242
|
+
const needHitStrokePath = (data.stroke && hitFill && hitStroke !== 'none') || hitStroke === 'all';
|
|
10174
10243
|
if (!needHitFillPath && !needHitStrokePath)
|
|
10175
10244
|
return false;
|
|
10176
10245
|
const radiusWidth = inner.radiusX * 2;
|
|
@@ -10202,8 +10271,10 @@ ui$2.__hit = function (inner) {
|
|
|
10202
10271
|
const ui$1 = new UI();
|
|
10203
10272
|
const rect = Rect.prototype;
|
|
10204
10273
|
rect.__updateHitCanvas = function () {
|
|
10205
|
-
if (this.stroke || this.cornerRadius)
|
|
10274
|
+
if (this.stroke || this.cornerRadius || (this.fill && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
10206
10275
|
ui$1.__updateHitCanvas.call(this);
|
|
10276
|
+
else if (this.__hitCanvas)
|
|
10277
|
+
this.__hitCanvas = null;
|
|
10207
10278
|
};
|
|
10208
10279
|
rect.__hitFill = function (inner) {
|
|
10209
10280
|
return this.__hitCanvas ? ui$1.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
@@ -10612,7 +10683,7 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
10612
10683
|
case 'angular':
|
|
10613
10684
|
return PaintGradient.conicGradient(paint, boxBounds);
|
|
10614
10685
|
default:
|
|
10615
|
-
return paint.r ? { type: 'solid', style: ColorConvert.string(paint) } : undefined;
|
|
10686
|
+
return paint.r !== undefined ? { type: 'solid', style: ColorConvert.string(paint) } : undefined;
|
|
10616
10687
|
}
|
|
10617
10688
|
}
|
|
10618
10689
|
|
|
@@ -10629,17 +10700,17 @@ const PaintModule = {
|
|
|
10629
10700
|
};
|
|
10630
10701
|
|
|
10631
10702
|
let origin = {};
|
|
10632
|
-
const { get: get$
|
|
10703
|
+
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = MatrixHelper;
|
|
10633
10704
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10634
|
-
const transform = get$
|
|
10705
|
+
const transform = get$3();
|
|
10635
10706
|
translate$1(transform, box.x + x, box.y + y);
|
|
10636
10707
|
scaleHelper(transform, scaleX, scaleY);
|
|
10637
10708
|
if (rotation)
|
|
10638
|
-
rotateOfOuter$
|
|
10709
|
+
rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
10639
10710
|
data.transform = transform;
|
|
10640
10711
|
}
|
|
10641
10712
|
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
10642
|
-
const transform = get$
|
|
10713
|
+
const transform = get$3();
|
|
10643
10714
|
translate$1(transform, box.x + x, box.y + y);
|
|
10644
10715
|
if (scaleX)
|
|
10645
10716
|
scaleHelper(transform, scaleX, scaleY);
|
|
@@ -10648,10 +10719,10 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
10648
10719
|
data.transform = transform;
|
|
10649
10720
|
}
|
|
10650
10721
|
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
10651
|
-
const transform = get$
|
|
10722
|
+
const transform = get$3();
|
|
10652
10723
|
if (rotation) {
|
|
10653
10724
|
if (align === 'center') {
|
|
10654
|
-
rotateOfOuter$
|
|
10725
|
+
rotateOfOuter$1(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
10655
10726
|
}
|
|
10656
10727
|
else {
|
|
10657
10728
|
rotate(transform, rotation);
|
|
@@ -10672,22 +10743,26 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, al
|
|
|
10672
10743
|
origin.y = box.y + y;
|
|
10673
10744
|
translate$1(transform, origin.x, origin.y);
|
|
10674
10745
|
if (scaleX)
|
|
10675
|
-
scaleOfOuter$
|
|
10746
|
+
scaleOfOuter$1(transform, origin, scaleX, scaleY);
|
|
10676
10747
|
data.transform = transform;
|
|
10677
10748
|
}
|
|
10678
10749
|
|
|
10679
|
-
const { get: get$
|
|
10750
|
+
const { get: get$2, translate } = MatrixHelper;
|
|
10680
10751
|
const tempBox = new Bounds();
|
|
10681
10752
|
const tempPoint = {};
|
|
10682
10753
|
function createData(leafPaint, image, paint, box) {
|
|
10754
|
+
const { blendMode } = paint;
|
|
10755
|
+
if (blendMode)
|
|
10756
|
+
leafPaint.blendMode = blendMode;
|
|
10757
|
+
leafPaint.data = getPatternData(paint, box, image);
|
|
10758
|
+
}
|
|
10759
|
+
function getPatternData(paint, box, image) {
|
|
10683
10760
|
let { width, height } = image;
|
|
10684
10761
|
if (paint.padding)
|
|
10685
10762
|
box = tempBox.set(box).shrink(paint.padding);
|
|
10686
|
-
const { opacity, mode, align, offset, scale, size, rotation,
|
|
10763
|
+
const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
|
|
10687
10764
|
const sameBox = box.width === width && box.height === height;
|
|
10688
|
-
|
|
10689
|
-
leafPaint.blendMode = blendMode;
|
|
10690
|
-
const data = leafPaint.data = { mode };
|
|
10765
|
+
const data = { mode };
|
|
10691
10766
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
10692
10767
|
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
10693
10768
|
let x = 0, y = 0, scaleX, scaleY;
|
|
@@ -10739,7 +10814,7 @@ function createData(leafPaint, image, paint, box) {
|
|
|
10739
10814
|
}
|
|
10740
10815
|
if (!data.transform) {
|
|
10741
10816
|
if (box.x || box.y) {
|
|
10742
|
-
data.transform = get$
|
|
10817
|
+
data.transform = get$2();
|
|
10743
10818
|
translate(data.transform, box.x, box.y);
|
|
10744
10819
|
}
|
|
10745
10820
|
}
|
|
@@ -10753,6 +10828,7 @@ function createData(leafPaint, image, paint, box) {
|
|
|
10753
10828
|
data.opacity = opacity;
|
|
10754
10829
|
if (repeat)
|
|
10755
10830
|
data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
|
|
10831
|
+
return data;
|
|
10756
10832
|
}
|
|
10757
10833
|
|
|
10758
10834
|
let cache, box = new Bounds();
|
|
@@ -10842,7 +10918,7 @@ function ignoreRender(ui, value) {
|
|
|
10842
10918
|
leafer.renderer.ignore = value;
|
|
10843
10919
|
}
|
|
10844
10920
|
|
|
10845
|
-
const { get: get$
|
|
10921
|
+
const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
|
|
10846
10922
|
const { ceil, abs: abs$1 } = Math;
|
|
10847
10923
|
function createPattern(ui, paint, pixelRatio) {
|
|
10848
10924
|
let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
@@ -10853,7 +10929,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10853
10929
|
const { image, data } = paint;
|
|
10854
10930
|
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
|
|
10855
10931
|
if (sx) {
|
|
10856
|
-
imageMatrix = get$
|
|
10932
|
+
imageMatrix = get$1();
|
|
10857
10933
|
copy$1(imageMatrix, transform);
|
|
10858
10934
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
10859
10935
|
scaleX *= sx;
|
|
@@ -10888,7 +10964,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
10888
10964
|
}
|
|
10889
10965
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
10890
10966
|
if (!imageMatrix) {
|
|
10891
|
-
imageMatrix = get$
|
|
10967
|
+
imageMatrix = get$1();
|
|
10892
10968
|
if (transform)
|
|
10893
10969
|
copy$1(imageMatrix, transform);
|
|
10894
10970
|
}
|
|
@@ -10989,13 +11065,14 @@ function recycleImage(attrName, data) {
|
|
|
10989
11065
|
|
|
10990
11066
|
const PaintImageModule = {
|
|
10991
11067
|
image,
|
|
11068
|
+
checkImage,
|
|
11069
|
+
createPattern,
|
|
11070
|
+
recycleImage,
|
|
10992
11071
|
createData,
|
|
11072
|
+
getPatternData,
|
|
10993
11073
|
fillOrFitMode,
|
|
10994
11074
|
clipMode,
|
|
10995
|
-
repeatMode
|
|
10996
|
-
createPattern,
|
|
10997
|
-
checkImage,
|
|
10998
|
-
recycleImage
|
|
11075
|
+
repeatMode
|
|
10999
11076
|
};
|
|
11000
11077
|
|
|
11001
11078
|
const { toPoint: toPoint$2 } = AroundHelper;
|
|
@@ -11025,8 +11102,8 @@ function applyStops(gradient, stops, opacity) {
|
|
|
11025
11102
|
}
|
|
11026
11103
|
}
|
|
11027
11104
|
|
|
11028
|
-
const { getAngle
|
|
11029
|
-
const { get
|
|
11105
|
+
const { getAngle, getDistance: getDistance$1 } = PointHelper;
|
|
11106
|
+
const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
|
|
11030
11107
|
const { toPoint: toPoint$1 } = AroundHelper;
|
|
11031
11108
|
const realFrom$1 = {};
|
|
11032
11109
|
const realTo$1 = {};
|
|
@@ -11034,23 +11111,35 @@ function radialGradient(paint, box) {
|
|
|
11034
11111
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
11035
11112
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
11036
11113
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
11037
|
-
const { width, height } = box;
|
|
11038
|
-
let transform;
|
|
11039
|
-
if (width !== height || stretch) {
|
|
11040
|
-
transform = get$1();
|
|
11041
|
-
scaleOfOuter$1(transform, realFrom$1, width / height * (stretch || 1), 1);
|
|
11042
|
-
rotateOfOuter$1(transform, realFrom$1, getAngle$1(realFrom$1, realTo$1) + 90);
|
|
11043
|
-
}
|
|
11044
11114
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
|
|
11045
11115
|
applyStops(style, paint.stops, opacity);
|
|
11046
|
-
const data = { type, style
|
|
11116
|
+
const data = { type, style };
|
|
11117
|
+
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
11118
|
+
if (transform)
|
|
11119
|
+
data.transform = transform;
|
|
11047
11120
|
if (blendMode)
|
|
11048
11121
|
data.blendMode = blendMode;
|
|
11049
11122
|
return data;
|
|
11050
11123
|
}
|
|
11124
|
+
function getTransform(box, from, to, stretch, rotate90) {
|
|
11125
|
+
let transform;
|
|
11126
|
+
const { width, height } = box;
|
|
11127
|
+
if (width !== height || stretch) {
|
|
11128
|
+
const angle = getAngle(from, to);
|
|
11129
|
+
transform = get();
|
|
11130
|
+
if (rotate90) {
|
|
11131
|
+
scaleOfOuter(transform, from, width / height * (stretch || 1), 1);
|
|
11132
|
+
rotateOfOuter(transform, from, angle + 90);
|
|
11133
|
+
}
|
|
11134
|
+
else {
|
|
11135
|
+
scaleOfOuter(transform, from, 1, width / height * (stretch || 1));
|
|
11136
|
+
rotateOfOuter(transform, from, angle);
|
|
11137
|
+
}
|
|
11138
|
+
}
|
|
11139
|
+
return transform;
|
|
11140
|
+
}
|
|
11051
11141
|
|
|
11052
|
-
const {
|
|
11053
|
-
const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
|
|
11142
|
+
const { getDistance } = PointHelper;
|
|
11054
11143
|
const { toPoint } = AroundHelper;
|
|
11055
11144
|
const realFrom = {};
|
|
11056
11145
|
const realTo = {};
|
|
@@ -11058,20 +11147,12 @@ function conicGradient(paint, box) {
|
|
|
11058
11147
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
11059
11148
|
toPoint(from || 'center', box, realFrom);
|
|
11060
11149
|
toPoint(to || 'bottom', box, realTo);
|
|
11061
|
-
const { width, height } = box;
|
|
11062
|
-
const transform = get();
|
|
11063
|
-
const angle = getAngle(realFrom, realTo);
|
|
11064
|
-
if (Platform.conicGradientRotate90) {
|
|
11065
|
-
scaleOfOuter(transform, realFrom, width / height * (stretch || 1), 1);
|
|
11066
|
-
rotateOfOuter(transform, realFrom, angle + 90);
|
|
11067
|
-
}
|
|
11068
|
-
else {
|
|
11069
|
-
scaleOfOuter(transform, realFrom, 1, width / height * (stretch || 1));
|
|
11070
|
-
rotateOfOuter(transform, realFrom, angle);
|
|
11071
|
-
}
|
|
11072
11150
|
const style = Platform.conicGradientSupport ? Platform.canvas.createConicGradient(0, realFrom.x, realFrom.y) : Platform.canvas.createRadialGradient(realFrom.x, realFrom.y, 0, realFrom.x, realFrom.y, getDistance(realFrom, realTo));
|
|
11073
11151
|
applyStops(style, paint.stops, opacity);
|
|
11074
|
-
const data = { type, style
|
|
11152
|
+
const data = { type, style };
|
|
11153
|
+
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
11154
|
+
if (transform)
|
|
11155
|
+
data.transform = transform;
|
|
11075
11156
|
if (blendMode)
|
|
11076
11157
|
data.blendMode = blendMode;
|
|
11077
11158
|
return data;
|
|
@@ -11080,7 +11161,8 @@ function conicGradient(paint, box) {
|
|
|
11080
11161
|
const PaintGradientModule = {
|
|
11081
11162
|
linearGradient,
|
|
11082
11163
|
radialGradient,
|
|
11083
|
-
conicGradient
|
|
11164
|
+
conicGradient,
|
|
11165
|
+
getTransform
|
|
11084
11166
|
};
|
|
11085
11167
|
|
|
11086
11168
|
const { copy, toOffsetOutBounds: toOffsetOutBounds$1 } = BoundsHelper;
|
|
@@ -11806,11 +11888,21 @@ const ExportModule = {
|
|
|
11806
11888
|
resolve();
|
|
11807
11889
|
this.running = false;
|
|
11808
11890
|
};
|
|
11891
|
+
const { toURL } = Platform;
|
|
11892
|
+
const { download } = Platform.origin;
|
|
11893
|
+
const fileType = FileHelper.fileType(filename);
|
|
11809
11894
|
if (filename === 'json') {
|
|
11810
11895
|
return over({ data: leaf.toJSON() });
|
|
11811
11896
|
}
|
|
11812
|
-
else if (
|
|
11813
|
-
|
|
11897
|
+
else if (fileType === 'json') {
|
|
11898
|
+
download(toURL(JSON.stringify(leaf.toJSON()), 'text'), filename);
|
|
11899
|
+
return over({ data: true });
|
|
11900
|
+
}
|
|
11901
|
+
if (filename === 'svg') {
|
|
11902
|
+
return over({ data: leaf.toSVG() });
|
|
11903
|
+
}
|
|
11904
|
+
else if (fileType === 'svg') {
|
|
11905
|
+
download(toURL(leaf.toSVG(), 'svg'), filename);
|
|
11814
11906
|
return over({ data: true });
|
|
11815
11907
|
}
|
|
11816
11908
|
const { leafer } = leaf;
|