@leafer-draw/worker 1.0.0-rc.21 → 1.0.0-rc.22
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 +64 -47
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.js +118 -73
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +118 -73
- package/dist/worker.module.min.js +1 -1
- package/package.json +6 -6
package/dist/worker.module.js
CHANGED
|
@@ -117,7 +117,7 @@ function getMatrixData() { return { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }; }
|
|
|
117
117
|
|
|
118
118
|
const { sin: sin$5, cos: cos$5, acos, sqrt: sqrt$3 } = Math;
|
|
119
119
|
const { float: float$1 } = MathHelper;
|
|
120
|
-
const tempPoint$
|
|
120
|
+
const tempPoint$4 = {};
|
|
121
121
|
function getWorld() {
|
|
122
122
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), { scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 });
|
|
123
123
|
}
|
|
@@ -158,8 +158,8 @@ const MatrixHelper = {
|
|
|
158
158
|
t.d *= scaleY;
|
|
159
159
|
},
|
|
160
160
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
161
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
162
|
-
M$6.scaleOfInner(t, tempPoint$
|
|
161
|
+
M$6.toInnerPoint(t, origin, tempPoint$4);
|
|
162
|
+
M$6.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
|
|
163
163
|
},
|
|
164
164
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
165
165
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -177,8 +177,8 @@ const MatrixHelper = {
|
|
|
177
177
|
t.d = c * sinR + d * cosR;
|
|
178
178
|
},
|
|
179
179
|
rotateOfOuter(t, origin, rotation) {
|
|
180
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
181
|
-
M$6.rotateOfInner(t, tempPoint$
|
|
180
|
+
M$6.toInnerPoint(t, origin, tempPoint$4);
|
|
181
|
+
M$6.rotateOfInner(t, tempPoint$4, rotation);
|
|
182
182
|
},
|
|
183
183
|
rotateOfInner(t, origin, rotation) {
|
|
184
184
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -199,8 +199,8 @@ const MatrixHelper = {
|
|
|
199
199
|
}
|
|
200
200
|
},
|
|
201
201
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
202
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
203
|
-
M$6.skewOfInner(t, tempPoint$
|
|
202
|
+
M$6.toInnerPoint(t, origin, tempPoint$4);
|
|
203
|
+
M$6.skewOfInner(t, tempPoint$4, skewX, skewY);
|
|
204
204
|
},
|
|
205
205
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
206
206
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -594,7 +594,7 @@ class Point {
|
|
|
594
594
|
return this;
|
|
595
595
|
}
|
|
596
596
|
}
|
|
597
|
-
const tempPoint$
|
|
597
|
+
const tempPoint$3 = new Point();
|
|
598
598
|
|
|
599
599
|
class Matrix {
|
|
600
600
|
constructor(a, b, c, d, e, f) {
|
|
@@ -1206,11 +1206,19 @@ const AroundHelper = {
|
|
|
1206
1206
|
directionData,
|
|
1207
1207
|
tempPoint: {},
|
|
1208
1208
|
get: get$5,
|
|
1209
|
-
toPoint(around, bounds, to, onlySize) {
|
|
1209
|
+
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1210
1210
|
to || (to = {});
|
|
1211
1211
|
const point = get$5(around);
|
|
1212
1212
|
to.x = point.x * bounds.width;
|
|
1213
1213
|
to.y = point.y * bounds.height;
|
|
1214
|
+
if (pointBounds) {
|
|
1215
|
+
to.x -= pointBounds.x;
|
|
1216
|
+
to.y -= pointBounds.y;
|
|
1217
|
+
if (point.x)
|
|
1218
|
+
to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
|
|
1219
|
+
if (point.y)
|
|
1220
|
+
to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
|
|
1221
|
+
}
|
|
1214
1222
|
if (!onlySize) {
|
|
1215
1223
|
to.x += bounds.x;
|
|
1216
1224
|
to.y += bounds.y;
|
|
@@ -2208,7 +2216,7 @@ const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI
|
|
|
2208
2216
|
const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2209
2217
|
const { set: set$2 } = PointHelper;
|
|
2210
2218
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2211
|
-
const tempPoint$
|
|
2219
|
+
const tempPoint$2 = {};
|
|
2212
2220
|
const BezierHelper = {
|
|
2213
2221
|
points(data, points, curve, close) {
|
|
2214
2222
|
data.push(M$5, points[0], points[1]);
|
|
@@ -2398,8 +2406,8 @@ const BezierHelper = {
|
|
|
2398
2406
|
addMode ? addPoint$2(pointBounds, fromX, fromY) : setPoint$2(pointBounds, fromX, fromY);
|
|
2399
2407
|
addPoint$2(pointBounds, toX, toY);
|
|
2400
2408
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2401
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2402
|
-
addPoint$2(pointBounds, tempPoint$
|
|
2409
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
|
|
2410
|
+
addPoint$2(pointBounds, tempPoint$2.x, tempPoint$2.y);
|
|
2403
2411
|
}
|
|
2404
2412
|
},
|
|
2405
2413
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -3956,15 +3964,21 @@ const LeafHelper = {
|
|
|
3956
3964
|
}
|
|
3957
3965
|
return true;
|
|
3958
3966
|
},
|
|
3959
|
-
moveWorld(t, x, y) {
|
|
3960
|
-
const local = { x, y };
|
|
3967
|
+
moveWorld(t, x, y = 0) {
|
|
3968
|
+
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
3961
3969
|
if (t.parent)
|
|
3962
3970
|
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
3963
3971
|
L.moveLocal(t, local.x, local.y);
|
|
3964
3972
|
},
|
|
3965
3973
|
moveLocal(t, x, y = 0) {
|
|
3966
|
-
|
|
3967
|
-
|
|
3974
|
+
if (typeof x === 'object') {
|
|
3975
|
+
t.x += x.x;
|
|
3976
|
+
t.y += x.y;
|
|
3977
|
+
}
|
|
3978
|
+
else {
|
|
3979
|
+
t.x += x;
|
|
3980
|
+
t.y += y;
|
|
3981
|
+
}
|
|
3968
3982
|
},
|
|
3969
3983
|
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
3970
3984
|
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
@@ -4526,12 +4540,15 @@ const LeafEventer = {
|
|
|
4526
4540
|
break;
|
|
4527
4541
|
}
|
|
4528
4542
|
}
|
|
4543
|
+
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
4529
4544
|
},
|
|
4530
4545
|
emitEvent(event, capture) {
|
|
4531
4546
|
event.current = this;
|
|
4532
4547
|
this.emit(event.type, event, capture);
|
|
4533
4548
|
},
|
|
4534
4549
|
hasEvent(type, capture) {
|
|
4550
|
+
if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
|
|
4551
|
+
return true;
|
|
4535
4552
|
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4536
4553
|
const hasB = b && b[type], hasC = c && c[type];
|
|
4537
4554
|
return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
|
|
@@ -4751,7 +4768,7 @@ const LeafDataProxy = {
|
|
|
4751
4768
|
};
|
|
4752
4769
|
|
|
4753
4770
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
4754
|
-
const { toPoint, tempPoint } = AroundHelper;
|
|
4771
|
+
const { toPoint, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4755
4772
|
const LeafMatrix = {
|
|
4756
4773
|
__updateWorldMatrix() {
|
|
4757
4774
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
@@ -4768,8 +4785,8 @@ const LeafMatrix = {
|
|
|
4768
4785
|
local.e = data.x;
|
|
4769
4786
|
local.f = data.y;
|
|
4770
4787
|
if (data.around) {
|
|
4771
|
-
toPoint(data.around, layout.boxBounds, tempPoint);
|
|
4772
|
-
translateInner(local, -tempPoint.x, -tempPoint.y);
|
|
4788
|
+
toPoint(data.around, layout.boxBounds, tempPoint$1);
|
|
4789
|
+
translateInner(local, -tempPoint$1.x, -tempPoint$1.y);
|
|
4773
4790
|
}
|
|
4774
4791
|
}
|
|
4775
4792
|
this.__layout.matrixChanged = false;
|
|
@@ -6335,7 +6352,11 @@ function zoomLayerType() {
|
|
|
6335
6352
|
defineKey(target, key, {
|
|
6336
6353
|
set(value) { if (this.isLeafer)
|
|
6337
6354
|
this[privateKey] = value; },
|
|
6338
|
-
get() {
|
|
6355
|
+
get() {
|
|
6356
|
+
return this.isApp
|
|
6357
|
+
? this.tree.zoomLayer
|
|
6358
|
+
: (this.isLeafer ? (this[privateKey] || this) : this.leafer && this.leafer.zoomLayer);
|
|
6359
|
+
}
|
|
6339
6360
|
});
|
|
6340
6361
|
};
|
|
6341
6362
|
}
|
|
@@ -6741,6 +6762,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6741
6762
|
pen.set(this.path = this.__.path || []);
|
|
6742
6763
|
return pen;
|
|
6743
6764
|
}
|
|
6765
|
+
get editConfig() { return undefined; }
|
|
6766
|
+
get editOuter() { return 'EditTool'; }
|
|
6767
|
+
get editInner() { return 'PathEditor'; }
|
|
6744
6768
|
constructor(data) {
|
|
6745
6769
|
super(data);
|
|
6746
6770
|
}
|
|
@@ -6802,7 +6826,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6802
6826
|
__drawPathByBox(drawer) {
|
|
6803
6827
|
const { x, y, width, height } = this.__layout.boxBounds;
|
|
6804
6828
|
if (this.__.cornerRadius) {
|
|
6805
|
-
|
|
6829
|
+
const { cornerRadius } = this.__;
|
|
6830
|
+
drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius);
|
|
6806
6831
|
}
|
|
6807
6832
|
else {
|
|
6808
6833
|
drawer.rect(x, y, width, height);
|
|
@@ -6823,6 +6848,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6823
6848
|
static registerData(data) {
|
|
6824
6849
|
dataProcessor(data)(this.prototype);
|
|
6825
6850
|
}
|
|
6851
|
+
static setEditConfig(_config) { }
|
|
6852
|
+
static setEditOuter(_toolName) { }
|
|
6853
|
+
static setEditInner(_editorName) { }
|
|
6826
6854
|
destroy() {
|
|
6827
6855
|
this.fill = this.stroke = null;
|
|
6828
6856
|
super.destroy();
|
|
@@ -6906,15 +6934,15 @@ __decorate([
|
|
|
6906
6934
|
__decorate([
|
|
6907
6935
|
dataType(false)
|
|
6908
6936
|
], UI.prototype, "draggable", void 0);
|
|
6937
|
+
__decorate([
|
|
6938
|
+
dataType()
|
|
6939
|
+
], UI.prototype, "dragBounds", void 0);
|
|
6909
6940
|
__decorate([
|
|
6910
6941
|
dataType(false)
|
|
6911
6942
|
], UI.prototype, "editable", void 0);
|
|
6912
6943
|
__decorate([
|
|
6913
6944
|
dataType('size')
|
|
6914
6945
|
], UI.prototype, "editSize", void 0);
|
|
6915
|
-
__decorate([
|
|
6916
|
-
dataType()
|
|
6917
|
-
], UI.prototype, "editorStyle", void 0);
|
|
6918
6946
|
__decorate([
|
|
6919
6947
|
hitType(true)
|
|
6920
6948
|
], UI.prototype, "hittable", void 0);
|
|
@@ -7106,7 +7134,6 @@ Group = __decorate([
|
|
|
7106
7134
|
var Leafer_1;
|
|
7107
7135
|
const debug$1 = Debug.get('Leafer');
|
|
7108
7136
|
let Leafer = Leafer_1 = class Leafer extends Group {
|
|
7109
|
-
static get version() { return '1.0.0-rc.21'; }
|
|
7110
7137
|
get __tag() { return 'Leafer'; }
|
|
7111
7138
|
get isApp() { return false; }
|
|
7112
7139
|
get app() { return this.parent || this; }
|
|
@@ -7159,7 +7186,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7159
7186
|
if (this.isApp)
|
|
7160
7187
|
this.__setApp();
|
|
7161
7188
|
this.__checkAutoLayout(config);
|
|
7162
|
-
this.updateLazyBounds();
|
|
7163
7189
|
this.view = canvas.view;
|
|
7164
7190
|
if (parentApp) {
|
|
7165
7191
|
this.__bindApp(parentApp);
|
|
@@ -7403,6 +7429,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7403
7429
|
__listenEvents() {
|
|
7404
7430
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
7405
7431
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
7432
|
+
this.once(LayoutEvent.START, () => this.updateLazyBounds());
|
|
7406
7433
|
this.once(LayoutEvent.END, () => this.__onReady());
|
|
7407
7434
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
7408
7435
|
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
@@ -7921,6 +7948,7 @@ Canvas = __decorate([
|
|
|
7921
7948
|
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
7922
7949
|
let Text = class Text extends UI {
|
|
7923
7950
|
get __tag() { return 'Text'; }
|
|
7951
|
+
get editInner() { return 'TextEditor'; }
|
|
7924
7952
|
get textDrawData() {
|
|
7925
7953
|
this.__layout.update();
|
|
7926
7954
|
return this.__.__textDrawData;
|
|
@@ -8453,79 +8481,75 @@ const PaintModule = {
|
|
|
8453
8481
|
|
|
8454
8482
|
let origin = {};
|
|
8455
8483
|
const { get: get$4, rotateOfOuter: rotateOfOuter$2, translate: translate$1, scaleOfOuter: scaleOfOuter$2, scale: scaleHelper, rotate } = MatrixHelper;
|
|
8456
|
-
function fillOrFitMode(data,
|
|
8484
|
+
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
8457
8485
|
const transform = get$4();
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
const sh = box.height / (swap ? width : height);
|
|
8461
|
-
const scale = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
|
|
8462
|
-
const x = box.x + (box.width - width * scale) / 2;
|
|
8463
|
-
const y = box.y + (box.height - height * scale) / 2;
|
|
8464
|
-
translate$1(transform, x, y);
|
|
8465
|
-
scaleHelper(transform, scale);
|
|
8486
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
8487
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
8466
8488
|
if (rotation)
|
|
8467
8489
|
rotateOfOuter$2(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
8468
|
-
data.scaleX = data.scaleY = scale;
|
|
8469
8490
|
data.transform = transform;
|
|
8470
8491
|
}
|
|
8471
8492
|
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
8472
8493
|
const transform = get$4();
|
|
8473
|
-
translate$1(transform, box.x, box.y);
|
|
8474
|
-
if (
|
|
8475
|
-
translate$1(transform, x, y);
|
|
8476
|
-
if (scaleX) {
|
|
8494
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
8495
|
+
if (scaleX)
|
|
8477
8496
|
scaleHelper(transform, scaleX, scaleY);
|
|
8478
|
-
data.scaleX = transform.a;
|
|
8479
|
-
data.scaleY = transform.d;
|
|
8480
|
-
}
|
|
8481
8497
|
if (rotation)
|
|
8482
8498
|
rotate(transform, rotation);
|
|
8483
8499
|
data.transform = transform;
|
|
8484
8500
|
}
|
|
8485
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation) {
|
|
8501
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, around) {
|
|
8486
8502
|
const transform = get$4();
|
|
8487
8503
|
if (rotation) {
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8504
|
+
if (around === 'center') {
|
|
8505
|
+
rotateOfOuter$2(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
8506
|
+
}
|
|
8507
|
+
else {
|
|
8508
|
+
rotate(transform, rotation);
|
|
8509
|
+
switch (rotation) {
|
|
8510
|
+
case 90:
|
|
8511
|
+
translate$1(transform, height, 0);
|
|
8512
|
+
break;
|
|
8513
|
+
case 180:
|
|
8514
|
+
translate$1(transform, width, height);
|
|
8515
|
+
break;
|
|
8516
|
+
case 270:
|
|
8517
|
+
translate$1(transform, 0, width);
|
|
8518
|
+
break;
|
|
8519
|
+
}
|
|
8499
8520
|
}
|
|
8500
8521
|
}
|
|
8501
|
-
origin.x = box.x;
|
|
8502
|
-
origin.y = box.y;
|
|
8503
|
-
if (x || y)
|
|
8504
|
-
origin.x += x, origin.y += y;
|
|
8522
|
+
origin.x = box.x + x;
|
|
8523
|
+
origin.y = box.y + y;
|
|
8505
8524
|
translate$1(transform, origin.x, origin.y);
|
|
8506
|
-
if (scaleX)
|
|
8525
|
+
if (scaleX)
|
|
8507
8526
|
scaleOfOuter$2(transform, origin, scaleX, scaleY);
|
|
8508
|
-
data.scaleX = scaleX;
|
|
8509
|
-
data.scaleY = scaleY;
|
|
8510
|
-
}
|
|
8511
8527
|
data.transform = transform;
|
|
8512
8528
|
}
|
|
8513
8529
|
|
|
8514
8530
|
const { get: get$3, translate } = MatrixHelper;
|
|
8515
8531
|
const tempBox = new Bounds();
|
|
8532
|
+
const tempPoint = {};
|
|
8516
8533
|
function createData(leafPaint, image, paint, box) {
|
|
8517
8534
|
let { width, height } = image;
|
|
8518
8535
|
if (paint.padding)
|
|
8519
8536
|
box = tempBox.set(box).shrink(paint.padding);
|
|
8520
|
-
const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
8537
|
+
const { opacity, mode, around, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
8521
8538
|
const sameBox = box.width === width && box.height === height;
|
|
8522
8539
|
if (blendMode)
|
|
8523
8540
|
leafPaint.blendMode = blendMode;
|
|
8524
8541
|
const data = leafPaint.data = { mode };
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
if (
|
|
8542
|
+
const swapSize = around !== 'center' && (rotation || 0) % 180 === 90;
|
|
8543
|
+
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
8544
|
+
let x = 0, y = 0, scaleX, scaleY;
|
|
8545
|
+
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
8546
|
+
if (!sameBox || rotation) {
|
|
8547
|
+
const sw = box.width / swapWidth, sh = box.height / swapHeight;
|
|
8548
|
+
scaleX = scaleY = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
|
|
8549
|
+
x += (box.width - width * scaleX) / 2, y += (box.height - height * scaleY) / 2;
|
|
8550
|
+
}
|
|
8551
|
+
}
|
|
8552
|
+
else if (size) {
|
|
8529
8553
|
scaleX = (typeof size === 'number' ? size : size.width) / width;
|
|
8530
8554
|
scaleY = (typeof size === 'number' ? size : size.height) / height;
|
|
8531
8555
|
}
|
|
@@ -8533,26 +8557,36 @@ function createData(leafPaint, image, paint, box) {
|
|
|
8533
8557
|
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
8534
8558
|
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
8535
8559
|
}
|
|
8560
|
+
if (around) {
|
|
8561
|
+
const imageBounds = { x, y, width: swapWidth, height: swapHeight };
|
|
8562
|
+
if (scaleX)
|
|
8563
|
+
imageBounds.width *= scaleX, imageBounds.height *= scaleY;
|
|
8564
|
+
AroundHelper.toPoint(around, box, tempPoint, true, imageBounds);
|
|
8565
|
+
x += tempPoint.x, y += tempPoint.y;
|
|
8566
|
+
}
|
|
8567
|
+
if (offset)
|
|
8568
|
+
x += offset.x, y += offset.y;
|
|
8536
8569
|
switch (mode) {
|
|
8537
8570
|
case 'strench':
|
|
8538
8571
|
if (!sameBox)
|
|
8539
8572
|
width = box.width, height = box.height;
|
|
8540
8573
|
break;
|
|
8574
|
+
case 'normal':
|
|
8541
8575
|
case 'clip':
|
|
8542
|
-
if (
|
|
8576
|
+
if (x || y || scaleX || rotation)
|
|
8543
8577
|
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
8544
8578
|
break;
|
|
8545
8579
|
case 'repeat':
|
|
8546
8580
|
if (!sameBox || scaleX || rotation)
|
|
8547
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation);
|
|
8581
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, around);
|
|
8548
8582
|
if (!repeat)
|
|
8549
8583
|
data.repeat = 'repeat';
|
|
8550
8584
|
break;
|
|
8551
8585
|
case 'fit':
|
|
8552
8586
|
case 'cover':
|
|
8553
8587
|
default:
|
|
8554
|
-
if (
|
|
8555
|
-
fillOrFitMode(data,
|
|
8588
|
+
if (scaleX)
|
|
8589
|
+
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
8556
8590
|
}
|
|
8557
8591
|
if (!data.transform) {
|
|
8558
8592
|
if (box.x || box.y) {
|
|
@@ -8560,6 +8594,10 @@ function createData(leafPaint, image, paint, box) {
|
|
|
8560
8594
|
translate(data.transform, box.x, box.y);
|
|
8561
8595
|
}
|
|
8562
8596
|
}
|
|
8597
|
+
if (scaleX && mode !== 'strench') {
|
|
8598
|
+
data.scaleX = scaleX;
|
|
8599
|
+
data.scaleY = scaleY;
|
|
8600
|
+
}
|
|
8563
8601
|
data.width = width;
|
|
8564
8602
|
data.height = height;
|
|
8565
8603
|
if (opacity)
|
|
@@ -9615,6 +9653,13 @@ const ExportModule = {
|
|
|
9615
9653
|
resolve();
|
|
9616
9654
|
this.running = false;
|
|
9617
9655
|
};
|
|
9656
|
+
if (filename === 'json') {
|
|
9657
|
+
return over({ data: leaf.toJSON() });
|
|
9658
|
+
}
|
|
9659
|
+
else if (FileHelper.fileType(filename) === 'json') {
|
|
9660
|
+
Platform.origin.download('data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(leaf.toJSON())), filename);
|
|
9661
|
+
return over({ data: true });
|
|
9662
|
+
}
|
|
9618
9663
|
const { leafer } = leaf;
|
|
9619
9664
|
if (leafer) {
|
|
9620
9665
|
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9753,4 +9798,4 @@ Object.assign(Export, ExportModule);
|
|
|
9753
9798
|
|
|
9754
9799
|
useCanvas();
|
|
9755
9800
|
|
|
9756
|
-
export { AnimateEvent, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, 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, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$
|
|
9801
|
+
export { AnimateEvent, Answer, AroundHelper, AutoBounds, BezierHelper, Bounds, BoundsHelper, Box, BoxData, Branch, BranchHelper, BranchRender, Canvas, CanvasData, CanvasManager, ChildEvent, ColorConvert, Creator, DataHelper, Debug, Direction4, Direction9, Effect, Ellipse, EllipseData, EllipseHelper, Event, EventCreator, Export, FileHelper, Frame, FrameData, Group, GroupData, Image, ImageData, ImageEvent, ImageManager, IncrementId, LayoutEvent, Layouter, Leaf, LeafBounds, LeafBoundsHelper, LeafData, LeafDataProxy, LeafEventer, LeafHelper, LeafLayout, LeafLevelList, LeafList, LeafMatrix, LeafRender, Leafer, LeaferCanvas, LeaferCanvasBase, LeaferData, LeaferEvent, LeaferImage, Line, LineData, MathHelper, Matrix, MatrixHelper, NeedConvertToCanvasCommandMap, OneRadian, PI2, PI_2, Paint, PaintGradient, PaintImage, Path, PathArrow, PathBounds, PathCommandDataHelper, PathCommandMap, PathConvert, PathCorner, PathCreator, PathData, PathDrawer, PathHelper, PathNumberCommandLengthMap, PathNumberCommandMap, Pen, PenData, Platform, Point, PointHelper, Polygon, PolygonData, PropertyEvent, Rect, RectData, RectHelper, RectRender, RenderEvent, Renderer, ResizeEvent, Run, Star, StarData, State, StringNumberMap, TaskItem, TaskProcessor, Text, TextConvert, TextData, TwoPointBoundsHelper, UI, UIBounds, UICreator, UIData, UIRender, UnitConvert, WaitHelper, WatchEvent, Watcher, 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, layoutProcessor, maskType, naturalBoundsType, opacityType, pathInputType, pathType, pen, positionType, registerUI, registerUIEvent, resizeType, rewrite, rewriteAble, rotationType, scaleType, sortType, stateType, strokeType, surfaceType, tempBounds$1 as tempBounds, tempMatrix, tempPoint$3 as tempPoint, useCanvas, useModule, version, zoomLayerType };
|