@leafer-draw/miniapp 1.0.0-rc.20 → 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 +122 -75
- 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;
|
|
@@ -1265,7 +1273,8 @@ class Debug {
|
|
|
1265
1273
|
this.warn(...messages);
|
|
1266
1274
|
}
|
|
1267
1275
|
warn(...messages) {
|
|
1268
|
-
|
|
1276
|
+
if (D$4.showWarn)
|
|
1277
|
+
console.warn(this.name, ...messages);
|
|
1269
1278
|
}
|
|
1270
1279
|
repeat(name, ...messages) {
|
|
1271
1280
|
if (!this.repeatMap[name]) {
|
|
@@ -1284,6 +1293,7 @@ class Debug {
|
|
|
1284
1293
|
}
|
|
1285
1294
|
Debug.filterList = [];
|
|
1286
1295
|
Debug.excludeList = [];
|
|
1296
|
+
Debug.showWarn = true;
|
|
1287
1297
|
function getNameList(name) {
|
|
1288
1298
|
if (!name)
|
|
1289
1299
|
name = [];
|
|
@@ -2206,7 +2216,7 @@ const { sin: sin$3, cos: cos$3, atan2: atan2$1, ceil: ceil$1, abs: abs$3, PI: PI
|
|
|
2206
2216
|
const { setPoint: setPoint$2, addPoint: addPoint$2 } = TwoPointBoundsHelper;
|
|
2207
2217
|
const { set: set$2 } = PointHelper;
|
|
2208
2218
|
const { M: M$5, L: L$6, C: C$5, Q: Q$4, Z: Z$5 } = PathCommandMap;
|
|
2209
|
-
const tempPoint$
|
|
2219
|
+
const tempPoint$2 = {};
|
|
2210
2220
|
const BezierHelper = {
|
|
2211
2221
|
points(data, points, curve, close) {
|
|
2212
2222
|
data.push(M$5, points[0], points[1]);
|
|
@@ -2396,8 +2406,8 @@ const BezierHelper = {
|
|
|
2396
2406
|
addMode ? addPoint$2(pointBounds, fromX, fromY) : setPoint$2(pointBounds, fromX, fromY);
|
|
2397
2407
|
addPoint$2(pointBounds, toX, toY);
|
|
2398
2408
|
for (let i = 0, len = tList.length; i < len; i++) {
|
|
2399
|
-
getPointAndSet(tList[i], fromX, fromY, x1, y1, x2, y2, toX, toY, tempPoint$
|
|
2400
|
-
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);
|
|
2401
2411
|
}
|
|
2402
2412
|
},
|
|
2403
2413
|
getPointAndSet(t, fromX, fromY, x1, y1, x2, y2, toX, toY, setPoint) {
|
|
@@ -3954,15 +3964,21 @@ const LeafHelper = {
|
|
|
3954
3964
|
}
|
|
3955
3965
|
return true;
|
|
3956
3966
|
},
|
|
3957
|
-
moveWorld(t, x, y) {
|
|
3958
|
-
const local = { x, y };
|
|
3967
|
+
moveWorld(t, x, y = 0) {
|
|
3968
|
+
const local = typeof x === 'object' ? Object.assign({}, x) : { x, y };
|
|
3959
3969
|
if (t.parent)
|
|
3960
3970
|
toInnerPoint$1(t.parent.worldTransform, local, local, true);
|
|
3961
3971
|
L.moveLocal(t, local.x, local.y);
|
|
3962
3972
|
},
|
|
3963
3973
|
moveLocal(t, x, y = 0) {
|
|
3964
|
-
|
|
3965
|
-
|
|
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
|
+
}
|
|
3966
3982
|
},
|
|
3967
3983
|
zoomOfWorld(t, origin, scaleX, scaleY, resize) {
|
|
3968
3984
|
L.zoomOfLocal(t, getTempLocal(t, origin), scaleX, scaleY, resize);
|
|
@@ -4524,12 +4540,15 @@ const LeafEventer = {
|
|
|
4524
4540
|
break;
|
|
4525
4541
|
}
|
|
4526
4542
|
}
|
|
4543
|
+
this.syncEventer && this.syncEventer.emitEvent(event, capture);
|
|
4527
4544
|
},
|
|
4528
4545
|
emitEvent(event, capture) {
|
|
4529
4546
|
event.current = this;
|
|
4530
4547
|
this.emit(event.type, event, capture);
|
|
4531
4548
|
},
|
|
4532
4549
|
hasEvent(type, capture) {
|
|
4550
|
+
if (this.syncEventer && this.syncEventer.hasEvent(type, capture))
|
|
4551
|
+
return true;
|
|
4533
4552
|
const { __bubbleMap: b, __captureMap: c } = this;
|
|
4534
4553
|
const hasB = b && b[type], hasC = c && c[type];
|
|
4535
4554
|
return !!(capture === undefined ? (hasB || hasC) : (capture ? hasC : hasB));
|
|
@@ -4749,7 +4768,7 @@ const LeafDataProxy = {
|
|
|
4749
4768
|
};
|
|
4750
4769
|
|
|
4751
4770
|
const { setLayout, multiplyParent: multiplyParent$1, translateInner, defaultWorld } = MatrixHelper;
|
|
4752
|
-
const { toPoint, tempPoint } = AroundHelper;
|
|
4771
|
+
const { toPoint, tempPoint: tempPoint$1 } = AroundHelper;
|
|
4753
4772
|
const LeafMatrix = {
|
|
4754
4773
|
__updateWorldMatrix() {
|
|
4755
4774
|
multiplyParent$1(this.__local || this.__layout, this.parent ? this.parent.__world : defaultWorld, this.__world, !!this.__layout.affectScaleOrRotation, this.__);
|
|
@@ -4766,8 +4785,8 @@ const LeafMatrix = {
|
|
|
4766
4785
|
local.e = data.x;
|
|
4767
4786
|
local.f = data.y;
|
|
4768
4787
|
if (data.around) {
|
|
4769
|
-
toPoint(data.around, layout.boxBounds, tempPoint);
|
|
4770
|
-
translateInner(local, -tempPoint.x, -tempPoint.y);
|
|
4788
|
+
toPoint(data.around, layout.boxBounds, tempPoint$1);
|
|
4789
|
+
translateInner(local, -tempPoint$1.x, -tempPoint$1.y);
|
|
4771
4790
|
}
|
|
4772
4791
|
}
|
|
4773
4792
|
this.__layout.matrixChanged = false;
|
|
@@ -6452,7 +6471,11 @@ function zoomLayerType() {
|
|
|
6452
6471
|
defineKey(target, key, {
|
|
6453
6472
|
set(value) { if (this.isLeafer)
|
|
6454
6473
|
this[privateKey] = value; },
|
|
6455
|
-
get() {
|
|
6474
|
+
get() {
|
|
6475
|
+
return this.isApp
|
|
6476
|
+
? this.tree.zoomLayer
|
|
6477
|
+
: (this.isLeafer ? (this[privateKey] || this) : this.leafer && this.leafer.zoomLayer);
|
|
6478
|
+
}
|
|
6456
6479
|
});
|
|
6457
6480
|
};
|
|
6458
6481
|
}
|
|
@@ -6858,6 +6881,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6858
6881
|
pen.set(this.path = this.__.path || []);
|
|
6859
6882
|
return pen;
|
|
6860
6883
|
}
|
|
6884
|
+
get editConfig() { return undefined; }
|
|
6885
|
+
get editOuter() { return 'EditTool'; }
|
|
6886
|
+
get editInner() { return 'PathEditor'; }
|
|
6861
6887
|
constructor(data) {
|
|
6862
6888
|
super(data);
|
|
6863
6889
|
}
|
|
@@ -6919,7 +6945,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6919
6945
|
__drawPathByBox(drawer) {
|
|
6920
6946
|
const { x, y, width, height } = this.__layout.boxBounds;
|
|
6921
6947
|
if (this.__.cornerRadius) {
|
|
6922
|
-
|
|
6948
|
+
const { cornerRadius } = this.__;
|
|
6949
|
+
drawer.roundRect(x, y, width, height, typeof cornerRadius === 'number' ? [cornerRadius] : cornerRadius);
|
|
6923
6950
|
}
|
|
6924
6951
|
else {
|
|
6925
6952
|
drawer.rect(x, y, width, height);
|
|
@@ -6940,6 +6967,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
6940
6967
|
static registerData(data) {
|
|
6941
6968
|
dataProcessor(data)(this.prototype);
|
|
6942
6969
|
}
|
|
6970
|
+
static setEditConfig(_config) { }
|
|
6971
|
+
static setEditOuter(_toolName) { }
|
|
6972
|
+
static setEditInner(_editorName) { }
|
|
6943
6973
|
destroy() {
|
|
6944
6974
|
this.fill = this.stroke = null;
|
|
6945
6975
|
super.destroy();
|
|
@@ -7023,15 +7053,15 @@ __decorate([
|
|
|
7023
7053
|
__decorate([
|
|
7024
7054
|
dataType(false)
|
|
7025
7055
|
], UI.prototype, "draggable", void 0);
|
|
7056
|
+
__decorate([
|
|
7057
|
+
dataType()
|
|
7058
|
+
], UI.prototype, "dragBounds", void 0);
|
|
7026
7059
|
__decorate([
|
|
7027
7060
|
dataType(false)
|
|
7028
7061
|
], UI.prototype, "editable", void 0);
|
|
7029
7062
|
__decorate([
|
|
7030
7063
|
dataType('size')
|
|
7031
7064
|
], UI.prototype, "editSize", void 0);
|
|
7032
|
-
__decorate([
|
|
7033
|
-
dataType()
|
|
7034
|
-
], UI.prototype, "editorStyle", void 0);
|
|
7035
7065
|
__decorate([
|
|
7036
7066
|
hitType(true)
|
|
7037
7067
|
], UI.prototype, "hittable", void 0);
|
|
@@ -7223,7 +7253,6 @@ Group = __decorate([
|
|
|
7223
7253
|
var Leafer_1;
|
|
7224
7254
|
const debug$1 = Debug.get('Leafer');
|
|
7225
7255
|
let Leafer = Leafer_1 = class Leafer extends Group {
|
|
7226
|
-
static get version() { return '1.0.0-rc.20'; }
|
|
7227
7256
|
get __tag() { return 'Leafer'; }
|
|
7228
7257
|
get isApp() { return false; }
|
|
7229
7258
|
get app() { return this.parent || this; }
|
|
@@ -7276,7 +7305,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7276
7305
|
if (this.isApp)
|
|
7277
7306
|
this.__setApp();
|
|
7278
7307
|
this.__checkAutoLayout(config);
|
|
7279
|
-
this.updateLazyBounds();
|
|
7280
7308
|
this.view = canvas.view;
|
|
7281
7309
|
if (parentApp) {
|
|
7282
7310
|
this.__bindApp(parentApp);
|
|
@@ -7520,6 +7548,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
7520
7548
|
__listenEvents() {
|
|
7521
7549
|
const runId = Run.start('FirstCreate ' + this.innerName);
|
|
7522
7550
|
this.once(LeaferEvent.START, () => Run.end(runId));
|
|
7551
|
+
this.once(LayoutEvent.START, () => this.updateLazyBounds());
|
|
7523
7552
|
this.once(LayoutEvent.END, () => this.__onReady());
|
|
7524
7553
|
this.once(RenderEvent.START, () => this.__onCreated());
|
|
7525
7554
|
this.once(RenderEvent.END, () => this.__onViewReady());
|
|
@@ -8038,6 +8067,7 @@ Canvas = __decorate([
|
|
|
8038
8067
|
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
8039
8068
|
let Text = class Text extends UI {
|
|
8040
8069
|
get __tag() { return 'Text'; }
|
|
8070
|
+
get editInner() { return 'TextEditor'; }
|
|
8041
8071
|
get textDrawData() {
|
|
8042
8072
|
this.__layout.update();
|
|
8043
8073
|
return this.__.__textDrawData;
|
|
@@ -8266,7 +8296,7 @@ function penPathType() {
|
|
|
8266
8296
|
};
|
|
8267
8297
|
}
|
|
8268
8298
|
|
|
8269
|
-
const version = "1.0.0-rc.
|
|
8299
|
+
const version = "1.0.0-rc.21";
|
|
8270
8300
|
|
|
8271
8301
|
function fillText(ui, canvas) {
|
|
8272
8302
|
let row;
|
|
@@ -8570,79 +8600,75 @@ const PaintModule = {
|
|
|
8570
8600
|
|
|
8571
8601
|
let origin = {};
|
|
8572
8602
|
const { get: get$4, rotateOfOuter: rotateOfOuter$2, translate: translate$1, scaleOfOuter: scaleOfOuter$2, scale: scaleHelper, rotate } = MatrixHelper;
|
|
8573
|
-
function fillOrFitMode(data,
|
|
8603
|
+
function fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
8574
8604
|
const transform = get$4();
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
const sh = box.height / (swap ? width : height);
|
|
8578
|
-
const scale = mode === 'fit' ? Math.min(sw, sh) : Math.max(sw, sh);
|
|
8579
|
-
const x = box.x + (box.width - width * scale) / 2;
|
|
8580
|
-
const y = box.y + (box.height - height * scale) / 2;
|
|
8581
|
-
translate$1(transform, x, y);
|
|
8582
|
-
scaleHelper(transform, scale);
|
|
8605
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
8606
|
+
scaleHelper(transform, scaleX, scaleY);
|
|
8583
8607
|
if (rotation)
|
|
8584
8608
|
rotateOfOuter$2(transform, { x: box.x + box.width / 2, y: box.y + box.height / 2 }, rotation);
|
|
8585
|
-
data.scaleX = data.scaleY = scale;
|
|
8586
8609
|
data.transform = transform;
|
|
8587
8610
|
}
|
|
8588
8611
|
function clipMode(data, box, x, y, scaleX, scaleY, rotation) {
|
|
8589
8612
|
const transform = get$4();
|
|
8590
|
-
translate$1(transform, box.x, box.y);
|
|
8591
|
-
if (
|
|
8592
|
-
translate$1(transform, x, y);
|
|
8593
|
-
if (scaleX) {
|
|
8613
|
+
translate$1(transform, box.x + x, box.y + y);
|
|
8614
|
+
if (scaleX)
|
|
8594
8615
|
scaleHelper(transform, scaleX, scaleY);
|
|
8595
|
-
data.scaleX = transform.a;
|
|
8596
|
-
data.scaleY = transform.d;
|
|
8597
|
-
}
|
|
8598
8616
|
if (rotation)
|
|
8599
8617
|
rotate(transform, rotation);
|
|
8600
8618
|
data.transform = transform;
|
|
8601
8619
|
}
|
|
8602
|
-
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation) {
|
|
8620
|
+
function repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, around) {
|
|
8603
8621
|
const transform = get$4();
|
|
8604
8622
|
if (rotation) {
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
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
|
+
}
|
|
8616
8639
|
}
|
|
8617
8640
|
}
|
|
8618
|
-
origin.x = box.x;
|
|
8619
|
-
origin.y = box.y;
|
|
8620
|
-
if (x || y)
|
|
8621
|
-
origin.x += x, origin.y += y;
|
|
8641
|
+
origin.x = box.x + x;
|
|
8642
|
+
origin.y = box.y + y;
|
|
8622
8643
|
translate$1(transform, origin.x, origin.y);
|
|
8623
|
-
if (scaleX)
|
|
8644
|
+
if (scaleX)
|
|
8624
8645
|
scaleOfOuter$2(transform, origin, scaleX, scaleY);
|
|
8625
|
-
data.scaleX = scaleX;
|
|
8626
|
-
data.scaleY = scaleY;
|
|
8627
|
-
}
|
|
8628
8646
|
data.transform = transform;
|
|
8629
8647
|
}
|
|
8630
8648
|
|
|
8631
8649
|
const { get: get$3, translate } = MatrixHelper;
|
|
8632
8650
|
const tempBox = new Bounds();
|
|
8651
|
+
const tempPoint = {};
|
|
8633
8652
|
function createData(leafPaint, image, paint, box) {
|
|
8634
8653
|
let { width, height } = image;
|
|
8635
8654
|
if (paint.padding)
|
|
8636
8655
|
box = tempBox.set(box).shrink(paint.padding);
|
|
8637
|
-
const { opacity, mode, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
8656
|
+
const { opacity, mode, around, offset, scale, size, rotation, blendMode, repeat } = paint;
|
|
8638
8657
|
const sameBox = box.width === width && box.height === height;
|
|
8639
8658
|
if (blendMode)
|
|
8640
8659
|
leafPaint.blendMode = blendMode;
|
|
8641
8660
|
const data = leafPaint.data = { mode };
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
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) {
|
|
8646
8672
|
scaleX = (typeof size === 'number' ? size : size.width) / width;
|
|
8647
8673
|
scaleY = (typeof size === 'number' ? size : size.height) / height;
|
|
8648
8674
|
}
|
|
@@ -8650,26 +8676,36 @@ function createData(leafPaint, image, paint, box) {
|
|
|
8650
8676
|
scaleX = typeof scale === 'number' ? scale : scale.x;
|
|
8651
8677
|
scaleY = typeof scale === 'number' ? scale : scale.y;
|
|
8652
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;
|
|
8653
8688
|
switch (mode) {
|
|
8654
8689
|
case 'strench':
|
|
8655
8690
|
if (!sameBox)
|
|
8656
8691
|
width = box.width, height = box.height;
|
|
8657
8692
|
break;
|
|
8693
|
+
case 'normal':
|
|
8658
8694
|
case 'clip':
|
|
8659
|
-
if (
|
|
8695
|
+
if (x || y || scaleX || rotation)
|
|
8660
8696
|
clipMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
8661
8697
|
break;
|
|
8662
8698
|
case 'repeat':
|
|
8663
8699
|
if (!sameBox || scaleX || rotation)
|
|
8664
|
-
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation);
|
|
8700
|
+
repeatMode(data, box, width, height, x, y, scaleX, scaleY, rotation, around);
|
|
8665
8701
|
if (!repeat)
|
|
8666
8702
|
data.repeat = 'repeat';
|
|
8667
8703
|
break;
|
|
8668
8704
|
case 'fit':
|
|
8669
8705
|
case 'cover':
|
|
8670
8706
|
default:
|
|
8671
|
-
if (
|
|
8672
|
-
fillOrFitMode(data,
|
|
8707
|
+
if (scaleX)
|
|
8708
|
+
fillOrFitMode(data, box, x, y, scaleX, scaleY, rotation);
|
|
8673
8709
|
}
|
|
8674
8710
|
if (!data.transform) {
|
|
8675
8711
|
if (box.x || box.y) {
|
|
@@ -8677,6 +8713,10 @@ function createData(leafPaint, image, paint, box) {
|
|
|
8677
8713
|
translate(data.transform, box.x, box.y);
|
|
8678
8714
|
}
|
|
8679
8715
|
}
|
|
8716
|
+
if (scaleX && mode !== 'strench') {
|
|
8717
|
+
data.scaleX = scaleX;
|
|
8718
|
+
data.scaleY = scaleY;
|
|
8719
|
+
}
|
|
8680
8720
|
data.width = width;
|
|
8681
8721
|
data.height = height;
|
|
8682
8722
|
if (opacity)
|
|
@@ -9732,6 +9772,13 @@ const ExportModule = {
|
|
|
9732
9772
|
resolve();
|
|
9733
9773
|
this.running = false;
|
|
9734
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
|
+
}
|
|
9735
9782
|
const { leafer } = leaf;
|
|
9736
9783
|
if (leafer) {
|
|
9737
9784
|
leafer.waitViewCompleted(() => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9873,4 +9920,4 @@ try {
|
|
|
9873
9920
|
}
|
|
9874
9921
|
catch (_a) { }
|
|
9875
9922
|
|
|
9876
|
-
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 };
|