@leafer-editor/worker 1.1.2 → 1.2.0
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.js +291 -269
- package/dist/worker.min.js +1 -1
- package/dist/worker.module.js +291 -263
- package/dist/worker.module.min.js +1 -1
- package/package.json +6 -6
package/dist/worker.js
CHANGED
|
@@ -1405,9 +1405,21 @@ var LeaferUI = (function (exports) {
|
|
|
1405
1405
|
};
|
|
1406
1406
|
const R = Run;
|
|
1407
1407
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1408
|
+
const Plugin = {
|
|
1409
|
+
list: {},
|
|
1410
|
+
add(name) {
|
|
1411
|
+
this.list[name] = true;
|
|
1412
|
+
},
|
|
1413
|
+
check(name, tip) {
|
|
1414
|
+
const rs = this.list[name];
|
|
1415
|
+
if (!rs && tip)
|
|
1416
|
+
this.need(name);
|
|
1417
|
+
return rs;
|
|
1418
|
+
},
|
|
1419
|
+
need(name) {
|
|
1420
|
+
console.error('need plugin: @leafer-in/' + name);
|
|
1421
|
+
}
|
|
1422
|
+
};
|
|
1411
1423
|
|
|
1412
1424
|
const debug$g = Debug.get('UICreator');
|
|
1413
1425
|
const UICreator = {
|
|
@@ -5632,10 +5644,10 @@ var LeaferUI = (function (exports) {
|
|
|
5632
5644
|
__updatePath() { }
|
|
5633
5645
|
__updateRenderPath() { }
|
|
5634
5646
|
getMotionPathData() {
|
|
5635
|
-
return
|
|
5647
|
+
return Plugin.need('path');
|
|
5636
5648
|
}
|
|
5637
5649
|
getMotionPoint(_motionDistance) {
|
|
5638
|
-
return
|
|
5650
|
+
return Plugin.need('path');
|
|
5639
5651
|
}
|
|
5640
5652
|
getMotionTotal() {
|
|
5641
5653
|
return 0;
|
|
@@ -5992,7 +6004,7 @@ var LeaferUI = (function (exports) {
|
|
|
5992
6004
|
}
|
|
5993
6005
|
}
|
|
5994
6006
|
|
|
5995
|
-
const version = "1.
|
|
6007
|
+
const version = "1.2.0";
|
|
5996
6008
|
|
|
5997
6009
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
5998
6010
|
get allowBackgroundColor() { return true; }
|
|
@@ -6990,8 +7002,8 @@ var LeaferUI = (function (exports) {
|
|
|
6990
7002
|
const Effect = {};
|
|
6991
7003
|
const Export = {};
|
|
6992
7004
|
const State = {
|
|
6993
|
-
setStyleName(_leaf, _styleName, _value) { return
|
|
6994
|
-
set(_leaf, _stateName) { return
|
|
7005
|
+
setStyleName(_leaf, _styleName, _value) { return Plugin.need('state'); },
|
|
7006
|
+
set(_leaf, _stateName) { return Plugin.need('state'); }
|
|
6995
7007
|
};
|
|
6996
7008
|
const Transition = {
|
|
6997
7009
|
list: {},
|
|
@@ -7492,7 +7504,7 @@ var LeaferUI = (function (exports) {
|
|
|
7492
7504
|
drawer.rect(x, y, width, height);
|
|
7493
7505
|
}
|
|
7494
7506
|
animate(_keyframe, _options, _type, _isTemp) {
|
|
7495
|
-
return
|
|
7507
|
+
return Plugin.need('animate');
|
|
7496
7508
|
}
|
|
7497
7509
|
killAnimate(_type) { }
|
|
7498
7510
|
export(filename, options) {
|
|
@@ -8070,7 +8082,7 @@ var LeaferUI = (function (exports) {
|
|
|
8070
8082
|
this.requestRender();
|
|
8071
8083
|
}
|
|
8072
8084
|
zoom(_zoomType, _padding, _fixedScale) {
|
|
8073
|
-
return
|
|
8085
|
+
return Plugin.need('view');
|
|
8074
8086
|
}
|
|
8075
8087
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
8076
8088
|
getValidScale(changeScale) { return changeScale; }
|
|
@@ -11809,218 +11821,6 @@ var LeaferUI = (function (exports) {
|
|
|
11809
11821
|
});
|
|
11810
11822
|
useCanvas();
|
|
11811
11823
|
|
|
11812
|
-
const { M: M$2, L: L$2, C: C$2, Q: Q$2, Z: Z$1, N: N$1, D: D$1, X: X$1, G: G$1, F: F$1, O: O$2, P: P$1, U: U$1 } = PathCommandMap;
|
|
11813
|
-
const PathScaler = {
|
|
11814
|
-
scale(data, scaleX, scaleY) {
|
|
11815
|
-
if (!data)
|
|
11816
|
-
return;
|
|
11817
|
-
let command;
|
|
11818
|
-
let i = 0, len = data.length;
|
|
11819
|
-
while (i < len) {
|
|
11820
|
-
command = data[i];
|
|
11821
|
-
switch (command) {
|
|
11822
|
-
case M$2:
|
|
11823
|
-
case L$2:
|
|
11824
|
-
scalePoints(data, scaleX, scaleY, i, 1);
|
|
11825
|
-
i += 3;
|
|
11826
|
-
break;
|
|
11827
|
-
case C$2:
|
|
11828
|
-
scalePoints(data, scaleX, scaleY, i, 3);
|
|
11829
|
-
i += 7;
|
|
11830
|
-
break;
|
|
11831
|
-
case Q$2:
|
|
11832
|
-
scalePoints(data, scaleX, scaleY, i, 2);
|
|
11833
|
-
i += 5;
|
|
11834
|
-
break;
|
|
11835
|
-
case Z$1:
|
|
11836
|
-
i += 1;
|
|
11837
|
-
break;
|
|
11838
|
-
case N$1:
|
|
11839
|
-
scalePoints(data, scaleX, scaleY, i, 2);
|
|
11840
|
-
i += 5;
|
|
11841
|
-
break;
|
|
11842
|
-
case D$1:
|
|
11843
|
-
scalePoints(data, scaleX, scaleY, i, 2);
|
|
11844
|
-
i += 9;
|
|
11845
|
-
break;
|
|
11846
|
-
case X$1:
|
|
11847
|
-
scalePoints(data, scaleX, scaleY, i, 2);
|
|
11848
|
-
i += 6;
|
|
11849
|
-
break;
|
|
11850
|
-
case G$1:
|
|
11851
|
-
scalePoints(data, scaleX, scaleY, i, 2);
|
|
11852
|
-
i += 9;
|
|
11853
|
-
break;
|
|
11854
|
-
case F$1:
|
|
11855
|
-
scalePoints(data, scaleX, scaleY, i, 2);
|
|
11856
|
-
i += 5;
|
|
11857
|
-
break;
|
|
11858
|
-
case O$2:
|
|
11859
|
-
data[i] = G$1;
|
|
11860
|
-
data.splice(i + 4, 0, data[i + 3], 0);
|
|
11861
|
-
scalePoints(data, scaleX, scaleY, i, 2);
|
|
11862
|
-
i += 7 + 2;
|
|
11863
|
-
len += 2;
|
|
11864
|
-
break;
|
|
11865
|
-
case P$1:
|
|
11866
|
-
data[i] = F$1;
|
|
11867
|
-
data.splice(i + 4, 0, data[i + 3]);
|
|
11868
|
-
scalePoints(data, scaleX, scaleY, i, 2);
|
|
11869
|
-
i += 4 + 1;
|
|
11870
|
-
len += 1;
|
|
11871
|
-
break;
|
|
11872
|
-
case U$1:
|
|
11873
|
-
scalePoints(data, scaleX, scaleY, i, 2);
|
|
11874
|
-
i += 6;
|
|
11875
|
-
break;
|
|
11876
|
-
}
|
|
11877
|
-
}
|
|
11878
|
-
},
|
|
11879
|
-
scalePoints(data, scaleX, scaleY, start, pointCount) {
|
|
11880
|
-
for (let i = pointCount ? start + 1 : 0, end = pointCount ? i + pointCount * 2 : data.length; i < end; i += 2) {
|
|
11881
|
-
data[i] *= scaleX;
|
|
11882
|
-
data[i + 1] *= scaleY;
|
|
11883
|
-
}
|
|
11884
|
-
}
|
|
11885
|
-
};
|
|
11886
|
-
const { scalePoints } = PathScaler;
|
|
11887
|
-
|
|
11888
|
-
const matrix$1 = MatrixHelper.get();
|
|
11889
|
-
const { topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottom: bottom$1, left: left$2 } = exports.Direction9;
|
|
11890
|
-
function scaleResize(leaf, scaleX, scaleY) {
|
|
11891
|
-
if (leaf.pathInputed) {
|
|
11892
|
-
scaleResizePath(leaf, scaleX, scaleY);
|
|
11893
|
-
}
|
|
11894
|
-
else {
|
|
11895
|
-
if (scaleX !== 1)
|
|
11896
|
-
leaf.width *= scaleX;
|
|
11897
|
-
if (scaleY !== 1)
|
|
11898
|
-
leaf.height *= scaleY;
|
|
11899
|
-
}
|
|
11900
|
-
}
|
|
11901
|
-
function scaleResizeFontSize(leaf, scaleX, scaleY) {
|
|
11902
|
-
const { app } = leaf;
|
|
11903
|
-
const editor = app && app.editor;
|
|
11904
|
-
let fontScale = scaleX;
|
|
11905
|
-
if (editor.editing) {
|
|
11906
|
-
const layout = leaf.__layout;
|
|
11907
|
-
let { width, height } = layout.boxBounds;
|
|
11908
|
-
width *= scaleY - scaleX;
|
|
11909
|
-
height *= scaleX - scaleY;
|
|
11910
|
-
switch (editor.resizeDirection) {
|
|
11911
|
-
case top$1:
|
|
11912
|
-
case bottom$1:
|
|
11913
|
-
fontScale = scaleY;
|
|
11914
|
-
layout.affectScaleOrRotation ? leaf.moveInner(-width / 2, 0) : leaf.x -= width / 2;
|
|
11915
|
-
break;
|
|
11916
|
-
case left$2:
|
|
11917
|
-
case right$2:
|
|
11918
|
-
layout.affectScaleOrRotation ? leaf.moveInner(0, -height / 2) : leaf.y -= height / 2;
|
|
11919
|
-
break;
|
|
11920
|
-
case topLeft$1:
|
|
11921
|
-
case topRight$1:
|
|
11922
|
-
layout.affectScaleOrRotation ? leaf.moveInner(0, -height) : leaf.y -= height;
|
|
11923
|
-
break;
|
|
11924
|
-
}
|
|
11925
|
-
}
|
|
11926
|
-
leaf.fontSize *= fontScale;
|
|
11927
|
-
const data = leaf.__;
|
|
11928
|
-
if (!data.__autoWidth)
|
|
11929
|
-
leaf.width *= fontScale;
|
|
11930
|
-
if (!data.__autoHeight)
|
|
11931
|
-
leaf.height *= fontScale;
|
|
11932
|
-
}
|
|
11933
|
-
function scaleResizePath(leaf, scaleX, scaleY) {
|
|
11934
|
-
PathScaler.scale(leaf.__.path, scaleX, scaleY);
|
|
11935
|
-
leaf.path = leaf.__.path;
|
|
11936
|
-
}
|
|
11937
|
-
function scaleResizePoints(leaf, scaleX, scaleY) {
|
|
11938
|
-
const { points } = leaf;
|
|
11939
|
-
typeof points[0] === 'object' ? points.forEach(p => { p.x *= scaleX, p.y *= scaleY; }) : PathScaler.scalePoints(points, scaleX, scaleY);
|
|
11940
|
-
leaf.points = points;
|
|
11941
|
-
}
|
|
11942
|
-
function scaleResizeGroup(group, scaleX, scaleY) {
|
|
11943
|
-
const { children } = group;
|
|
11944
|
-
for (let i = 0; i < children.length; i++) {
|
|
11945
|
-
matrix$1.a = scaleX;
|
|
11946
|
-
matrix$1.d = scaleY;
|
|
11947
|
-
children[i].transform(matrix$1, true);
|
|
11948
|
-
}
|
|
11949
|
-
}
|
|
11950
|
-
|
|
11951
|
-
const leaf = exports.Leaf.prototype;
|
|
11952
|
-
leaf.scaleResize = function (scaleX, scaleY = scaleX, noResize) {
|
|
11953
|
-
const data = this;
|
|
11954
|
-
if (noResize || (data.editConfig && data.editConfig.editSize === 'scale')) {
|
|
11955
|
-
data.scaleX *= scaleX;
|
|
11956
|
-
data.scaleY *= scaleY;
|
|
11957
|
-
}
|
|
11958
|
-
else {
|
|
11959
|
-
if (scaleX < 0)
|
|
11960
|
-
data.scaleX *= -1, scaleX = -scaleX;
|
|
11961
|
-
if (scaleY < 0)
|
|
11962
|
-
data.scaleY *= -1, scaleY = -scaleY;
|
|
11963
|
-
this.__scaleResize(scaleX, scaleY);
|
|
11964
|
-
}
|
|
11965
|
-
};
|
|
11966
|
-
leaf.__scaleResize = function (scaleX, scaleY) {
|
|
11967
|
-
scaleResize(this, scaleX, scaleY);
|
|
11968
|
-
};
|
|
11969
|
-
leaf.resizeWidth = function (width) {
|
|
11970
|
-
const scale = width / this.getBounds('box', 'local').width;
|
|
11971
|
-
this.scaleOf(this.__layout.boxBounds, scale, this.__.lockRatio ? scale : 1, true);
|
|
11972
|
-
};
|
|
11973
|
-
leaf.resizeHeight = function (height) {
|
|
11974
|
-
const scale = height / this.getBounds('box', 'local').height;
|
|
11975
|
-
this.scaleOf(this.__layout.boxBounds, this.__.lockRatio ? scale : 1, scale, true);
|
|
11976
|
-
};
|
|
11977
|
-
exports.Text.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
11978
|
-
if (this.__.resizeFontSize || (this.editConfig && this.editConfig.editSize === 'font-size')) {
|
|
11979
|
-
scaleResizeFontSize(this, scaleX, scaleY);
|
|
11980
|
-
}
|
|
11981
|
-
else {
|
|
11982
|
-
scaleResize(this, scaleX, scaleY);
|
|
11983
|
-
}
|
|
11984
|
-
};
|
|
11985
|
-
exports.Path.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
11986
|
-
scaleResizePath(this, scaleX, scaleY);
|
|
11987
|
-
};
|
|
11988
|
-
exports.Line.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
11989
|
-
if (this.pathInputed) {
|
|
11990
|
-
scaleResizePath(this, scaleX, scaleY);
|
|
11991
|
-
}
|
|
11992
|
-
else if (this.points) {
|
|
11993
|
-
scaleResizePoints(this, scaleX, scaleY);
|
|
11994
|
-
}
|
|
11995
|
-
else {
|
|
11996
|
-
this.width *= scaleX;
|
|
11997
|
-
}
|
|
11998
|
-
};
|
|
11999
|
-
exports.Polygon.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
12000
|
-
if (this.pathInputed) {
|
|
12001
|
-
scaleResizePath(this, scaleX, scaleY);
|
|
12002
|
-
}
|
|
12003
|
-
else if (this.points) {
|
|
12004
|
-
scaleResizePoints(this, scaleX, scaleY);
|
|
12005
|
-
}
|
|
12006
|
-
else {
|
|
12007
|
-
scaleResize(this, scaleX, scaleY);
|
|
12008
|
-
}
|
|
12009
|
-
};
|
|
12010
|
-
exports.Group.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
12011
|
-
scaleResizeGroup(this, scaleX, scaleY);
|
|
12012
|
-
};
|
|
12013
|
-
exports.Box.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
12014
|
-
if (this.__.__autoSize && this.children.length) {
|
|
12015
|
-
scaleResizeGroup(this, scaleX, scaleY);
|
|
12016
|
-
}
|
|
12017
|
-
else {
|
|
12018
|
-
scaleResize(this, scaleX, scaleY);
|
|
12019
|
-
if (this.__.resizeChildren)
|
|
12020
|
-
scaleResizeGroup(this, scaleX, scaleY);
|
|
12021
|
-
}
|
|
12022
|
-
};
|
|
12023
|
-
|
|
12024
11824
|
function toList(value) {
|
|
12025
11825
|
return value ? (value instanceof Array ? value : [value]) : [];
|
|
12026
11826
|
}
|
|
@@ -12082,7 +11882,7 @@ var LeaferUI = (function (exports) {
|
|
|
12082
11882
|
const { copy: copy$2, scale: scale$1 } = MatrixHelper;
|
|
12083
11883
|
const { setListWithFn } = BoundsHelper;
|
|
12084
11884
|
const { worldBounds } = LeafBoundsHelper;
|
|
12085
|
-
const matrix = getMatrixData();
|
|
11885
|
+
const matrix$1 = getMatrixData();
|
|
12086
11886
|
const bounds$2 = getBoundsData();
|
|
12087
11887
|
class Stroker extends exports.UI {
|
|
12088
11888
|
constructor() {
|
|
@@ -12117,9 +11917,9 @@ var LeaferUI = (function (exports) {
|
|
|
12117
11917
|
if (!bounds || bounds.hit(worldRenderBounds, options.matrix)) {
|
|
12118
11918
|
const aScaleX = abs$1(worldTransform.scaleX), aScaleY = abs$1(worldTransform.scaleY);
|
|
12119
11919
|
if (aScaleX !== aScaleY) {
|
|
12120
|
-
copy$2(matrix, worldTransform);
|
|
12121
|
-
scale$1(matrix, 1 / aScaleX, 1 / aScaleY);
|
|
12122
|
-
canvas.setWorld(matrix, options.matrix);
|
|
11920
|
+
copy$2(matrix$1, worldTransform);
|
|
11921
|
+
scale$1(matrix$1, 1 / aScaleX, 1 / aScaleY);
|
|
11922
|
+
canvas.setWorld(matrix$1, options.matrix);
|
|
12123
11923
|
canvas.beginPath();
|
|
12124
11924
|
data.strokeWidth = strokeWidth;
|
|
12125
11925
|
const { x, y, width, height } = leaf.__layout.boxBounds;
|
|
@@ -12414,7 +12214,7 @@ var LeaferUI = (function (exports) {
|
|
|
12414
12214
|
}
|
|
12415
12215
|
}
|
|
12416
12216
|
|
|
12417
|
-
const { topLeft, top, topRight, right: right$
|
|
12217
|
+
const { topLeft: topLeft$1, top: top$1, topRight: topRight$1, right: right$2, bottomRight, bottom: bottom$1, bottomLeft, left: left$2 } = exports.Direction9;
|
|
12418
12218
|
const { toPoint } = AroundHelper;
|
|
12419
12219
|
const { within } = MathHelper;
|
|
12420
12220
|
const EditDataHelper = {
|
|
@@ -12443,28 +12243,28 @@ var LeaferUI = (function (exports) {
|
|
|
12443
12243
|
const bottomScale = (totalMove.y + height) / height;
|
|
12444
12244
|
const leftScale = (-totalMove.x + width) / width;
|
|
12445
12245
|
switch (direction) {
|
|
12446
|
-
case top:
|
|
12246
|
+
case top$1:
|
|
12447
12247
|
scaleY = topScale;
|
|
12448
12248
|
align = 'bottom';
|
|
12449
12249
|
break;
|
|
12450
|
-
case right$
|
|
12250
|
+
case right$2:
|
|
12451
12251
|
scaleX = rightScale;
|
|
12452
12252
|
align = 'left';
|
|
12453
12253
|
break;
|
|
12454
|
-
case bottom:
|
|
12254
|
+
case bottom$1:
|
|
12455
12255
|
scaleY = bottomScale;
|
|
12456
12256
|
align = 'top';
|
|
12457
12257
|
break;
|
|
12458
|
-
case left$
|
|
12258
|
+
case left$2:
|
|
12459
12259
|
scaleX = leftScale;
|
|
12460
12260
|
align = 'right';
|
|
12461
12261
|
break;
|
|
12462
|
-
case topLeft:
|
|
12262
|
+
case topLeft$1:
|
|
12463
12263
|
scaleY = topScale;
|
|
12464
12264
|
scaleX = leftScale;
|
|
12465
12265
|
align = 'bottom-right';
|
|
12466
12266
|
break;
|
|
12467
|
-
case topRight:
|
|
12267
|
+
case topRight$1:
|
|
12468
12268
|
scaleY = topScale;
|
|
12469
12269
|
scaleX = rightScale;
|
|
12470
12270
|
align = 'bottom-left';
|
|
@@ -12484,12 +12284,12 @@ var LeaferUI = (function (exports) {
|
|
|
12484
12284
|
if (!unlockSide) {
|
|
12485
12285
|
let scale;
|
|
12486
12286
|
switch (direction) {
|
|
12487
|
-
case top:
|
|
12488
|
-
case bottom:
|
|
12287
|
+
case top$1:
|
|
12288
|
+
case bottom$1:
|
|
12489
12289
|
scale = scaleY;
|
|
12490
12290
|
break;
|
|
12491
|
-
case left$
|
|
12492
|
-
case right$
|
|
12291
|
+
case left$2:
|
|
12292
|
+
case right$2:
|
|
12493
12293
|
scale = scaleX;
|
|
12494
12294
|
break;
|
|
12495
12295
|
default:
|
|
@@ -12522,10 +12322,10 @@ var LeaferUI = (function (exports) {
|
|
|
12522
12322
|
getRotateData(bounds, direction, current, last, around) {
|
|
12523
12323
|
let align, origin = {};
|
|
12524
12324
|
switch (direction) {
|
|
12525
|
-
case topLeft:
|
|
12325
|
+
case topLeft$1:
|
|
12526
12326
|
align = 'bottom-right';
|
|
12527
12327
|
break;
|
|
12528
|
-
case topRight:
|
|
12328
|
+
case topRight$1:
|
|
12529
12329
|
align = 'bottom-left';
|
|
12530
12330
|
break;
|
|
12531
12331
|
case bottomRight:
|
|
@@ -12544,22 +12344,22 @@ var LeaferUI = (function (exports) {
|
|
|
12544
12344
|
let align, origin = {}, skewX = 0, skewY = 0;
|
|
12545
12345
|
let last;
|
|
12546
12346
|
switch (direction) {
|
|
12547
|
-
case top:
|
|
12347
|
+
case top$1:
|
|
12548
12348
|
last = { x: 0.5, y: 0 };
|
|
12549
12349
|
align = 'bottom';
|
|
12550
12350
|
skewX = 1;
|
|
12551
12351
|
break;
|
|
12552
|
-
case bottom:
|
|
12352
|
+
case bottom$1:
|
|
12553
12353
|
last = { x: 0.5, y: 1 };
|
|
12554
12354
|
align = 'top';
|
|
12555
12355
|
skewX = 1;
|
|
12556
12356
|
break;
|
|
12557
|
-
case left$
|
|
12357
|
+
case left$2:
|
|
12558
12358
|
last = { x: 0, y: 0.5 };
|
|
12559
12359
|
align = 'right';
|
|
12560
12360
|
skewY = 1;
|
|
12561
12361
|
break;
|
|
12562
|
-
case right$
|
|
12362
|
+
case right$2:
|
|
12563
12363
|
last = { x: 1, y: 0.5 };
|
|
12564
12364
|
align = 'left';
|
|
12565
12365
|
skewY = 1;
|
|
@@ -12584,20 +12384,20 @@ var LeaferUI = (function (exports) {
|
|
|
12584
12384
|
getFlipDirection(direction, flipedX, flipedY) {
|
|
12585
12385
|
if (flipedX) {
|
|
12586
12386
|
switch (direction) {
|
|
12587
|
-
case left$
|
|
12588
|
-
direction = right$
|
|
12387
|
+
case left$2:
|
|
12388
|
+
direction = right$2;
|
|
12589
12389
|
break;
|
|
12590
|
-
case topLeft:
|
|
12591
|
-
direction = topRight;
|
|
12390
|
+
case topLeft$1:
|
|
12391
|
+
direction = topRight$1;
|
|
12592
12392
|
break;
|
|
12593
12393
|
case bottomLeft:
|
|
12594
12394
|
direction = bottomRight;
|
|
12595
12395
|
break;
|
|
12596
|
-
case right$
|
|
12597
|
-
direction = left$
|
|
12396
|
+
case right$2:
|
|
12397
|
+
direction = left$2;
|
|
12598
12398
|
break;
|
|
12599
|
-
case topRight:
|
|
12600
|
-
direction = topLeft;
|
|
12399
|
+
case topRight$1:
|
|
12400
|
+
direction = topLeft$1;
|
|
12601
12401
|
break;
|
|
12602
12402
|
case bottomRight:
|
|
12603
12403
|
direction = bottomLeft;
|
|
@@ -12606,23 +12406,23 @@ var LeaferUI = (function (exports) {
|
|
|
12606
12406
|
}
|
|
12607
12407
|
if (flipedY) {
|
|
12608
12408
|
switch (direction) {
|
|
12609
|
-
case top:
|
|
12610
|
-
direction = bottom;
|
|
12409
|
+
case top$1:
|
|
12410
|
+
direction = bottom$1;
|
|
12611
12411
|
break;
|
|
12612
|
-
case topLeft:
|
|
12412
|
+
case topLeft$1:
|
|
12613
12413
|
direction = bottomLeft;
|
|
12614
12414
|
break;
|
|
12615
|
-
case topRight:
|
|
12415
|
+
case topRight$1:
|
|
12616
12416
|
direction = bottomRight;
|
|
12617
12417
|
break;
|
|
12618
|
-
case bottom:
|
|
12619
|
-
direction = top;
|
|
12418
|
+
case bottom$1:
|
|
12419
|
+
direction = top$1;
|
|
12620
12420
|
break;
|
|
12621
12421
|
case bottomLeft:
|
|
12622
|
-
direction = topLeft;
|
|
12422
|
+
direction = topLeft$1;
|
|
12623
12423
|
break;
|
|
12624
12424
|
case bottomRight:
|
|
12625
|
-
direction = topRight;
|
|
12425
|
+
direction = topRight$1;
|
|
12626
12426
|
break;
|
|
12627
12427
|
}
|
|
12628
12428
|
}
|
|
@@ -13285,6 +13085,8 @@ ${filterStyle}
|
|
|
13285
13085
|
if (userConfig)
|
|
13286
13086
|
this.config = DataHelper.default(userConfig, this.config);
|
|
13287
13087
|
this.addMany(this.editMask, this.selector, this.editBox);
|
|
13088
|
+
if (!Plugin.check('resize', true))
|
|
13089
|
+
this.config.editSize = 'scale';
|
|
13288
13090
|
}
|
|
13289
13091
|
select(target) {
|
|
13290
13092
|
this.target = target;
|
|
@@ -13756,7 +13558,7 @@ ${filterStyle}
|
|
|
13756
13558
|
registerEditTool()
|
|
13757
13559
|
], exports.EditTool);
|
|
13758
13560
|
|
|
13759
|
-
const { left, right } = exports.Direction9;
|
|
13561
|
+
const { left: left$1, right: right$1 } = exports.Direction9;
|
|
13760
13562
|
const { move, copy: copy$1, toNumberPoints } = PointHelper;
|
|
13761
13563
|
exports.LineEditTool = class LineEditTool extends exports.EditTool {
|
|
13762
13564
|
constructor() {
|
|
@@ -13767,7 +13569,7 @@ ${filterStyle}
|
|
|
13767
13569
|
onScaleWithDrag(e) {
|
|
13768
13570
|
const { drag, direction, lockRatio, around } = e;
|
|
13769
13571
|
const line = e.target;
|
|
13770
|
-
const isDragFrom = direction === left;
|
|
13572
|
+
const isDragFrom = direction === left$1;
|
|
13771
13573
|
if (line.pathInputed) {
|
|
13772
13574
|
const { path } = line.__;
|
|
13773
13575
|
const { from, to } = this.getFromToByPath(path);
|
|
@@ -13852,7 +13654,7 @@ ${filterStyle}
|
|
|
13852
13654
|
for (let i = 0; i < 8; i++) {
|
|
13853
13655
|
if (i < 4)
|
|
13854
13656
|
resizeLines[i].visible = false;
|
|
13855
|
-
leftOrRight = i === left || i === right;
|
|
13657
|
+
leftOrRight = i === left$1 || i === right$1;
|
|
13856
13658
|
resizePoints[i].visible = leftOrRight;
|
|
13857
13659
|
rotatePoints[i].visible = fromTo ? false : leftOrRight;
|
|
13858
13660
|
}
|
|
@@ -13862,6 +13664,221 @@ ${filterStyle}
|
|
|
13862
13664
|
registerEditTool()
|
|
13863
13665
|
], exports.LineEditTool);
|
|
13864
13666
|
|
|
13667
|
+
const { M: M$2, L: L$2, C: C$2, Q: Q$2, Z: Z$1, N: N$1, D: D$1, X: X$1, G: G$1, F: F$1, O: O$2, P: P$1, U: U$1 } = PathCommandMap;
|
|
13668
|
+
const PathScaler = {
|
|
13669
|
+
scale(data, scaleX, scaleY) {
|
|
13670
|
+
if (!data)
|
|
13671
|
+
return;
|
|
13672
|
+
let command;
|
|
13673
|
+
let i = 0, len = data.length;
|
|
13674
|
+
while (i < len) {
|
|
13675
|
+
command = data[i];
|
|
13676
|
+
switch (command) {
|
|
13677
|
+
case M$2:
|
|
13678
|
+
case L$2:
|
|
13679
|
+
scalePoints(data, scaleX, scaleY, i, 1);
|
|
13680
|
+
i += 3;
|
|
13681
|
+
break;
|
|
13682
|
+
case C$2:
|
|
13683
|
+
scalePoints(data, scaleX, scaleY, i, 3);
|
|
13684
|
+
i += 7;
|
|
13685
|
+
break;
|
|
13686
|
+
case Q$2:
|
|
13687
|
+
scalePoints(data, scaleX, scaleY, i, 2);
|
|
13688
|
+
i += 5;
|
|
13689
|
+
break;
|
|
13690
|
+
case Z$1:
|
|
13691
|
+
i += 1;
|
|
13692
|
+
break;
|
|
13693
|
+
case N$1:
|
|
13694
|
+
scalePoints(data, scaleX, scaleY, i, 2);
|
|
13695
|
+
i += 5;
|
|
13696
|
+
break;
|
|
13697
|
+
case D$1:
|
|
13698
|
+
scalePoints(data, scaleX, scaleY, i, 2);
|
|
13699
|
+
i += 9;
|
|
13700
|
+
break;
|
|
13701
|
+
case X$1:
|
|
13702
|
+
scalePoints(data, scaleX, scaleY, i, 2);
|
|
13703
|
+
i += 6;
|
|
13704
|
+
break;
|
|
13705
|
+
case G$1:
|
|
13706
|
+
scalePoints(data, scaleX, scaleY, i, 2);
|
|
13707
|
+
i += 9;
|
|
13708
|
+
break;
|
|
13709
|
+
case F$1:
|
|
13710
|
+
scalePoints(data, scaleX, scaleY, i, 2);
|
|
13711
|
+
i += 5;
|
|
13712
|
+
break;
|
|
13713
|
+
case O$2:
|
|
13714
|
+
data[i] = G$1;
|
|
13715
|
+
data.splice(i + 4, 0, data[i + 3], 0);
|
|
13716
|
+
scalePoints(data, scaleX, scaleY, i, 2);
|
|
13717
|
+
i += 7 + 2;
|
|
13718
|
+
len += 2;
|
|
13719
|
+
break;
|
|
13720
|
+
case P$1:
|
|
13721
|
+
data[i] = F$1;
|
|
13722
|
+
data.splice(i + 4, 0, data[i + 3]);
|
|
13723
|
+
scalePoints(data, scaleX, scaleY, i, 2);
|
|
13724
|
+
i += 4 + 1;
|
|
13725
|
+
len += 1;
|
|
13726
|
+
break;
|
|
13727
|
+
case U$1:
|
|
13728
|
+
scalePoints(data, scaleX, scaleY, i, 2);
|
|
13729
|
+
i += 6;
|
|
13730
|
+
break;
|
|
13731
|
+
}
|
|
13732
|
+
}
|
|
13733
|
+
},
|
|
13734
|
+
scalePoints(data, scaleX, scaleY, start, pointCount) {
|
|
13735
|
+
for (let i = pointCount ? start + 1 : 0, end = pointCount ? i + pointCount * 2 : data.length; i < end; i += 2) {
|
|
13736
|
+
data[i] *= scaleX;
|
|
13737
|
+
data[i + 1] *= scaleY;
|
|
13738
|
+
}
|
|
13739
|
+
}
|
|
13740
|
+
};
|
|
13741
|
+
const { scalePoints } = PathScaler;
|
|
13742
|
+
|
|
13743
|
+
const matrix = MatrixHelper.get();
|
|
13744
|
+
const { topLeft, top, topRight, right, bottom, left } = exports.Direction9;
|
|
13745
|
+
function scaleResize(leaf, scaleX, scaleY) {
|
|
13746
|
+
if (leaf.pathInputed) {
|
|
13747
|
+
scaleResizePath(leaf, scaleX, scaleY);
|
|
13748
|
+
}
|
|
13749
|
+
else {
|
|
13750
|
+
if (scaleX !== 1)
|
|
13751
|
+
leaf.width *= scaleX;
|
|
13752
|
+
if (scaleY !== 1)
|
|
13753
|
+
leaf.height *= scaleY;
|
|
13754
|
+
}
|
|
13755
|
+
}
|
|
13756
|
+
function scaleResizeFontSize(leaf, scaleX, scaleY) {
|
|
13757
|
+
const { app } = leaf;
|
|
13758
|
+
const editor = app && app.editor;
|
|
13759
|
+
let fontScale = scaleX;
|
|
13760
|
+
if (editor.editing) {
|
|
13761
|
+
const layout = leaf.__layout;
|
|
13762
|
+
let { width, height } = layout.boxBounds;
|
|
13763
|
+
width *= scaleY - scaleX;
|
|
13764
|
+
height *= scaleX - scaleY;
|
|
13765
|
+
switch (editor.resizeDirection) {
|
|
13766
|
+
case top:
|
|
13767
|
+
case bottom:
|
|
13768
|
+
fontScale = scaleY;
|
|
13769
|
+
layout.affectScaleOrRotation ? leaf.moveInner(-width / 2, 0) : leaf.x -= width / 2;
|
|
13770
|
+
break;
|
|
13771
|
+
case left:
|
|
13772
|
+
case right:
|
|
13773
|
+
layout.affectScaleOrRotation ? leaf.moveInner(0, -height / 2) : leaf.y -= height / 2;
|
|
13774
|
+
break;
|
|
13775
|
+
case topLeft:
|
|
13776
|
+
case topRight:
|
|
13777
|
+
layout.affectScaleOrRotation ? leaf.moveInner(0, -height) : leaf.y -= height;
|
|
13778
|
+
break;
|
|
13779
|
+
}
|
|
13780
|
+
}
|
|
13781
|
+
leaf.fontSize *= fontScale;
|
|
13782
|
+
const data = leaf.__;
|
|
13783
|
+
if (!data.__autoWidth)
|
|
13784
|
+
leaf.width *= fontScale;
|
|
13785
|
+
if (!data.__autoHeight)
|
|
13786
|
+
leaf.height *= fontScale;
|
|
13787
|
+
}
|
|
13788
|
+
function scaleResizePath(leaf, scaleX, scaleY) {
|
|
13789
|
+
PathScaler.scale(leaf.__.path, scaleX, scaleY);
|
|
13790
|
+
leaf.path = leaf.__.path;
|
|
13791
|
+
}
|
|
13792
|
+
function scaleResizePoints(leaf, scaleX, scaleY) {
|
|
13793
|
+
const { points } = leaf;
|
|
13794
|
+
typeof points[0] === 'object' ? points.forEach(p => { p.x *= scaleX, p.y *= scaleY; }) : PathScaler.scalePoints(points, scaleX, scaleY);
|
|
13795
|
+
leaf.points = points;
|
|
13796
|
+
}
|
|
13797
|
+
function scaleResizeGroup(group, scaleX, scaleY) {
|
|
13798
|
+
const { children } = group;
|
|
13799
|
+
for (let i = 0; i < children.length; i++) {
|
|
13800
|
+
matrix.a = scaleX;
|
|
13801
|
+
matrix.d = scaleY;
|
|
13802
|
+
children[i].transform(matrix, true);
|
|
13803
|
+
}
|
|
13804
|
+
}
|
|
13805
|
+
|
|
13806
|
+
const leaf = exports.Leaf.prototype;
|
|
13807
|
+
leaf.scaleResize = function (scaleX, scaleY = scaleX, noResize) {
|
|
13808
|
+
const data = this;
|
|
13809
|
+
if (noResize || (data.editConfig && data.editConfig.editSize === 'scale')) {
|
|
13810
|
+
data.scaleX *= scaleX;
|
|
13811
|
+
data.scaleY *= scaleY;
|
|
13812
|
+
}
|
|
13813
|
+
else {
|
|
13814
|
+
if (scaleX < 0)
|
|
13815
|
+
data.scaleX *= -1, scaleX = -scaleX;
|
|
13816
|
+
if (scaleY < 0)
|
|
13817
|
+
data.scaleY *= -1, scaleY = -scaleY;
|
|
13818
|
+
this.__scaleResize(scaleX, scaleY);
|
|
13819
|
+
}
|
|
13820
|
+
};
|
|
13821
|
+
leaf.__scaleResize = function (scaleX, scaleY) {
|
|
13822
|
+
scaleResize(this, scaleX, scaleY);
|
|
13823
|
+
};
|
|
13824
|
+
leaf.resizeWidth = function (width) {
|
|
13825
|
+
const scale = width / this.getBounds('box', 'local').width;
|
|
13826
|
+
this.scaleOf(this.__layout.boxBounds, scale, this.__.lockRatio ? scale : 1, true);
|
|
13827
|
+
};
|
|
13828
|
+
leaf.resizeHeight = function (height) {
|
|
13829
|
+
const scale = height / this.getBounds('box', 'local').height;
|
|
13830
|
+
this.scaleOf(this.__layout.boxBounds, this.__.lockRatio ? scale : 1, scale, true);
|
|
13831
|
+
};
|
|
13832
|
+
exports.Text.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
13833
|
+
if (this.__.resizeFontSize || (this.editConfig && this.editConfig.editSize === 'font-size')) {
|
|
13834
|
+
scaleResizeFontSize(this, scaleX, scaleY);
|
|
13835
|
+
}
|
|
13836
|
+
else {
|
|
13837
|
+
scaleResize(this, scaleX, scaleY);
|
|
13838
|
+
}
|
|
13839
|
+
};
|
|
13840
|
+
exports.Path.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
13841
|
+
scaleResizePath(this, scaleX, scaleY);
|
|
13842
|
+
};
|
|
13843
|
+
exports.Line.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
13844
|
+
if (this.pathInputed) {
|
|
13845
|
+
scaleResizePath(this, scaleX, scaleY);
|
|
13846
|
+
}
|
|
13847
|
+
else if (this.points) {
|
|
13848
|
+
scaleResizePoints(this, scaleX, scaleY);
|
|
13849
|
+
}
|
|
13850
|
+
else {
|
|
13851
|
+
this.width *= scaleX;
|
|
13852
|
+
}
|
|
13853
|
+
};
|
|
13854
|
+
exports.Polygon.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
13855
|
+
if (this.pathInputed) {
|
|
13856
|
+
scaleResizePath(this, scaleX, scaleY);
|
|
13857
|
+
}
|
|
13858
|
+
else if (this.points) {
|
|
13859
|
+
scaleResizePoints(this, scaleX, scaleY);
|
|
13860
|
+
}
|
|
13861
|
+
else {
|
|
13862
|
+
scaleResize(this, scaleX, scaleY);
|
|
13863
|
+
}
|
|
13864
|
+
};
|
|
13865
|
+
exports.Group.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
13866
|
+
scaleResizeGroup(this, scaleX, scaleY);
|
|
13867
|
+
};
|
|
13868
|
+
exports.Box.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
13869
|
+
if (this.__.__autoSize && this.children.length) {
|
|
13870
|
+
scaleResizeGroup(this, scaleX, scaleY);
|
|
13871
|
+
}
|
|
13872
|
+
else {
|
|
13873
|
+
scaleResize(this, scaleX, scaleY);
|
|
13874
|
+
if (this.__.resizeChildren)
|
|
13875
|
+
scaleResizeGroup(this, scaleX, scaleY);
|
|
13876
|
+
}
|
|
13877
|
+
};
|
|
13878
|
+
|
|
13879
|
+
Plugin.add('resize');
|
|
13880
|
+
|
|
13881
|
+
Plugin.add('editor');
|
|
13865
13882
|
Creator.editor = function (options) { return new Editor(options); };
|
|
13866
13883
|
dataType(false)(exports.Box.prototype, 'textBox');
|
|
13867
13884
|
defineKey(exports.UI.prototype, 'editOuter', {
|
|
@@ -14235,6 +14252,8 @@ ${filterStyle}
|
|
|
14235
14252
|
}
|
|
14236
14253
|
};
|
|
14237
14254
|
|
|
14255
|
+
Plugin.add('viewport');
|
|
14256
|
+
|
|
14238
14257
|
function getZoomScale(scaleX, type) {
|
|
14239
14258
|
let scale = 1;
|
|
14240
14259
|
const out = type === 'out', absScale = Math.abs(scaleX);
|
|
@@ -14262,6 +14281,7 @@ ${filterStyle}
|
|
|
14262
14281
|
return fix ? { x, y, width, height } : bounds;
|
|
14263
14282
|
}
|
|
14264
14283
|
|
|
14284
|
+
Plugin.add('view');
|
|
14265
14285
|
exports.Leafer.prototype.zoom = function (zoomType, padding, fixed) {
|
|
14266
14286
|
const { zoomLayer } = this;
|
|
14267
14287
|
const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds();
|
|
@@ -14434,6 +14454,8 @@ ${filterStyle}
|
|
|
14434
14454
|
}
|
|
14435
14455
|
}
|
|
14436
14456
|
|
|
14457
|
+
Plugin.add('scroll');
|
|
14458
|
+
|
|
14437
14459
|
class ArrowData extends LineData {
|
|
14438
14460
|
}
|
|
14439
14461
|
|
|
@@ -14693,6 +14715,7 @@ ${filterStyle}
|
|
|
14693
14715
|
}));
|
|
14694
14716
|
}
|
|
14695
14717
|
|
|
14718
|
+
Plugin.add('arrow');
|
|
14696
14719
|
const ui = exports.UI.prototype;
|
|
14697
14720
|
arrowType('none')(ui, 'startArrow');
|
|
14698
14721
|
arrowType('none')(ui, 'endArrow');
|
|
@@ -14900,6 +14923,9 @@ ${filterStyle}
|
|
|
14900
14923
|
registerInnerEditor()
|
|
14901
14924
|
], exports.TextEditor);
|
|
14902
14925
|
|
|
14926
|
+
Plugin.add('text-editor');
|
|
14927
|
+
setTimeout(() => Plugin.check('editor', true));
|
|
14928
|
+
|
|
14903
14929
|
class HTMLTextData extends ImageData {
|
|
14904
14930
|
setText(value) {
|
|
14905
14931
|
this._text = value;
|
|
@@ -14958,6 +14984,8 @@ ${filterStyle}
|
|
|
14958
14984
|
registerUI()
|
|
14959
14985
|
], exports.HTMLText);
|
|
14960
14986
|
|
|
14987
|
+
Plugin.add('html');
|
|
14988
|
+
|
|
14961
14989
|
exports.AlignHelper = AlignHelper;
|
|
14962
14990
|
exports.AroundHelper = AroundHelper;
|
|
14963
14991
|
exports.ArrowData = ArrowData;
|
|
@@ -15060,9 +15088,9 @@ ${filterStyle}
|
|
|
15060
15088
|
exports.PathMatrixHelper = PathMatrixHelper;
|
|
15061
15089
|
exports.PathNumberCommandLengthMap = PathNumberCommandLengthMap;
|
|
15062
15090
|
exports.PathNumberCommandMap = PathNumberCommandMap;
|
|
15063
|
-
exports.PathScaler = PathScaler;
|
|
15064
15091
|
exports.PenData = PenData;
|
|
15065
15092
|
exports.Platform = Platform;
|
|
15093
|
+
exports.Plugin = Plugin;
|
|
15066
15094
|
exports.Point = Point;
|
|
15067
15095
|
exports.PointHelper = PointHelper;
|
|
15068
15096
|
exports.PointerButton = PointerButton;
|
|
@@ -15130,7 +15158,6 @@ ${filterStyle}
|
|
|
15130
15158
|
exports.layoutProcessor = layoutProcessor;
|
|
15131
15159
|
exports.maskType = maskType;
|
|
15132
15160
|
exports.naturalBoundsType = naturalBoundsType;
|
|
15133
|
-
exports.needPlugin = needPlugin;
|
|
15134
15161
|
exports.opacityType = opacityType;
|
|
15135
15162
|
exports.pathInputType = pathInputType;
|
|
15136
15163
|
exports.pathType = pathType;
|
|
@@ -15144,11 +15171,6 @@ ${filterStyle}
|
|
|
15144
15171
|
exports.rewrite = rewrite;
|
|
15145
15172
|
exports.rewriteAble = rewriteAble;
|
|
15146
15173
|
exports.rotationType = rotationType;
|
|
15147
|
-
exports.scaleResize = scaleResize;
|
|
15148
|
-
exports.scaleResizeFontSize = scaleResizeFontSize;
|
|
15149
|
-
exports.scaleResizeGroup = scaleResizeGroup;
|
|
15150
|
-
exports.scaleResizePath = scaleResizePath;
|
|
15151
|
-
exports.scaleResizePoints = scaleResizePoints;
|
|
15152
15174
|
exports.scaleType = scaleType;
|
|
15153
15175
|
exports.sortType = sortType;
|
|
15154
15176
|
exports.strokeType = strokeType;
|