@leafer-draw/miniapp 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/miniapp.esm.js +64 -47
- package/dist/miniapp.esm.min.js +1 -1
- package/dist/miniapp.module.js +118 -73
- package/dist/miniapp.module.min.js +1 -1
- package/package.json +7 -7
package/dist/miniapp.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;
|
|
@@ -6454,7 +6471,11 @@ function zoomLayerType() {
|
|
|
6454
6471
|
defineKey(target, key, {
|
|
6455
6472
|
set(value) { if (this.isLeafer)
|
|
6456
6473
|
this[privateKey] = value; },
|
|
6457
|
-
get() {
|
|
6474
|
+
get() {
|
|
6475
|
+
return this.isApp
|
|
6476
|
+
? this.tree.zoomLayer
|
|
6477
|
+
: (this.isLeafer ? (this[privateKey] || this) : this.leafer && this.leafer.zoomLayer);
|
|
6478
|
+
}
|
|
6458
6479
|
});
|
|
6459
6480
|
};
|
|
6460
6481
|
}
|
|
@@ -6860,6 +6881,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6860
6881
|
pen.set(this.path = this.__.path || []);
|
|
6861
6882
|
return pen;
|
|
6862
6883
|
}
|
|
6884
|
+
get editConfig() { return undefined; }
|
|
6885
|
+
get editOuter() { return 'EditTool'; }
|
|
6886
|
+
get editInner() { return 'PathEditor'; }
|
|
6863
6887
|
constructor(data) {
|
|
6864
6888
|
super(data);
|
|
6865
6889
|
}
|
|
@@ -6921,7 +6945,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6921
6945
|
__drawPathByBox(drawer) {
|
|
6922
6946
|
const { x, y, width, height } = this.__layout.boxBounds;
|
|
6923
6947
|
if (this.__.cornerRadius) {
|
|
6924
|
-
|
|
6948
|
+
const { cornerRadius } = this.__;
|
|
6949
|
+
drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius);
|
|
6925
6950
|
}
|
|
6926
6951
|
else {
|
|
6927
6952
|
drawer.rect(x, y, width, height);
|
|
@@ -6942,6 +6967,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6942
6967
|
static registerData(data) {
|
|
6943
6968
|
dataProcessor(data)(this.prototype);
|
|
6944
6969
|
}
|
|
6970
|
+
static setEditConfig(_config) { }
|
|
6971
|
+
static setEditOuter(_toolName) { }
|
|
6972
|
+
static setEditInner(_editorName) { }
|
|
6945
6973
|
destroy() {
|
|
6946
6974
|
this.fill = this.stroke = null;
|
|
6947
6975
|
super.destroy();
|
|
@@ -7025,15 +7053,15 @@ __decorate([
|
|
|
7025
7053
|
__decorate([
|
|
7026
7054
|
dataType(false)
|
|
7027
7055
|
], UI.prototype, "draggable", void 0);
|
|
7056
|
+
__decorate([
|
|
7057
|
+
dataType()
|
|
7058
|
+
], UI.prototype, "dragBounds", void 0);
|
|
7028
7059
|
__decorate([
|
|
7029
7060
|
dataType(false)
|
|
7030
7061
|
], UI.prototype, "editable", void 0);
|
|
7031
7062
|
__decorate([
|
|
7032
7063
|
dataType('size')
|
|
7033
7064
|
], UI.prototype, "editSize", void 0);
|
|
7034
|
-
__decorate([
|
|
7035
|
-
dataType()
|
|
7036
|
-
], UI.prototype, "editorStyle", void 0);
|
|
7037
7065
|
__decorate([
|
|
7038
7066
|
hitType(true)
|
|
7039
7067
|
], UI.prototype, "hittable", void 0);
|
|
@@ -7225,7 +7253,6 @@ Group = __decorate([
|
|
|
7225
7253
|
var Leafer_1;
|
|
7226
7254
|
const debug$1 = Debug.get('Leafer');
|
|
7227
7255
|
let Leafer = Leafer_1 = class Leafer extends Group {
|
|
7228
|
-
static get version() { return '1.0.0-rc.21'; }
|
|
7229
7256
|
get __tag() { return 'Leafer'; }
|
|
7230
7257
|
get isApp() { return false; }
|
|
7231
7258
|
get app() { return this.parent || this; }
|
|
@@ -7278,7 +7305,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7278
7305
|
if (this.isApp)
|
|
7279
7306
|
this.__setApp();
|
|
7280
7307
|
this.__checkAutoLayout(config);
|
|
7281
|
-
this.updateLazyBounds();
|
|
7282
7308
|
this.view = canvas.view;
|
|
7283
7309
|
if (parentApp) {
|
|
7284
7310
|
this.__bindApp(parentApp);
|
|
@@ -7522,6 +7548,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7522
7548
|
__listenEvents() {
|
|
7523
7549
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
7524
7550
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
7551
|
+
this.once(LayoutEvent.START, () => this.updateLazyBounds());
|
|
7525
7552
|
this.once(LayoutEvent.END, () => this.__onReady());
|
|
7526
7553
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
7527
7554
|
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
@@ -8040,6 +8067,7 @@ Canvas = __decorate([
|
|
|
8040
8067
|
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
8041
8068
|
let Text = class Text extends UI {
|
|
8042
8069
|
get __tag() { return 'Text'; }
|
|
8070
|
+
get editInner() { return 'TextEditor'; }
|
|
8043
8071
|
get textDrawData() {
|
|
8044
8072
|
this.__layout.update();
|
|
8045
8073
|
return this.__.__textDrawData;
|
|
@@ -8572,79 +8600,75 @@ const PaintModule = {
|
|
|
8572
8600
|
|
|
8573
8601
|
let origin = {};
|
|
8574
8602
|
const { get: get$4, rotateOfOuter: rotateOfOuter$2, translate: translate$1, scaleOfOuter: scaleOfOuter$2, scale: scaleHelper, rotate } = MatrixHelper;
|
|
8575
|
-
function fillOrFitMode(data,
|
|
8603
|
+
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
8576
8604
|
const transform = get$4();
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
const sh = box.height / (swap ? width : height);
|
|
8580
|
-
const scale = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
|
|
8581
|
-
const x = box.x + (box.width - width * scale) / 2;
|
|
8582
|
-
const y = box.y + (box.height - height * scale) / 2;
|
|
8583
|
-
translate$1(transform, x, y);
|
|
8584
|
-
scaleHelper(transform, scale);
|
|
8605
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
8606
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
8585
8607
|
if (rotation)
|
|
8586
8608
|
rotateOfOuter$2(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
8587
|
-
data.scaleX = data.scaleY = scale;
|
|
8588
8609
|
data.transform = transform;
|
|
8589
8610
|
}
|
|
8590
8611
|
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
8591
8612
|
const transform = get$4();
|
|
8592
|
-
translate$1(transform, box.x, box.y);
|
|
8593
|
-
if (
|
|
8594
|
-
translate$1(transform, x, y);
|
|
8595
|
-
if (scaleX) {
|
|
8613
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
8614
|
+
if (scaleX)
|
|
8596
8615
|
scaleHelper(transform, scaleX, scaleY);
|
|
8597
|
-
data.scaleX = transform.a;
|
|
8598
|
-
data.scaleY = transform.d;
|
|
8599
|
-
}
|
|
8600
8616
|
if (rotation)
|
|
8601
8617
|
rotate(transform, rotation);
|
|
8602
8618
|
data.transform = transform;
|
|
8603
8619
|
}
|
|
8604
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation) {
|
|
8620
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, around) {
|
|
8605
8621
|
const transform = get$4();
|
|
8606
8622
|
if (rotation) {
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8623
|
+
if (around === 'center') {
|
|
8624
|
+
rotateOfOuter$2(transform, { x: width / 2, y: height / 2 }, rotation);
|
|
8625
|
+
}
|
|
8626
|
+
else {
|
|
8627
|
+
rotate(transform, rotation);
|
|
8628
|
+
switch (rotation) {
|
|
8629
|
+
case 90:
|
|
8630
|
+
translate$1(transform, height, 0);
|
|
8631
|
+
break;
|
|
8632
|
+
case 180:
|
|
8633
|
+
translate$1(transform, width, height);
|
|
8634
|
+
break;
|
|
8635
|
+
case 270:
|
|
8636
|
+
translate$1(transform, 0, width);
|
|
8637
|
+
break;
|
|
8638
|
+
}
|
|
8618
8639
|
}
|
|
8619
8640
|
}
|
|
8620
|
-
origin.x = box.x;
|
|
8621
|
-
origin.y = box.y;
|
|
8622
|
-
if (x || y)
|
|
8623
|
-
origin.x += x, origin.y += y;
|
|
8641
|
+
origin.x = box.x + x;
|
|
8642
|
+
origin.y = box.y + y;
|
|
8624
8643
|
translate$1(transform, origin.x, origin.y);
|
|
8625
|
-
if (scaleX)
|
|
8644
|
+
if (scaleX)
|
|
8626
8645
|
scaleOfOuter$2(transform, origin, scaleX, scaleY);
|
|
8627
|
-
data.scaleX = scaleX;
|
|
8628
|
-
data.scaleY = scaleY;
|
|
8629
|
-
}
|
|
8630
8646
|
data.transform = transform;
|
|
8631
8647
|
}
|
|
8632
8648
|
|
|
8633
8649
|
const { get: get$3, translate } = MatrixHelper;
|
|
8634
8650
|
const tempBox = new Bounds();
|
|
8651
|
+
const tempPoint = {};
|
|
8635
8652
|
function createData(leafPaint, image, paint, box) {
|
|
8636
8653
|
let { width, height } = image;
|
|
8637
8654
|
if (paint.padding)
|
|
8638
8655
|
box = tempBox.set(box).shrink(paint.padding);
|
|
8639
|
-
const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
8656
|
+
const { opacity, mode, around, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
8640
8657
|
const sameBox = box.width === width && box.height === height;
|
|
8641
8658
|
if (blendMode)
|
|
8642
8659
|
leafPaint.blendMode = blendMode;
|
|
8643
8660
|
const data = leafPaint.data = { mode };
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
if (
|
|
8661
|
+
const swapSize = around !== 'center' && (rotation || 0) % 180 === 90;
|
|
8662
|
+
const swapWidth = swapSize ? height : width, swapHeight = swapSize ? width : height;
|
|
8663
|
+
let x = 0, y = 0, scaleX, scaleY;
|
|
8664
|
+
if (!mode || mode === 'cover' || mode === 'fit') {
|
|
8665
|
+
if (!sameBox || rotation) {
|
|
8666
|
+
const sw = box.width / swapWidth, sh = box.height / swapHeight;
|
|
8667
|
+
scaleX = scaleY = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
|
|
8668
|
+
x += (box.width - width * scaleX) / 2, y += (box.height - height * scaleY) / 2;
|
|
8669
|
+
}
|
|
8670
|
+
}
|
|
8671
|
+
else if (size) {
|
|
8648
8672
|
scaleX = (typeof size === 'number' ? size : size.width) / width;
|
|
8649
8673
|
scaleY = (typeof size === 'number' ? size : size.height) / height;
|
|
8650
8674
|
}
|
|
@@ -8652,26 +8676,36 @@ function createData(leafPaint, image, paint, box) {
|
|
|
8652
8676
|
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
8653
8677
|
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
8654
8678
|
}
|
|
8679
|
+
if (around) {
|
|
8680
|
+
const imageBounds = { x, y, width: swapWidth, height: swapHeight };
|
|
8681
|
+
if (scaleX)
|
|
8682
|
+
imageBounds.width *= scaleX, imageBounds.height *= scaleY;
|
|
8683
|
+
AroundHelper.toPoint(around, box, tempPoint, true, imageBounds);
|
|
8684
|
+
x += tempPoint.x, y += tempPoint.y;
|
|
8685
|
+
}
|
|
8686
|
+
if (offset)
|
|
8687
|
+
x += offset.x, y += offset.y;
|
|
8655
8688
|
switch (mode) {
|
|
8656
8689
|
case 'strench':
|
|
8657
8690
|
if (!sameBox)
|
|
8658
8691
|
width = box.width, height = box.height;
|
|
8659
8692
|
break;
|
|
8693
|
+
case 'normal':
|
|
8660
8694
|
case 'clip':
|
|
8661
|
-
if (
|
|
8695
|
+
if (x || y || scaleX || rotation)
|
|
8662
8696
|
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
8663
8697
|
break;
|
|
8664
8698
|
case 'repeat':
|
|
8665
8699
|
if (!sameBox || scaleX || rotation)
|
|
8666
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation);
|
|
8700
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, around);
|
|
8667
8701
|
if (!repeat)
|
|
8668
8702
|
data.repeat = 'repeat';
|
|
8669
8703
|
break;
|
|
8670
8704
|
case 'fit':
|
|
8671
8705
|
case 'cover':
|
|
8672
8706
|
default:
|
|
8673
|
-
if (
|
|
8674
|
-
fillOrFitMode(data,
|
|
8707
|
+
if (scaleX)
|
|
8708
|
+
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
8675
8709
|
}
|
|
8676
8710
|
if (!data.transform) {
|
|
8677
8711
|
if (box.x || box.y) {
|
|
@@ -8679,6 +8713,10 @@ function createData(leafPaint, image, paint, box) {
|
|
|
8679
8713
|
translate(data.transform, box.x, box.y);
|
|
8680
8714
|
}
|
|
8681
8715
|
}
|
|
8716
|
+
if (scaleX && mode !== 'strench') {
|
|
8717
|
+
data.scaleX = scaleX;
|
|
8718
|
+
data.scaleY = scaleY;
|
|
8719
|
+
}
|
|
8682
8720
|
data.width = width;
|
|
8683
8721
|
data.height = height;
|
|
8684
8722
|
if (opacity)
|
|
@@ -9734,6 +9772,13 @@ const ExportModule = {
|
|
|
9734
9772
|
resolve();
|
|
9735
9773
|
this.running = false;
|
|
9736
9774
|
};
|
|
9775
|
+
if (filename === 'json') {
|
|
9776
|
+
return over({ data: leaf.toJSON() });
|
|
9777
|
+
}
|
|
9778
|
+
else if (FileHelper.fileType(filename) === 'json') {
|
|
9779
|
+
Platform.origin.download('data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(leaf.toJSON())), filename);
|
|
9780
|
+
return over({ data: true });
|
|
9781
|
+
}
|
|
9737
9782
|
const { leafer } = leaf;
|
|
9738
9783
|
if (leafer) {
|
|
9739
9784
|
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9875,4 +9920,4 @@ try {
|
|
|
9875
9920
|
}
|
|
9876
9921
|
catch (_a) { }
|
|
9877
9922
|
|
|
9878
|
-
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$
|
|
9923
|
+
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 };
|