@leafer-draw/worker 1.0.0-rc.25 → 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/worker.esm.js +69 -48
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +137 -67
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +137 -67
- package/dist/worker.module.min.js +1 -1
- package/package.json +6 -6
package/dist/worker.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$6, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$
|
|
3969
|
+
const { copy: copy$6, toInnerPoint: toInnerPoint$1, scaleOfOuter: scaleOfOuter$2, rotateOfOuter: rotateOfOuter$2, skewOfOuter, multiplyParent: multiplyParent$2, divideParent, getLayout } = MatrixHelper;
|
|
3954
3970
|
const matrix = {};
|
|
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$6(matrix, t.__localMatrix);
|
|
4039
|
-
scaleOfOuter$
|
|
4055
|
+
scaleOfOuter$2(matrix, origin, scaleX, scaleY);
|
|
4040
4056
|
moveByMatrix(t, matrix);
|
|
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$6(matrix, t.__localMatrix);
|
|
4048
|
-
rotateOfOuter$
|
|
4064
|
+
rotateOfOuter$2(matrix, origin, angle);
|
|
4049
4065
|
moveByMatrix(t, matrix);
|
|
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$6(matrix, 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$3 } = 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 {
|
|
@@ -6983,7 +7023,7 @@ __decorate([
|
|
|
6983
7023
|
stateType(false)
|
|
6984
7024
|
], UI.prototype, "disabled", void 0);
|
|
6985
7025
|
__decorate([
|
|
6986
|
-
|
|
7026
|
+
surfaceType(false)
|
|
6987
7027
|
], UI.prototype, "locked", void 0);
|
|
6988
7028
|
__decorate([
|
|
6989
7029
|
sortType(0)
|
|
@@ -7081,6 +7121,9 @@ __decorate([
|
|
|
7081
7121
|
__decorate([
|
|
7082
7122
|
boundsType()
|
|
7083
7123
|
], UI.prototype, "autoHeight", void 0);
|
|
7124
|
+
__decorate([
|
|
7125
|
+
boundsType()
|
|
7126
|
+
], UI.prototype, "lockRatio", void 0);
|
|
7084
7127
|
__decorate([
|
|
7085
7128
|
boundsType()
|
|
7086
7129
|
], UI.prototype, "autoBox", void 0);
|
|
@@ -7670,9 +7713,9 @@ let Box = class Box extends Group {
|
|
|
7670
7713
|
if (!data.__autoSize) {
|
|
7671
7714
|
const b = this.__layout.boxBounds;
|
|
7672
7715
|
if (!data.__autoWidth)
|
|
7673
|
-
b.
|
|
7716
|
+
b.height += b.y, b.width = data.width, b.x = b.y = 0;
|
|
7674
7717
|
if (!data.__autoHeight)
|
|
7675
|
-
b.
|
|
7718
|
+
b.width += b.x, b.height = data.height, b.y = b.x = 0;
|
|
7676
7719
|
}
|
|
7677
7720
|
}
|
|
7678
7721
|
else {
|
|
@@ -7742,6 +7785,9 @@ let Box = class Box extends Group {
|
|
|
7742
7785
|
__decorate([
|
|
7743
7786
|
dataProcessor(BoxData)
|
|
7744
7787
|
], Box.prototype, "__", void 0);
|
|
7788
|
+
__decorate([
|
|
7789
|
+
dataType(false)
|
|
7790
|
+
], Box.prototype, "resizeChildren", void 0);
|
|
7745
7791
|
__decorate([
|
|
7746
7792
|
affectRenderBoundsType('show')
|
|
7747
7793
|
], Box.prototype, "overflow", void 0);
|
|
@@ -7851,7 +7897,7 @@ Ellipse = __decorate([
|
|
|
7851
7897
|
], Ellipse);
|
|
7852
7898
|
|
|
7853
7899
|
const { moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1 } = PathCommandDataHelper;
|
|
7854
|
-
const { rotate: rotate$1, getAngle: getAngle$
|
|
7900
|
+
const { rotate: rotate$1, getAngle: getAngle$1, getDistance: getDistance$2, defaultPoint } = PointHelper;
|
|
7855
7901
|
const { toBounds: toBounds$1 } = PathBounds;
|
|
7856
7902
|
let Line = class Line extends UI {
|
|
7857
7903
|
get __tag() { return 'Line'; }
|
|
@@ -7866,7 +7912,7 @@ let Line = class Line extends UI {
|
|
|
7866
7912
|
}
|
|
7867
7913
|
set toPoint(value) {
|
|
7868
7914
|
this.width = getDistance$2(defaultPoint, value);
|
|
7869
|
-
this.rotation = getAngle$
|
|
7915
|
+
this.rotation = getAngle$1(defaultPoint, value);
|
|
7870
7916
|
if (this.height)
|
|
7871
7917
|
this.height = 0;
|
|
7872
7918
|
}
|
|
@@ -8213,6 +8259,9 @@ __decorate([
|
|
|
8213
8259
|
__decorate([
|
|
8214
8260
|
boundsType(0)
|
|
8215
8261
|
], Text.prototype, "height", void 0);
|
|
8262
|
+
__decorate([
|
|
8263
|
+
dataType(false)
|
|
8264
|
+
], Text.prototype, "resizeFontSize", void 0);
|
|
8216
8265
|
__decorate([
|
|
8217
8266
|
surfaceType('#000000')
|
|
8218
8267
|
], Text.prototype, "fill", void 0);
|
|
@@ -8625,7 +8674,7 @@ function getLeafPaint(attrName, paint, ui) {
|
|
|
8625
8674
|
case 'angular':
|
|
8626
8675
|
return PaintGradient.conicGradient(paint, boxBounds);
|
|
8627
8676
|
default:
|
|
8628
|
-
return paint.r ? { type: 'solid', style: ColorConvert.string(paint) } : undefined;
|
|
8677
|
+
return paint.r !== undefined ? { type: 'solid', style: ColorConvert.string(paint) } : undefined;
|
|
8629
8678
|
}
|
|
8630
8679
|
}
|
|
8631
8680
|
|
|
@@ -8642,17 +8691,17 @@ const PaintModule = {
|
|
|
8642
8691
|
};
|
|
8643
8692
|
|
|
8644
8693
|
let origin = {};
|
|
8645
|
-
const { get: get$
|
|
8694
|
+
const { get: get$3, rotateOfOuter: rotateOfOuter$1, translate: translate$1, scaleOfOuter: scaleOfOuter$1, scale: scaleHelper, rotate } = MatrixHelper;
|
|
8646
8695
|
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
8647
|
-
const transform = get$
|
|
8696
|
+
const transform = get$3();
|
|
8648
8697
|
translate$1(transform, box.x + x, box.y + y);
|
|
8649
8698
|
scaleHelper(transform, scaleX, scaleY);
|
|
8650
8699
|
if (rotation)
|
|
8651
|
-
rotateOfOuter$
|
|
8700
|
+
rotateOfOuter$1(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
8652
8701
|
data.transform = transform;
|
|
8653
8702
|
}
|
|
8654
8703
|
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
8655
|
-
const transform = get$
|
|
8704
|
+
const transform = get$3();
|
|
8656
8705
|
translate$1(transform, box.x + x, box.y + y);
|
|
8657
8706
|
if (scaleX)
|
|
8658
8707
|
scaleHelper(transform, scaleX, scaleY);
|
|
@@ -8661,10 +8710,10 @@ function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
|
8661
8710
|
data.transform = transform;
|
|
8662
8711
|
}
|
|
8663
8712
|
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, align) {
|
|
8664
|
-
const transform = get$
|
|
8713
|
+
const transform = get$3();
|
|
8665
8714
|
if (rotation) {
|
|
8666
8715
|
if (align === 'center') {
|
|
8667
|
-
rotateOfOuter$
|
|
8716
|
+
rotateOfOuter$1(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
8668
8717
|
}
|
|
8669
8718
|
else {
|
|
8670
8719
|
rotate(transform, rotation);
|
|
@@ -8685,22 +8734,26 @@ function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, al
|
|
|
8685
8734
|
origin.y = box.y + y;
|
|
8686
8735
|
translate$1(transform, origin.x, origin.y);
|
|
8687
8736
|
if (scaleX)
|
|
8688
|
-
scaleOfOuter$
|
|
8737
|
+
scaleOfOuter$1(transform, origin, scaleX, scaleY);
|
|
8689
8738
|
data.transform = transform;
|
|
8690
8739
|
}
|
|
8691
8740
|
|
|
8692
|
-
const { get: get$
|
|
8741
|
+
const { get: get$2, translate } = MatrixHelper;
|
|
8693
8742
|
const tempBox = new Bounds();
|
|
8694
8743
|
const tempPoint = {};
|
|
8695
8744
|
function createData(leafPaint, image, paint, box) {
|
|
8745
|
+
const { blendMode } = paint;
|
|
8746
|
+
if (blendMode)
|
|
8747
|
+
leafPaint.blendMode = blendMode;
|
|
8748
|
+
leafPaint.data = getPatternData(paint, box, image);
|
|
8749
|
+
}
|
|
8750
|
+
function getPatternData(paint, box, image) {
|
|
8696
8751
|
let { width, height } = image;
|
|
8697
8752
|
if (paint.padding)
|
|
8698
8753
|
box = tempBox.set(box).shrink(paint.padding);
|
|
8699
|
-
const { opacity, mode, align, offset, scale, size, rotation,
|
|
8754
|
+
const { opacity, mode, align, offset, scale, size, rotation, repeat } = paint;
|
|
8700
8755
|
const sameBox = box.width === width && box.height === height;
|
|
8701
|
-
|
|
8702
|
-
leafPaint.blendMode = blendMode;
|
|
8703
|
-
const data = leafPaint.data = { mode };
|
|
8756
|
+
const data = { mode };
|
|
8704
8757
|
const swapSize = align !== 'center' && (rotation || 0) % 180 === 90;
|
|
8705
8758
|
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
8706
8759
|
let x = 0, y = 0, scaleX, scaleY;
|
|
@@ -8752,7 +8805,7 @@ function createData(leafPaint, image, paint, box) {
|
|
|
8752
8805
|
}
|
|
8753
8806
|
if (!data.transform) {
|
|
8754
8807
|
if (box.x || box.y) {
|
|
8755
|
-
data.transform = get$
|
|
8808
|
+
data.transform = get$2();
|
|
8756
8809
|
translate(data.transform, box.x, box.y);
|
|
8757
8810
|
}
|
|
8758
8811
|
}
|
|
@@ -8766,6 +8819,7 @@ function createData(leafPaint, image, paint, box) {
|
|
|
8766
8819
|
data.opacity = opacity;
|
|
8767
8820
|
if (repeat)
|
|
8768
8821
|
data.repeat = typeof repeat === 'string' ? (repeat === 'x' ? 'repeat-x' : 'repeat-y') : 'repeat';
|
|
8822
|
+
return data;
|
|
8769
8823
|
}
|
|
8770
8824
|
|
|
8771
8825
|
let cache, box = new Bounds();
|
|
@@ -8855,7 +8909,7 @@ function ignoreRender(ui, value) {
|
|
|
8855
8909
|
leafer.renderer.ignore = value;
|
|
8856
8910
|
}
|
|
8857
8911
|
|
|
8858
|
-
const { get: get$
|
|
8912
|
+
const { get: get$1, scale, copy: copy$1 } = MatrixHelper;
|
|
8859
8913
|
const { ceil, abs: abs$1 } = Math;
|
|
8860
8914
|
function createPattern(ui, paint, pixelRatio) {
|
|
8861
8915
|
let { scaleX, scaleY } = ImageManager.patternLocked ? ui.__world : ui.__nowWorld;
|
|
@@ -8866,7 +8920,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
8866
8920
|
const { image, data } = paint;
|
|
8867
8921
|
let imageScale, imageMatrix, { width, height, scaleX: sx, scaleY: sy, opacity, transform, repeat } = data;
|
|
8868
8922
|
if (sx) {
|
|
8869
|
-
imageMatrix = get$
|
|
8923
|
+
imageMatrix = get$1();
|
|
8870
8924
|
copy$1(imageMatrix, transform);
|
|
8871
8925
|
scale(imageMatrix, 1 / sx, 1 / sy);
|
|
8872
8926
|
scaleX *= sx;
|
|
@@ -8901,7 +8955,7 @@ function createPattern(ui, paint, pixelRatio) {
|
|
|
8901
8955
|
}
|
|
8902
8956
|
if (transform || scaleX !== 1 || scaleY !== 1) {
|
|
8903
8957
|
if (!imageMatrix) {
|
|
8904
|
-
imageMatrix = get$
|
|
8958
|
+
imageMatrix = get$1();
|
|
8905
8959
|
if (transform)
|
|
8906
8960
|
copy$1(imageMatrix, transform);
|
|
8907
8961
|
}
|
|
@@ -9002,13 +9056,14 @@ function recycleImage(attrName, data) {
|
|
|
9002
9056
|
|
|
9003
9057
|
const PaintImageModule = {
|
|
9004
9058
|
image,
|
|
9059
|
+
checkImage,
|
|
9060
|
+
createPattern,
|
|
9061
|
+
recycleImage,
|
|
9005
9062
|
createData,
|
|
9063
|
+
getPatternData,
|
|
9006
9064
|
fillOrFitMode,
|
|
9007
9065
|
clipMode,
|
|
9008
|
-
repeatMode
|
|
9009
|
-
createPattern,
|
|
9010
|
-
checkImage,
|
|
9011
|
-
recycleImage
|
|
9066
|
+
repeatMode
|
|
9012
9067
|
};
|
|
9013
9068
|
|
|
9014
9069
|
const { toPoint: toPoint$2 } = AroundHelper;
|
|
@@ -9038,8 +9093,8 @@ function applyStops(gradient, stops, opacity) {
|
|
|
9038
9093
|
}
|
|
9039
9094
|
}
|
|
9040
9095
|
|
|
9041
|
-
const { getAngle
|
|
9042
|
-
const { get
|
|
9096
|
+
const { getAngle, getDistance: getDistance$1 } = PointHelper;
|
|
9097
|
+
const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
|
|
9043
9098
|
const { toPoint: toPoint$1 } = AroundHelper;
|
|
9044
9099
|
const realFrom$1 = {};
|
|
9045
9100
|
const realTo$1 = {};
|
|
@@ -9047,23 +9102,35 @@ function radialGradient(paint, box) {
|
|
|
9047
9102
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
9048
9103
|
toPoint$1(from || 'center', box, realFrom$1);
|
|
9049
9104
|
toPoint$1(to || 'bottom', box, realTo$1);
|
|
9050
|
-
const { width, height } = box;
|
|
9051
|
-
let transform;
|
|
9052
|
-
if (width !== height || stretch) {
|
|
9053
|
-
transform = get$1();
|
|
9054
|
-
scaleOfOuter$1(transform, realFrom$1, width / height * (stretch || 1), 1);
|
|
9055
|
-
rotateOfOuter$1(transform, realFrom$1, getAngle$1(realFrom$1, realTo$1) + 90);
|
|
9056
|
-
}
|
|
9057
9105
|
const style = Platform.canvas.createRadialGradient(realFrom$1.x, realFrom$1.y, 0, realFrom$1.x, realFrom$1.y, getDistance$1(realFrom$1, realTo$1));
|
|
9058
9106
|
applyStops(style, paint.stops, opacity);
|
|
9059
|
-
const data = { type, style
|
|
9107
|
+
const data = { type, style };
|
|
9108
|
+
const transform = getTransform(box, realFrom$1, realTo$1, stretch, true);
|
|
9109
|
+
if (transform)
|
|
9110
|
+
data.transform = transform;
|
|
9060
9111
|
if (blendMode)
|
|
9061
9112
|
data.blendMode = blendMode;
|
|
9062
9113
|
return data;
|
|
9063
9114
|
}
|
|
9115
|
+
function getTransform(box, from, to, stretch, rotate90) {
|
|
9116
|
+
let transform;
|
|
9117
|
+
const { width, height } = box;
|
|
9118
|
+
if (width !== height || stretch) {
|
|
9119
|
+
const angle = getAngle(from, to);
|
|
9120
|
+
transform = get();
|
|
9121
|
+
if (rotate90) {
|
|
9122
|
+
scaleOfOuter(transform, from, width / height * (stretch || 1), 1);
|
|
9123
|
+
rotateOfOuter(transform, from, angle + 90);
|
|
9124
|
+
}
|
|
9125
|
+
else {
|
|
9126
|
+
scaleOfOuter(transform, from, 1, width / height * (stretch || 1));
|
|
9127
|
+
rotateOfOuter(transform, from, angle);
|
|
9128
|
+
}
|
|
9129
|
+
}
|
|
9130
|
+
return transform;
|
|
9131
|
+
}
|
|
9064
9132
|
|
|
9065
|
-
const {
|
|
9066
|
-
const { get, rotateOfOuter, scaleOfOuter } = MatrixHelper;
|
|
9133
|
+
const { getDistance } = PointHelper;
|
|
9067
9134
|
const { toPoint } = AroundHelper;
|
|
9068
9135
|
const realFrom = {};
|
|
9069
9136
|
const realTo = {};
|
|
@@ -9071,20 +9138,12 @@ function conicGradient(paint, box) {
|
|
|
9071
9138
|
let { from, to, type, opacity, blendMode, stretch } = paint;
|
|
9072
9139
|
toPoint(from || 'center', box, realFrom);
|
|
9073
9140
|
toPoint(to || 'bottom', box, realTo);
|
|
9074
|
-
const { width, height } = box;
|
|
9075
|
-
const transform = get();
|
|
9076
|
-
const angle = getAngle(realFrom, realTo);
|
|
9077
|
-
if (Platform.conicGradientRotate90) {
|
|
9078
|
-
scaleOfOuter(transform, realFrom, width / height * (stretch || 1), 1);
|
|
9079
|
-
rotateOfOuter(transform, realFrom, angle + 90);
|
|
9080
|
-
}
|
|
9081
|
-
else {
|
|
9082
|
-
scaleOfOuter(transform, realFrom, 1, width / height * (stretch || 1));
|
|
9083
|
-
rotateOfOuter(transform, realFrom, angle);
|
|
9084
|
-
}
|
|
9085
9141
|
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));
|
|
9086
9142
|
applyStops(style, paint.stops, opacity);
|
|
9087
|
-
const data = { type, style
|
|
9143
|
+
const data = { type, style };
|
|
9144
|
+
const transform = getTransform(box, realFrom, realTo, stretch || 1, Platform.conicGradientRotate90);
|
|
9145
|
+
if (transform)
|
|
9146
|
+
data.transform = transform;
|
|
9088
9147
|
if (blendMode)
|
|
9089
9148
|
data.blendMode = blendMode;
|
|
9090
9149
|
return data;
|
|
@@ -9093,7 +9152,8 @@ function conicGradient(paint, box) {
|
|
|
9093
9152
|
const PaintGradientModule = {
|
|
9094
9153
|
linearGradient,
|
|
9095
9154
|
radialGradient,
|
|
9096
|
-
conicGradient
|
|
9155
|
+
conicGradient,
|
|
9156
|
+
getTransform
|
|
9097
9157
|
};
|
|
9098
9158
|
|
|
9099
9159
|
const { copy, toOffsetOutBounds: toOffsetOutBounds$1 } = BoundsHelper;
|
|
@@ -9819,11 +9879,21 @@ const ExportModule = {
|
|
|
9819
9879
|
resolve();
|
|
9820
9880
|
this.running = false;
|
|
9821
9881
|
};
|
|
9882
|
+
const { toURL } = Platform;
|
|
9883
|
+
const { download } = Platform.origin;
|
|
9884
|
+
const fileType = FileHelper.fileType(filename);
|
|
9822
9885
|
if (filename === 'json') {
|
|
9823
9886
|
return over({ data: leaf.toJSON() });
|
|
9824
9887
|
}
|
|
9825
|
-
else if (
|
|
9826
|
-
|
|
9888
|
+
else if (fileType === 'json') {
|
|
9889
|
+
download(toURL(JSON.stringify(leaf.toJSON()), 'text'), filename);
|
|
9890
|
+
return over({ data: true });
|
|
9891
|
+
}
|
|
9892
|
+
if (filename === 'svg') {
|
|
9893
|
+
return over({ data: leaf.toSVG() });
|
|
9894
|
+
}
|
|
9895
|
+
else if (fileType === 'svg') {
|
|
9896
|
+
download(toURL(leaf.toSVG(), 'svg'), filename);
|
|
9827
9897
|
return over({ data: true });
|
|
9828
9898
|
}
|
|
9829
9899
|
const { leafer } = leaf;
|