@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.js
CHANGED
|
@@ -120,7 +120,7 @@ var LeaferUI = (function (exports) {
|
|
|
120
120
|
|
|
121
121
|
const { sin: sin$5, cos: cos$5, acos, sqrt: sqrt$3 } = Math;
|
|
122
122
|
const { float: float$1 } = MathHelper;
|
|
123
|
-
const tempPoint$
|
|
123
|
+
const tempPoint$4 = {};
|
|
124
124
|
function getWorld() {
|
|
125
125
|
return Object.assign(Object.assign(Object.assign({}, getMatrixData()), getBoundsData()), { scaleX: 1, scaleY: 1, rotation: 0, skewX: 0, skewY: 0 });
|
|
126
126
|
}
|
|
@@ -161,8 +161,8 @@ var LeaferUI = (function (exports) {
|
|
|
161
161
|
t.d *= scaleY;
|
|
162
162
|
},
|
|
163
163
|
scaleOfOuter(t, origin, scaleX, scaleY) {
|
|
164
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
165
|
-
M$6.scaleOfInner(t, tempPoint$
|
|
164
|
+
M$6.toInnerPoint(t, origin, tempPoint$4);
|
|
165
|
+
M$6.scaleOfInner(t, tempPoint$4, scaleX, scaleY);
|
|
166
166
|
},
|
|
167
167
|
scaleOfInner(t, origin, scaleX, scaleY = scaleX) {
|
|
168
168
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -180,8 +180,8 @@ var LeaferUI = (function (exports) {
|
|
|
180
180
|
t.d = c * sinR + d * cosR;
|
|
181
181
|
},
|
|
182
182
|
rotateOfOuter(t, origin, rotation) {
|
|
183
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
184
|
-
M$6.rotateOfInner(t, tempPoint$
|
|
183
|
+
M$6.toInnerPoint(t, origin, tempPoint$4);
|
|
184
|
+
M$6.rotateOfInner(t, tempPoint$4, rotation);
|
|
185
185
|
},
|
|
186
186
|
rotateOfInner(t, origin, rotation) {
|
|
187
187
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -202,8 +202,8 @@ var LeaferUI = (function (exports) {
|
|
|
202
202
|
}
|
|
203
203
|
},
|
|
204
204
|
skewOfOuter(t, origin, skewX, skewY) {
|
|
205
|
-
M$6.toInnerPoint(t, origin, tempPoint$
|
|
206
|
-
M$6.skewOfInner(t, tempPoint$
|
|
205
|
+
M$6.toInnerPoint(t, origin, tempPoint$4);
|
|
206
|
+
M$6.skewOfInner(t, tempPoint$4, skewX, skewY);
|
|
207
207
|
},
|
|
208
208
|
skewOfInner(t, origin, skewX, skewY = 0) {
|
|
209
209
|
M$6.translateInner(t, origin.x, origin.y);
|
|
@@ -597,7 +597,7 @@ var LeaferUI = (function (exports) {
|
|
|
597
597
|
return this;
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
const tempPoint$
|
|
600
|
+
const tempPoint$3 = new Point();
|
|
601
601
|
|
|
602
602
|
class Matrix {
|
|
603
603
|
constructor(a, b, c, d, e, f) {
|
|
@@ -1209,11 +1209,19 @@ var LeaferUI = (function (exports) {
|
|
|
1209
1209
|
directionData,
|
|
1210
1210
|
tempPoint: {},
|
|
1211
1211
|
get: get$5,
|
|
1212
|
-
toPoint(around, bounds, to, onlySize) {
|
|
1212
|
+
toPoint(around, bounds, to, onlySize, pointBounds) {
|
|
1213
1213
|
to || (to = {});
|
|
1214
1214
|
const point = get$5(around);
|
|
1215
1215
|
to.x = point.x * bounds.width;
|
|
1216
1216
|
to.y = point.y * bounds.height;
|
|
1217
|
+
if (pointBounds) {
|
|
1218
|
+
to.x -= pointBounds.x;
|
|
1219
|
+
to.y -= pointBounds.y;
|
|
1220
|
+
if (point.x)
|
|
1221
|
+
to.x -= (point.x === 1) ? pointBounds.width : (point.x === 0.5 ? point.x * pointBounds.width : 0);
|
|
1222
|
+
if (point.y)
|
|
1223
|
+
to.y -= (point.y === 1) ? pointBounds.height : (point.y === 0.5 ? point.y * pointBounds.height : 0);
|
|
1224
|
+
}
|
|
1217
1225
|
if (!onlySize) {
|
|
1218
1226
|
to.x += bounds.x;
|
|
1219
1227
|
to.y += bounds.y;
|
|
@@ -2211,7 +2219,7 @@ var LeaferUI = (function (exports) {
|
|
|
2211
2219
|
const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2212
2220
|
const { set: set$2 } = PointHelper;
|
|
2213
2221
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2214
|
-
const tempPoint$
|
|
2222
|
+
const tempPoint$2 = {};
|
|
2215
2223
|
const BezierHelper = {
|
|
2216
2224
|
points(data, points, curve, close) {
|
|
2217
2225
|
data.push(M$5, points[0], points[1]);
|
|
@@ -2401,8 +2409,8 @@ var LeaferUI = (function (exports) {
|
|
|
2401
2409
|
addMode ? addPoint$2(pointBounds, fromX, fromY) : setPoint$2(pointBounds, fromX, fromY);
|
|
2402
2410
|
addPoint$2(pointBounds, toX, toY);
|
|
2403
2411
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2404
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2405
|
-
addPoint$2(pointBounds, tempPoint$
|
|
2412
|
+
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$2);
|
|
2413
|
+
addPoint$2(pointBounds, tempPoint$2.x, tempPoint$2.y);
|
|
2406
2414
|
}
|
|
2407
2415
|
},
|
|
2408
2416
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -3959,15 +3967,21 @@ var LeaferUI = (function (exports) {
|
|
|
3959
3967
|
}
|
|
3960
3968
|
return true;
|
|
3961
3969
|
},
|
|
3962
|
-
moveWorld(t, x, y) {
|
|
3963
|
-
const local = { x, y };
|
|
3970
|
+
moveWorld(t, x, y = 0) {
|
|
3971
|
+
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
3964
3972
|
if (t.parent)
|
|
3965
3973
|
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
3966
3974
|
L.moveLocal(t, local.x, local.y);
|
|
3967
3975
|
},
|
|
3968
3976
|
moveLocal(t, x, y = 0) {
|
|
3969
|
-
|
|
3970
|
-
|
|
3977
|
+
if (typeof x === 'object') {
|
|
3978
|
+
t.x += x.x;
|
|
3979
|
+
t.y += x.y;
|
|
3980
|
+
}
|
|
3981
|
+
else {
|
|
3982
|
+
t.x += x;
|
|
3983
|
+
t.y += y;
|
|
3984
|
+
}
|
|
3971
3985
|
},
|
|
3972
3986
|
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
3973
3987
|
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
@@ -4529,12 +4543,15 @@ var LeaferUI = (function (exports) {
|
|
|
4529
4543
|
break;
|
|
4530
4544
|
}
|
|
4531
4545
|
}
|
|
4546
|
+
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
4532
4547
|
},
|
|
4533
4548
|
emitEvent(event, capture) {
|
|
4534
4549
|
event.current = this;
|
|
4535
4550
|
this.emit(event.type, event, capture);
|
|
4536
4551
|
},
|
|
4537
4552
|
hasEvent(type, capture) {
|
|
4553
|
+
if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
|
|
4554
|
+
return true;
|
|
4538
4555
|
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4539
4556
|
const hasB = b && b[type], hasC = c && c[type];
|
|
4540
4557
|
return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
|
|
@@ -4754,7 +4771,7 @@ var LeaferUI = (function (exports) {
|
|
|
4754
4771
|
};
|
|
4755
4772
|
|
|
4756
4773
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
4757
|
-
const { toPoint, tempPoint } = AroundHelper;
|
|
4774
|
+
const { toPoint, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4758
4775
|
const LeafMatrix = {
|
|
4759
4776
|
__updateWorldMatrix() {
|
|
4760
4777
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
@@ -4771,8 +4788,8 @@ var LeaferUI = (function (exports) {
|
|
|
4771
4788
|
local.e = data.x;
|
|
4772
4789
|
local.f = data.y;
|
|
4773
4790
|
if (data.around) {
|
|
4774
|
-
toPoint(data.around, layout.boxBounds, tempPoint);
|
|
4775
|
-
translateInner(local, -tempPoint.x, -tempPoint.y);
|
|
4791
|
+
toPoint(data.around, layout.boxBounds, tempPoint$1);
|
|
4792
|
+
translateInner(local, -tempPoint$1.x, -tempPoint$1.y);
|
|
4776
4793
|
}
|
|
4777
4794
|
}
|
|
4778
4795
|
this.__layout.matrixChanged = false;
|
|
@@ -6338,7 +6355,11 @@ var LeaferUI = (function (exports) {
|
|
|
6338
6355
|
defineKey(target, key, {
|
|
6339
6356
|
set(value) { if (this.isLeafer)
|
|
6340
6357
|
this[privateKey] = value; },
|
|
6341
|
-
get() {
|
|
6358
|
+
get() {
|
|
6359
|
+
return this.isApp
|
|
6360
|
+
? this.tree.zoomLayer
|
|
6361
|
+
: (this.isLeafer ? (this[privateKey] || this) : this.leafer && this.leafer.zoomLayer);
|
|
6362
|
+
}
|
|
6342
6363
|
});
|
|
6343
6364
|
};
|
|
6344
6365
|
}
|
|
@@ -6744,6 +6765,9 @@ var LeaferUI = (function (exports) {
|
|
|
6744
6765
|
pen.set(this.path = this.__.path || []);
|
|
6745
6766
|
return pen;
|
|
6746
6767
|
}
|
|
6768
|
+
get editConfig() { return undefined; }
|
|
6769
|
+
get editOuter() { return 'EditTool'; }
|
|
6770
|
+
get editInner() { return 'PathEditor'; }
|
|
6747
6771
|
constructor(data) {
|
|
6748
6772
|
super(data);
|
|
6749
6773
|
}
|
|
@@ -6805,7 +6829,8 @@ var LeaferUI = (function (exports) {
|
|
|
6805
6829
|
__drawPathByBox(drawer) {
|
|
6806
6830
|
const { x, y, width, height } = this.__layout.boxBounds;
|
|
6807
6831
|
if (this.__.cornerRadius) {
|
|
6808
|
-
|
|
6832
|
+
const { cornerRadius } = this.__;
|
|
6833
|
+
drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius);
|
|
6809
6834
|
}
|
|
6810
6835
|
else {
|
|
6811
6836
|
drawer.rect(x, y, width, height);
|
|
@@ -6826,6 +6851,9 @@ var LeaferUI = (function (exports) {
|
|
|
6826
6851
|
static registerData(data) {
|
|
6827
6852
|
dataProcessor(data)(this.prototype);
|
|
6828
6853
|
}
|
|
6854
|
+
static setEditConfig(_config) { }
|
|
6855
|
+
static setEditOuter(_toolName) { }
|
|
6856
|
+
static setEditInner(_editorName) { }
|
|
6829
6857
|
destroy() {
|
|
6830
6858
|
this.fill = this.stroke = null;
|
|
6831
6859
|
super.destroy();
|
|
@@ -6909,15 +6937,15 @@ var LeaferUI = (function (exports) {
|
|
|
6909
6937
|
__decorate([
|
|
6910
6938
|
dataType(false)
|
|
6911
6939
|
], exports.UI.prototype, "draggable", void 0);
|
|
6940
|
+
__decorate([
|
|
6941
|
+
dataType()
|
|
6942
|
+
], exports.UI.prototype, "dragBounds", void 0);
|
|
6912
6943
|
__decorate([
|
|
6913
6944
|
dataType(false)
|
|
6914
6945
|
], exports.UI.prototype, "editable", void 0);
|
|
6915
6946
|
__decorate([
|
|
6916
6947
|
dataType('size')
|
|
6917
6948
|
], exports.UI.prototype, "editSize", void 0);
|
|
6918
|
-
__decorate([
|
|
6919
|
-
dataType()
|
|
6920
|
-
], exports.UI.prototype, "editorStyle", void 0);
|
|
6921
6949
|
__decorate([
|
|
6922
6950
|
hitType(true)
|
|
6923
6951
|
], exports.UI.prototype, "hittable", void 0);
|
|
@@ -7109,7 +7137,6 @@ var LeaferUI = (function (exports) {
|
|
|
7109
7137
|
var Leafer_1;
|
|
7110
7138
|
const debug$1 = Debug.get('Leafer');
|
|
7111
7139
|
exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
|
|
7112
|
-
static get version() { return '1.0.0-rc.21'; }
|
|
7113
7140
|
get __tag() { return 'Leafer'; }
|
|
7114
7141
|
get isApp() { return false; }
|
|
7115
7142
|
get app() { return this.parent || this; }
|
|
@@ -7162,7 +7189,6 @@ var LeaferUI = (function (exports) {
|
|
|
7162
7189
|
if (this.isApp)
|
|
7163
7190
|
this.__setApp();
|
|
7164
7191
|
this.__checkAutoLayout(config);
|
|
7165
|
-
this.updateLazyBounds();
|
|
7166
7192
|
this.view = canvas.view;
|
|
7167
7193
|
if (parentApp) {
|
|
7168
7194
|
this.__bindApp(parentApp);
|
|
@@ -7406,6 +7432,7 @@ var LeaferUI = (function (exports) {
|
|
|
7406
7432
|
__listenEvents() {
|
|
7407
7433
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
7408
7434
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
7435
|
+
this.once(LayoutEvent.START, () => this.updateLazyBounds());
|
|
7409
7436
|
this.once(LayoutEvent.END, () => this.__onReady());
|
|
7410
7437
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
7411
7438
|
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
@@ -7924,6 +7951,7 @@ var LeaferUI = (function (exports) {
|
|
|
7924
7951
|
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
7925
7952
|
exports.Text = class Text extends exports.UI {
|
|
7926
7953
|
get __tag() { return 'Text'; }
|
|
7954
|
+
get editInner() { return 'TextEditor'; }
|
|
7927
7955
|
get textDrawData() {
|
|
7928
7956
|
this.__layout.update();
|
|
7929
7957
|
return this.__.__textDrawData;
|
|
@@ -8456,79 +8484,75 @@ var LeaferUI = (function (exports) {
|
|
|
8456
8484
|
|
|
8457
8485
|
let origin = {};
|
|
8458
8486
|
const { get: get$4, rotateOfOuter: rotateOfOuter$2, translate: translate$1, scaleOfOuter: scaleOfOuter$2, scale: scaleHelper, rotate } = MatrixHelper;
|
|
8459
|
-
function fillOrFitMode(data,
|
|
8487
|
+
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
8460
8488
|
const transform = get$4();
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
const sh = box.height / (swap ? width : height);
|
|
8464
|
-
const scale = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
|
|
8465
|
-
const x = box.x + (box.width - width * scale) / 2;
|
|
8466
|
-
const y = box.y + (box.height - height * scale) / 2;
|
|
8467
|
-
translate$1(transform, x, y);
|
|
8468
|
-
scaleHelper(transform, scale);
|
|
8489
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
8490
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
8469
8491
|
if (rotation)
|
|
8470
8492
|
rotateOfOuter$2(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
8471
|
-
data.scaleX = data.scaleY = scale;
|
|
8472
8493
|
data.transform = transform;
|
|
8473
8494
|
}
|
|
8474
8495
|
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
8475
8496
|
const transform = get$4();
|
|
8476
|
-
translate$1(transform, box.x, box.y);
|
|
8477
|
-
if (
|
|
8478
|
-
translate$1(transform, x, y);
|
|
8479
|
-
if (scaleX) {
|
|
8497
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
8498
|
+
if (scaleX)
|
|
8480
8499
|
scaleHelper(transform, scaleX, scaleY);
|
|
8481
|
-
data.scaleX = transform.a;
|
|
8482
|
-
data.scaleY = transform.d;
|
|
8483
|
-
}
|
|
8484
8500
|
if (rotation)
|
|
8485
8501
|
rotate(transform, rotation);
|
|
8486
8502
|
data.transform = transform;
|
|
8487
8503
|
}
|
|
8488
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation) {
|
|
8504
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, around) {
|
|
8489
8505
|
const transform = get$4();
|
|
8490
8506
|
if (rotation) {
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8507
|
+
if (around === 'center') {
|
|
8508
|
+
rotateOfOuter$2(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
8509
|
+
}
|
|
8510
|
+
else {
|
|
8511
|
+
rotate(transform, rotation);
|
|
8512
|
+
switch (rotation) {
|
|
8513
|
+
case 90:
|
|
8514
|
+
translate$1(transform, height, 0);
|
|
8515
|
+
break;
|
|
8516
|
+
case 180:
|
|
8517
|
+
translate$1(transform, width, height);
|
|
8518
|
+
break;
|
|
8519
|
+
case 270:
|
|
8520
|
+
translate$1(transform, 0, width);
|
|
8521
|
+
break;
|
|
8522
|
+
}
|
|
8502
8523
|
}
|
|
8503
8524
|
}
|
|
8504
|
-
origin.x = box.x;
|
|
8505
|
-
origin.y = box.y;
|
|
8506
|
-
if (x || y)
|
|
8507
|
-
origin.x += x, origin.y += y;
|
|
8525
|
+
origin.x = box.x + x;
|
|
8526
|
+
origin.y = box.y + y;
|
|
8508
8527
|
translate$1(transform, origin.x, origin.y);
|
|
8509
|
-
if (scaleX)
|
|
8528
|
+
if (scaleX)
|
|
8510
8529
|
scaleOfOuter$2(transform, origin, scaleX, scaleY);
|
|
8511
|
-
data.scaleX = scaleX;
|
|
8512
|
-
data.scaleY = scaleY;
|
|
8513
|
-
}
|
|
8514
8530
|
data.transform = transform;
|
|
8515
8531
|
}
|
|
8516
8532
|
|
|
8517
8533
|
const { get: get$3, translate } = MatrixHelper;
|
|
8518
8534
|
const tempBox = new Bounds();
|
|
8535
|
+
const tempPoint = {};
|
|
8519
8536
|
function createData(leafPaint, image, paint, box) {
|
|
8520
8537
|
let { width, height } = image;
|
|
8521
8538
|
if (paint.padding)
|
|
8522
8539
|
box = tempBox.set(box).shrink(paint.padding);
|
|
8523
|
-
const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
8540
|
+
const { opacity, mode, around, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
8524
8541
|
const sameBox = box.width === width && box.height === height;
|
|
8525
8542
|
if (blendMode)
|
|
8526
8543
|
leafPaint.blendMode = blendMode;
|
|
8527
8544
|
const data = leafPaint.data = { mode };
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
if (
|
|
8545
|
+
const swapSize = around !== 'center' && (rotation || 0) % 180 === 90;
|
|
8546
|
+
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
8547
|
+
let x = 0, y = 0, scaleX, scaleY;
|
|
8548
|
+
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
8549
|
+
if (!sameBox || rotation) {
|
|
8550
|
+
const sw = box.width / swapWidth, sh = box.height / swapHeight;
|
|
8551
|
+
scaleX = scaleY = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
|
|
8552
|
+
x += (box.width - width * scaleX) / 2, y += (box.height - height * scaleY) / 2;
|
|
8553
|
+
}
|
|
8554
|
+
}
|
|
8555
|
+
else if (size) {
|
|
8532
8556
|
scaleX = (typeof size === 'number' ? size : size.width) / width;
|
|
8533
8557
|
scaleY = (typeof size === 'number' ? size : size.height) / height;
|
|
8534
8558
|
}
|
|
@@ -8536,26 +8560,36 @@ var LeaferUI = (function (exports) {
|
|
|
8536
8560
|
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
8537
8561
|
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
8538
8562
|
}
|
|
8563
|
+
if (around) {
|
|
8564
|
+
const imageBounds = { x, y, width: swapWidth, height: swapHeight };
|
|
8565
|
+
if (scaleX)
|
|
8566
|
+
imageBounds.width *= scaleX, imageBounds.height *= scaleY;
|
|
8567
|
+
AroundHelper.toPoint(around, box, tempPoint, true, imageBounds);
|
|
8568
|
+
x += tempPoint.x, y += tempPoint.y;
|
|
8569
|
+
}
|
|
8570
|
+
if (offset)
|
|
8571
|
+
x += offset.x, y += offset.y;
|
|
8539
8572
|
switch (mode) {
|
|
8540
8573
|
case 'strench':
|
|
8541
8574
|
if (!sameBox)
|
|
8542
8575
|
width = box.width, height = box.height;
|
|
8543
8576
|
break;
|
|
8577
|
+
case 'normal':
|
|
8544
8578
|
case 'clip':
|
|
8545
|
-
if (
|
|
8579
|
+
if (x || y || scaleX || rotation)
|
|
8546
8580
|
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
8547
8581
|
break;
|
|
8548
8582
|
case 'repeat':
|
|
8549
8583
|
if (!sameBox || scaleX || rotation)
|
|
8550
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation);
|
|
8584
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, around);
|
|
8551
8585
|
if (!repeat)
|
|
8552
8586
|
data.repeat = 'repeat';
|
|
8553
8587
|
break;
|
|
8554
8588
|
case 'fit':
|
|
8555
8589
|
case 'cover':
|
|
8556
8590
|
default:
|
|
8557
|
-
if (
|
|
8558
|
-
fillOrFitMode(data,
|
|
8591
|
+
if (scaleX)
|
|
8592
|
+
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
8559
8593
|
}
|
|
8560
8594
|
if (!data.transform) {
|
|
8561
8595
|
if (box.x || box.y) {
|
|
@@ -8563,6 +8597,10 @@ var LeaferUI = (function (exports) {
|
|
|
8563
8597
|
translate(data.transform, box.x, box.y);
|
|
8564
8598
|
}
|
|
8565
8599
|
}
|
|
8600
|
+
if (scaleX && mode !== 'strench') {
|
|
8601
|
+
data.scaleX = scaleX;
|
|
8602
|
+
data.scaleY = scaleY;
|
|
8603
|
+
}
|
|
8566
8604
|
data.width = width;
|
|
8567
8605
|
data.height = height;
|
|
8568
8606
|
if (opacity)
|
|
@@ -9618,6 +9656,13 @@ var LeaferUI = (function (exports) {
|
|
|
9618
9656
|
resolve();
|
|
9619
9657
|
this.running = false;
|
|
9620
9658
|
};
|
|
9659
|
+
if (filename === 'json') {
|
|
9660
|
+
return over({ data: leaf.toJSON() });
|
|
9661
|
+
}
|
|
9662
|
+
else if (FileHelper.fileType(filename) === 'json') {
|
|
9663
|
+
Platform.origin.download('data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(leaf.toJSON())), filename);
|
|
9664
|
+
return over({ data: true });
|
|
9665
|
+
}
|
|
9621
9666
|
const { leafer } = leaf;
|
|
9622
9667
|
if (leafer) {
|
|
9623
9668
|
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9901,7 +9946,7 @@ var LeaferUI = (function (exports) {
|
|
|
9901
9946
|
exports.surfaceType = surfaceType;
|
|
9902
9947
|
exports.tempBounds = tempBounds$1;
|
|
9903
9948
|
exports.tempMatrix = tempMatrix;
|
|
9904
|
-
exports.tempPoint = tempPoint$
|
|
9949
|
+
exports.tempPoint = tempPoint$3;
|
|
9905
9950
|
exports.useCanvas = useCanvas;
|
|
9906
9951
|
exports.useModule = useModule;
|
|
9907
9952
|
exports.version = version;
|