@leafer-editor/worker 1.4.2 → 1.5.1
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 +316 -260
- package/dist/worker.js.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +316 -260
- package/dist/worker.module.js.map +1 -1
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +15 -15
package/dist/worker.js
CHANGED
|
@@ -2032,13 +2032,11 @@ var LeaferUI = (function (exports) {
|
|
|
2032
2032
|
this.worldTransform = {};
|
|
2033
2033
|
if (!config)
|
|
2034
2034
|
config = minSize;
|
|
2035
|
-
if (!config.pixelRatio)
|
|
2036
|
-
config.pixelRatio = Platform.devicePixelRatio;
|
|
2037
2035
|
this.manager = manager;
|
|
2038
2036
|
this.innerId = IncrementId.create(IncrementId.CNAVAS);
|
|
2039
2037
|
const { width, height, pixelRatio } = config;
|
|
2040
2038
|
this.autoLayout = !width || !height;
|
|
2041
|
-
this.size.pixelRatio = pixelRatio;
|
|
2039
|
+
this.size.pixelRatio = pixelRatio | Platform.devicePixelRatio;
|
|
2042
2040
|
this.config = config;
|
|
2043
2041
|
this.init();
|
|
2044
2042
|
}
|
|
@@ -2235,7 +2233,7 @@ var LeaferUI = (function (exports) {
|
|
|
2235
2233
|
tempBounds$1.ceil();
|
|
2236
2234
|
}
|
|
2237
2235
|
isSameSize(size) {
|
|
2238
|
-
return this.width === size.width && this.height === size.height && this.pixelRatio === size.pixelRatio;
|
|
2236
|
+
return this.width === size.width && this.height === size.height && (!size.pixelRatio || this.pixelRatio === size.pixelRatio);
|
|
2239
2237
|
}
|
|
2240
2238
|
getSameCanvas(useSameWorldTransform, useSameSmooth) {
|
|
2241
2239
|
const canvas = this.manager ? this.manager.get(this.size) : Creator.canvas(Object.assign({}, this.size));
|
|
@@ -4073,13 +4071,10 @@ var LeaferUI = (function (exports) {
|
|
|
4073
4071
|
if (defaultValue === undefined) {
|
|
4074
4072
|
property.get = function () { return this[computedKey]; };
|
|
4075
4073
|
}
|
|
4076
|
-
else if (typeof defaultValue === '
|
|
4077
|
-
const { clone } = DataHelper;
|
|
4074
|
+
else if (typeof defaultValue === 'function') {
|
|
4078
4075
|
property.get = function () {
|
|
4079
4076
|
let v = this[computedKey];
|
|
4080
|
-
|
|
4081
|
-
this[computedKey] = v = clone(defaultValue);
|
|
4082
|
-
return v;
|
|
4077
|
+
return v === undefined ? defaultValue(this.__leaf) : v;
|
|
4083
4078
|
};
|
|
4084
4079
|
}
|
|
4085
4080
|
if (key === 'width') {
|
|
@@ -5725,10 +5720,10 @@ var LeaferUI = (function (exports) {
|
|
|
5725
5720
|
static changeAttr(attrName, defaultValue, fn) {
|
|
5726
5721
|
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue);
|
|
5727
5722
|
}
|
|
5728
|
-
static addAttr(attrName, defaultValue, fn) {
|
|
5723
|
+
static addAttr(attrName, defaultValue, fn, helpValue) {
|
|
5729
5724
|
if (!fn)
|
|
5730
5725
|
fn = boundsType;
|
|
5731
|
-
fn(defaultValue)(this.prototype, attrName);
|
|
5726
|
+
fn(defaultValue, helpValue)(this.prototype, attrName);
|
|
5732
5727
|
}
|
|
5733
5728
|
__emitLifeEvent(type) {
|
|
5734
5729
|
if (this.hasEvent(type))
|
|
@@ -6055,7 +6050,7 @@ var LeaferUI = (function (exports) {
|
|
|
6055
6050
|
}
|
|
6056
6051
|
}
|
|
6057
6052
|
|
|
6058
|
-
const version = "1.
|
|
6053
|
+
const version = "1.5.1";
|
|
6059
6054
|
|
|
6060
6055
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6061
6056
|
get allowBackgroundColor() { return true; }
|
|
@@ -6942,7 +6937,11 @@ var LeaferUI = (function (exports) {
|
|
|
6942
6937
|
setStyleName() { return Plugin.need('state'); },
|
|
6943
6938
|
set() { return Plugin.need('state'); }
|
|
6944
6939
|
};
|
|
6945
|
-
const Transition = {
|
|
6940
|
+
const Transition = {
|
|
6941
|
+
list: {},
|
|
6942
|
+
register(attrName, fn) { Transition.list[attrName] = fn; },
|
|
6943
|
+
get(attrName) { return Transition.list[attrName]; }
|
|
6944
|
+
};
|
|
6946
6945
|
|
|
6947
6946
|
const { parse, objectToCanvasData } = PathConvert;
|
|
6948
6947
|
const emptyPaint = {};
|
|
@@ -7366,9 +7365,6 @@ var LeaferUI = (function (exports) {
|
|
|
7366
7365
|
this.__drawPathByBox(pen);
|
|
7367
7366
|
return pen;
|
|
7368
7367
|
}
|
|
7369
|
-
get editConfig() { return undefined; }
|
|
7370
|
-
get editOuter() { return ''; }
|
|
7371
|
-
get editInner() { return ''; }
|
|
7372
7368
|
constructor(data) {
|
|
7373
7369
|
super(data);
|
|
7374
7370
|
}
|
|
@@ -7450,8 +7446,11 @@ var LeaferUI = (function (exports) {
|
|
|
7450
7446
|
export(_filename, _options) {
|
|
7451
7447
|
return Plugin.need('export');
|
|
7452
7448
|
}
|
|
7449
|
+
syncExport(_filename, _options) {
|
|
7450
|
+
return Plugin.need('export');
|
|
7451
|
+
}
|
|
7453
7452
|
clone(data) {
|
|
7454
|
-
const json = this.toJSON();
|
|
7453
|
+
const json = DataHelper.clone(this.toJSON());
|
|
7455
7454
|
if (data)
|
|
7456
7455
|
Object.assign(json, data);
|
|
7457
7456
|
return UI_1.one(json);
|
|
@@ -7750,7 +7749,7 @@ var LeaferUI = (function (exports) {
|
|
|
7750
7749
|
get layoutLocked() { return !this.layouter.running; }
|
|
7751
7750
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
7752
7751
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
7753
|
-
get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
|
|
7752
|
+
get clientBounds() { return (this.canvas && this.canvas.getClientBounds(true)) || getBoundsData(); }
|
|
7754
7753
|
constructor(userConfig, data) {
|
|
7755
7754
|
super(data);
|
|
7756
7755
|
this.config = {
|
|
@@ -8052,6 +8051,10 @@ var LeaferUI = (function (exports) {
|
|
|
8052
8051
|
getPagePointByClient(clientPoint, updateClient) {
|
|
8053
8052
|
return this.getPagePoint(this.getWorldPointByClient(clientPoint, updateClient));
|
|
8054
8053
|
}
|
|
8054
|
+
getClientPointByWorld(worldPoint) {
|
|
8055
|
+
const { x, y } = this.clientBounds;
|
|
8056
|
+
return { x: x + worldPoint.x, y: y + worldPoint.y };
|
|
8057
|
+
}
|
|
8055
8058
|
updateClientBounds() {
|
|
8056
8059
|
this.canvas && this.canvas.updateClientBounds();
|
|
8057
8060
|
}
|
|
@@ -9991,8 +9994,8 @@ var LeaferUI = (function (exports) {
|
|
|
9991
9994
|
this.__drawRenderPath(canvas); };
|
|
9992
9995
|
|
|
9993
9996
|
const matrix$2 = new Matrix();
|
|
9994
|
-
const ui$
|
|
9995
|
-
ui$
|
|
9997
|
+
const ui$2 = exports.UI.prototype;
|
|
9998
|
+
ui$2.__updateHitCanvas = function () {
|
|
9996
9999
|
const data = this.__, { hitCanvasManager } = this.leafer;
|
|
9997
10000
|
const isHitPixelFill = (data.__pixelFill || data.__isCanvas) && data.hitFill === 'pixel';
|
|
9998
10001
|
const isHitPixelStroke = data.__pixelStroke && data.hitStroke === 'pixel';
|
|
@@ -10019,9 +10022,7 @@ var LeaferUI = (function (exports) {
|
|
|
10019
10022
|
this.__drawHitPath(h);
|
|
10020
10023
|
h.setStrokeOptions(data);
|
|
10021
10024
|
};
|
|
10022
|
-
ui$
|
|
10023
|
-
if (Platform.name === 'miniapp')
|
|
10024
|
-
this.__drawHitPath(this.__hitCanvas);
|
|
10025
|
+
ui$2.__hit = function (inner) {
|
|
10025
10026
|
const data = this.__;
|
|
10026
10027
|
if (data.__isHitPixel && this.__hitPixel(inner))
|
|
10027
10028
|
return true;
|
|
@@ -10059,15 +10060,15 @@ var LeaferUI = (function (exports) {
|
|
|
10059
10060
|
return hitWidth ? this.__hitStroke(inner, hitWidth) : false;
|
|
10060
10061
|
};
|
|
10061
10062
|
|
|
10062
|
-
const ui$
|
|
10063
|
+
const ui$1 = exports.UI.prototype, rect = exports.Rect.prototype, box$1 = exports.Box.prototype;
|
|
10063
10064
|
rect.__updateHitCanvas = box$1.__updateHitCanvas = function () {
|
|
10064
10065
|
if (this.stroke || this.cornerRadius || ((this.fill || this.__.__isCanvas) && this.hitFill === 'pixel') || this.hitStroke === 'all')
|
|
10065
|
-
ui$
|
|
10066
|
+
ui$1.__updateHitCanvas.call(this);
|
|
10066
10067
|
else if (this.__hitCanvas)
|
|
10067
10068
|
this.__hitCanvas = null;
|
|
10068
10069
|
};
|
|
10069
10070
|
rect.__hitFill = box$1.__hitFill = function (inner) {
|
|
10070
|
-
return this.__hitCanvas ? ui$
|
|
10071
|
+
return this.__hitCanvas ? ui$1.__hitFill.call(this, inner) : BoundsHelper.hitRadiusPoint(this.__layout.boxBounds, inner);
|
|
10071
10072
|
};
|
|
10072
10073
|
|
|
10073
10074
|
function getSelector$1(ui) {
|
|
@@ -11376,13 +11377,14 @@ var LeaferUI = (function (exports) {
|
|
|
11376
11377
|
}
|
|
11377
11378
|
|
|
11378
11379
|
function layoutText(drawData, style) {
|
|
11379
|
-
const { rows, bounds } = drawData;
|
|
11380
|
+
const { rows, bounds } = drawData, countRows = rows.length;
|
|
11380
11381
|
const { __lineHeight, __baseLine, __letterSpacing, __clipText, textAlign, verticalAlign, paraSpacing, autoSizeAlign } = style;
|
|
11381
|
-
let { x, y, width, height } = bounds, realHeight = __lineHeight *
|
|
11382
|
+
let { x, y, width, height } = bounds, realHeight = __lineHeight * countRows + (paraSpacing ? paraSpacing * (drawData.paraNumber - 1) : 0);
|
|
11382
11383
|
let starY = __baseLine;
|
|
11383
11384
|
if (__clipText && realHeight > height) {
|
|
11384
11385
|
realHeight = Math.max(height, __lineHeight);
|
|
11385
|
-
|
|
11386
|
+
if (countRows > 1)
|
|
11387
|
+
drawData.overflow = countRows;
|
|
11386
11388
|
}
|
|
11387
11389
|
else if (height || autoSizeAlign) {
|
|
11388
11390
|
switch (verticalAlign) {
|
|
@@ -11394,7 +11396,7 @@ var LeaferUI = (function (exports) {
|
|
|
11394
11396
|
}
|
|
11395
11397
|
starY += y;
|
|
11396
11398
|
let row, rowX, rowWidth, layoutWidth = (width || autoSizeAlign) ? width : drawData.maxWidth;
|
|
11397
|
-
for (let i = 0, len =
|
|
11399
|
+
for (let i = 0, len = countRows; i < len; i++) {
|
|
11398
11400
|
row = rows[i];
|
|
11399
11401
|
row.x = x;
|
|
11400
11402
|
if (row.width < width || (row.width > width && !__clipText)) {
|
|
@@ -11463,7 +11465,7 @@ var LeaferUI = (function (exports) {
|
|
|
11463
11465
|
if (i === end && charRight < right) {
|
|
11464
11466
|
break;
|
|
11465
11467
|
}
|
|
11466
|
-
else if (charRight < right && char.char !== ' ') {
|
|
11468
|
+
else if ((charRight < right && char.char !== ' ') || !i) {
|
|
11467
11469
|
row.data.splice(i + 1);
|
|
11468
11470
|
row.width -= char.width;
|
|
11469
11471
|
break;
|
|
@@ -11607,7 +11609,9 @@ var LeaferUI = (function (exports) {
|
|
|
11607
11609
|
Object.assign(this, data);
|
|
11608
11610
|
}
|
|
11609
11611
|
}
|
|
11612
|
+
EditorEvent.BEFORE_SELECT = 'editor.before_select';
|
|
11610
11613
|
EditorEvent.SELECT = 'editor.select';
|
|
11614
|
+
EditorEvent.BEFORE_HOVER = 'editor.before_hover';
|
|
11611
11615
|
EditorEvent.HOVER = 'editor.hover';
|
|
11612
11616
|
|
|
11613
11617
|
class EditorMoveEvent extends EditorEvent {
|
|
@@ -11615,6 +11619,7 @@ var LeaferUI = (function (exports) {
|
|
|
11615
11619
|
super(type, data);
|
|
11616
11620
|
}
|
|
11617
11621
|
}
|
|
11622
|
+
EditorMoveEvent.BEFORE_MOVE = 'editor.before_move';
|
|
11618
11623
|
EditorMoveEvent.MOVE = 'editor.move';
|
|
11619
11624
|
|
|
11620
11625
|
class EditorScaleEvent extends EditorEvent {
|
|
@@ -11622,6 +11627,7 @@ var LeaferUI = (function (exports) {
|
|
|
11622
11627
|
super(type, data);
|
|
11623
11628
|
}
|
|
11624
11629
|
}
|
|
11630
|
+
EditorScaleEvent.BEFORE_SCALE = 'editor.before_scale';
|
|
11625
11631
|
EditorScaleEvent.SCALE = 'editor.scale';
|
|
11626
11632
|
|
|
11627
11633
|
class EditorRotateEvent extends EditorEvent {
|
|
@@ -11629,6 +11635,7 @@ var LeaferUI = (function (exports) {
|
|
|
11629
11635
|
super(type, data);
|
|
11630
11636
|
}
|
|
11631
11637
|
}
|
|
11638
|
+
EditorRotateEvent.BEFORE_ROTATE = 'editor.before_rotate';
|
|
11632
11639
|
EditorRotateEvent.ROTATE = 'editor.rotate';
|
|
11633
11640
|
|
|
11634
11641
|
class EditorSkewEvent extends EditorEvent {
|
|
@@ -11636,6 +11643,7 @@ var LeaferUI = (function (exports) {
|
|
|
11636
11643
|
super(type, data);
|
|
11637
11644
|
}
|
|
11638
11645
|
}
|
|
11646
|
+
EditorSkewEvent.BEFORE_SKEW = 'editor.before_skew';
|
|
11639
11647
|
EditorSkewEvent.SKEW = 'editor.skew';
|
|
11640
11648
|
|
|
11641
11649
|
function targetAttr(fn) {
|
|
@@ -11645,8 +11653,12 @@ var LeaferUI = (function (exports) {
|
|
|
11645
11653
|
get() { return this[privateKey]; },
|
|
11646
11654
|
set(value) {
|
|
11647
11655
|
const old = this[privateKey];
|
|
11648
|
-
if (old !== value)
|
|
11656
|
+
if (old !== value) {
|
|
11657
|
+
const type = key === 'target' ? EditorEvent.BEFORE_SELECT : EditorEvent.BEFORE_HOVER;
|
|
11658
|
+
if (this.hasEvent(type))
|
|
11659
|
+
this.emitEvent(new EditorEvent(type, { editor: this, value: value, oldValue: old }));
|
|
11649
11660
|
this[privateKey] = value, fn(this, old);
|
|
11661
|
+
}
|
|
11650
11662
|
}
|
|
11651
11663
|
});
|
|
11652
11664
|
};
|
|
@@ -11688,7 +11700,7 @@ var LeaferUI = (function (exports) {
|
|
|
11688
11700
|
for (let i = 0; i < list.length; i++) {
|
|
11689
11701
|
leaf = list[i];
|
|
11690
11702
|
const { worldTransform, worldRenderBounds } = leaf;
|
|
11691
|
-
if (!bounds || bounds.hit(worldRenderBounds, options.matrix)) {
|
|
11703
|
+
if (worldRenderBounds.width && worldRenderBounds.height && (!bounds || bounds.hit(worldRenderBounds, options.matrix))) {
|
|
11692
11704
|
const aScaleX = abs$1(worldTransform.scaleX), aScaleY = abs$1(worldTransform.scaleY);
|
|
11693
11705
|
if (aScaleX !== aScaleY) {
|
|
11694
11706
|
copy$2(matrix$1, worldTransform);
|
|
@@ -11814,9 +11826,9 @@ var LeaferUI = (function (exports) {
|
|
|
11814
11826
|
}
|
|
11815
11827
|
onSelect() {
|
|
11816
11828
|
if (this.running) {
|
|
11817
|
-
const { mergeConfig
|
|
11818
|
-
const { stroke, strokeWidth } =
|
|
11819
|
-
this.targetStroker.setTarget(list, { stroke, strokeWidth: Math.max(1, strokeWidth / 2) });
|
|
11829
|
+
const { mergeConfig, list } = this.editor;
|
|
11830
|
+
const { stroke, strokeWidth, selectedStyle } = mergeConfig;
|
|
11831
|
+
this.targetStroker.setTarget(list, Object.assign({ stroke, strokeWidth: Math.max(1, strokeWidth / 2) }, (selectedStyle || {})));
|
|
11820
11832
|
this.hoverStroker.target = null;
|
|
11821
11833
|
}
|
|
11822
11834
|
}
|
|
@@ -12003,7 +12015,7 @@ var LeaferUI = (function (exports) {
|
|
|
12003
12015
|
const EditDataHelper = {
|
|
12004
12016
|
getScaleData(element, startBounds, direction, totalMove, lockRatio, around, flipable, scaleMode) {
|
|
12005
12017
|
let align, origin = {}, scaleX = 1, scaleY = 1;
|
|
12006
|
-
const { boxBounds, widthRange, heightRange, dragBounds } = element;
|
|
12018
|
+
const { boxBounds, widthRange, heightRange, dragBounds, worldBoxBounds } = element;
|
|
12007
12019
|
const { width, height } = startBounds;
|
|
12008
12020
|
if (around) {
|
|
12009
12021
|
totalMove.x *= 2;
|
|
@@ -12017,10 +12029,6 @@ var LeaferUI = (function (exports) {
|
|
|
12017
12029
|
const changedScaleY = scaleMode ? originChangedScaleY : signY * boxBounds.height / height;
|
|
12018
12030
|
totalMove.x *= scaleMode ? originChangedScaleX : signX;
|
|
12019
12031
|
totalMove.y *= scaleMode ? originChangedScaleY : signY;
|
|
12020
|
-
if (Math.abs(totalMove.x) === width)
|
|
12021
|
-
totalMove.x += 0.1;
|
|
12022
|
-
if (Math.abs(totalMove.y) === height)
|
|
12023
|
-
totalMove.y += 0.1;
|
|
12024
12032
|
const topScale = (-totalMove.y + height) / height;
|
|
12025
12033
|
const rightScale = (totalMove.x + width) / width;
|
|
12026
12034
|
const bottomScale = (totalMove.y + height) / height;
|
|
@@ -12110,6 +12118,10 @@ var LeaferUI = (function (exports) {
|
|
|
12110
12118
|
const nowHeight = boxBounds.height * element.scaleY;
|
|
12111
12119
|
scaleY = within(nowHeight * scaleY, heightRange) / nowHeight;
|
|
12112
12120
|
}
|
|
12121
|
+
if (Math.abs(scaleX * worldBoxBounds.width) < 1)
|
|
12122
|
+
scaleX = (scaleX < 0 ? -1 : 1) / worldBoxBounds.width;
|
|
12123
|
+
if (Math.abs(scaleY * worldBoxBounds.height) < 1)
|
|
12124
|
+
scaleY = (scaleY < 0 ? -1 : 1) / worldBoxBounds.height;
|
|
12113
12125
|
return { origin, scaleX, scaleY, direction, lockRatio, around };
|
|
12114
12126
|
},
|
|
12115
12127
|
getRotateData(bounds, direction, current, last, around) {
|
|
@@ -12238,7 +12250,7 @@ var LeaferUI = (function (exports) {
|
|
|
12238
12250
|
let { rotation } = editBox;
|
|
12239
12251
|
const { resizeCursor, rotateCursor, skewCursor, resizeable, rotateable, skewable } = editor.mergeConfig;
|
|
12240
12252
|
const { pointType } = point, { flippedX, flippedY } = editBox;
|
|
12241
|
-
let showResize = pointType
|
|
12253
|
+
let showResize = pointType.includes('resize');
|
|
12242
12254
|
if (showResize && rotateable && (e.metaKey || e.ctrlKey || !resizeable))
|
|
12243
12255
|
showResize = false;
|
|
12244
12256
|
const showSkew = skewable && !showResize && point.name === 'resize-line';
|
|
@@ -12265,7 +12277,7 @@ var LeaferUI = (function (exports) {
|
|
|
12265
12277
|
class EditPoint extends exports.Box {
|
|
12266
12278
|
}
|
|
12267
12279
|
|
|
12268
|
-
const fourDirection = ['top', 'right', 'bottom', 'left'];
|
|
12280
|
+
const fourDirection = ['top', 'right', 'bottom', 'left'], editConfig = undefined;
|
|
12269
12281
|
class EditBox extends exports.Group {
|
|
12270
12282
|
get flipped() { return this.flippedX || this.flippedY; }
|
|
12271
12283
|
get flippedX() { return this.scaleX < 0; }
|
|
@@ -12280,6 +12292,7 @@ var LeaferUI = (function (exports) {
|
|
|
12280
12292
|
this.resizePoints = [];
|
|
12281
12293
|
this.rotatePoints = [];
|
|
12282
12294
|
this.resizeLines = [];
|
|
12295
|
+
this.dragStartData = {};
|
|
12283
12296
|
this.__eventIds = [];
|
|
12284
12297
|
this.editor = editor;
|
|
12285
12298
|
this.visible = false;
|
|
@@ -12321,7 +12334,7 @@ var LeaferUI = (function (exports) {
|
|
|
12321
12334
|
resizeP.rotation = (i / 2) * 90;
|
|
12322
12335
|
}
|
|
12323
12336
|
circle.set(this.getPointStyle(mergeConfig.circle || mergeConfig.rotatePoint || pointsStyle[0]));
|
|
12324
|
-
rect.set(Object.assign({ stroke, strokeWidth }, (mergeConfig.rect || {})));
|
|
12337
|
+
rect.set(Object.assign({ stroke, strokeWidth, editConfig }, (mergeConfig.rect || {})));
|
|
12325
12338
|
rect.hittable = !single;
|
|
12326
12339
|
rect.syncEventer = single && this.editor;
|
|
12327
12340
|
if (single) {
|
|
@@ -12330,14 +12343,14 @@ var LeaferUI = (function (exports) {
|
|
|
12330
12343
|
}
|
|
12331
12344
|
}
|
|
12332
12345
|
update(bounds) {
|
|
12333
|
-
|
|
12346
|
+
const { mergeConfig, element, multiple } = this.editor;
|
|
12347
|
+
const { middlePoint, resizeable, rotateable, hideOnSmall, editBox } = mergeConfig;
|
|
12348
|
+
this.visible = !element.locked;
|
|
12334
12349
|
if (this.view.worldOpacity) {
|
|
12335
|
-
const { mergeConfig } = this.editor;
|
|
12336
12350
|
const { width, height } = bounds;
|
|
12337
12351
|
const { rect, circle, buttons, resizePoints, rotatePoints, resizeLines } = this;
|
|
12338
|
-
const { middlePoint, resizeable, rotateable, hideOnSmall } = mergeConfig;
|
|
12339
12352
|
const smallSize = typeof hideOnSmall === 'number' ? hideOnSmall : 10;
|
|
12340
|
-
const showPoints = !(hideOnSmall && width < smallSize && height < smallSize);
|
|
12353
|
+
const showPoints = editBox && !(hideOnSmall && width < smallSize && height < smallSize);
|
|
12341
12354
|
let point = {}, rotateP, resizeP, resizeL;
|
|
12342
12355
|
for (let i = 0; i < 8; i++) {
|
|
12343
12356
|
AroundHelper.toPoint(AroundHelper.directionData[i], bounds, point);
|
|
@@ -12353,13 +12366,13 @@ var LeaferUI = (function (exports) {
|
|
|
12353
12366
|
resizeP.visible = rotateP.visible = showPoints && !!middlePoint;
|
|
12354
12367
|
if (((i + 1) / 2) % 2) {
|
|
12355
12368
|
resizeL.width = width;
|
|
12356
|
-
if (resizeP.width > width
|
|
12369
|
+
if (hideOnSmall && resizeP.width * 2 > width)
|
|
12357
12370
|
resizeP.visible = false;
|
|
12358
12371
|
}
|
|
12359
12372
|
else {
|
|
12360
12373
|
resizeL.height = height;
|
|
12361
12374
|
resizeP.rotation = 90;
|
|
12362
|
-
if (resizeP.width > height
|
|
12375
|
+
if (hideOnSmall && resizeP.width * 2 > height)
|
|
12363
12376
|
resizeP.visible = false;
|
|
12364
12377
|
}
|
|
12365
12378
|
}
|
|
@@ -12369,7 +12382,7 @@ var LeaferUI = (function (exports) {
|
|
|
12369
12382
|
this.layoutCircle(mergeConfig);
|
|
12370
12383
|
if (rect.path)
|
|
12371
12384
|
rect.path = null;
|
|
12372
|
-
rect.set(Object.assign(Object.assign({}, bounds), { visible: true }));
|
|
12385
|
+
rect.set(Object.assign(Object.assign({}, bounds), { visible: multiple ? true : editBox }));
|
|
12373
12386
|
buttons.visible = showPoints && buttons.children.length > 0;
|
|
12374
12387
|
if (buttons.visible)
|
|
12375
12388
|
this.layoutButtons(mergeConfig);
|
|
@@ -12416,7 +12429,7 @@ var LeaferUI = (function (exports) {
|
|
|
12416
12429
|
}
|
|
12417
12430
|
getPointStyle(userStyle) {
|
|
12418
12431
|
const { stroke, strokeWidth, pointFill, pointSize, pointRadius } = this.editor.mergeConfig;
|
|
12419
|
-
const defaultStyle = { fill: pointFill, stroke, strokeWidth, around: 'center', strokeAlign: 'center', width: pointSize, height: pointSize, cornerRadius: pointRadius, offsetX: 0, offsetY: 0 };
|
|
12432
|
+
const defaultStyle = { fill: pointFill, stroke, strokeWidth, around: 'center', strokeAlign: 'center', width: pointSize, height: pointSize, cornerRadius: pointRadius, offsetX: 0, offsetY: 0, editConfig };
|
|
12420
12433
|
return userStyle ? Object.assign(defaultStyle, userStyle) : defaultStyle;
|
|
12421
12434
|
}
|
|
12422
12435
|
getPointsStyle() {
|
|
@@ -12436,34 +12449,32 @@ var LeaferUI = (function (exports) {
|
|
|
12436
12449
|
}
|
|
12437
12450
|
onDragStart(e) {
|
|
12438
12451
|
this.dragging = true;
|
|
12439
|
-
const
|
|
12440
|
-
|
|
12452
|
+
const point = this.dragPoint = e.current;
|
|
12453
|
+
const { editor, dragStartData } = this, { element } = editor;
|
|
12454
|
+
if (point.name === 'rect') {
|
|
12441
12455
|
this.moving = true;
|
|
12442
|
-
editor.dragStartPoint = { x: editor.element.x, y: editor.element.y };
|
|
12443
12456
|
editor.opacity = editor.mergeConfig.hideOnMove ? 0 : 1;
|
|
12444
12457
|
}
|
|
12445
|
-
|
|
12446
|
-
|
|
12447
|
-
|
|
12448
|
-
}
|
|
12458
|
+
dragStartData.x = e.x;
|
|
12459
|
+
dragStartData.y = e.y;
|
|
12460
|
+
dragStartData.point = { x: element.x, y: element.y };
|
|
12461
|
+
dragStartData.bounds = Object.assign({}, element.getLayoutBounds('box', 'local'));
|
|
12462
|
+
dragStartData.rotation = element.rotation;
|
|
12449
12463
|
}
|
|
12450
12464
|
onDragEnd(e) {
|
|
12451
12465
|
this.dragging = false;
|
|
12466
|
+
this.dragPoint = null;
|
|
12452
12467
|
this.moving = false;
|
|
12453
12468
|
if (e.current.name === 'rect')
|
|
12454
12469
|
this.editor.opacity = 1;
|
|
12455
|
-
this.editor.resizeDirection = undefined;
|
|
12456
12470
|
}
|
|
12457
12471
|
onDrag(e) {
|
|
12458
12472
|
const { editor } = this;
|
|
12459
|
-
const
|
|
12460
|
-
if (
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
}
|
|
12464
|
-
else if (point.pointType === 'resize') {
|
|
12473
|
+
const { pointType } = this.enterPoint = e.current;
|
|
12474
|
+
if (pointType.includes('rotate') || e.metaKey || e.ctrlKey || !editor.mergeConfig.resizeable)
|
|
12475
|
+
editor.onRotate(e);
|
|
12476
|
+
if (pointType.includes('resize'))
|
|
12465
12477
|
editor.onScale(e);
|
|
12466
|
-
}
|
|
12467
12478
|
updateCursor(editor, e);
|
|
12468
12479
|
}
|
|
12469
12480
|
onArrow(e) {
|
|
@@ -12641,6 +12652,7 @@ ${filterStyle}
|
|
|
12641
12652
|
rotateCursor: { url: rotateSVG, x: 12, y: 12 },
|
|
12642
12653
|
skewCursor: { url: skewSVG, x: 12, y: 12 },
|
|
12643
12654
|
selector: true,
|
|
12655
|
+
editBox: true,
|
|
12644
12656
|
hover: true,
|
|
12645
12657
|
select: 'press',
|
|
12646
12658
|
openInner: 'double',
|
|
@@ -12670,7 +12682,11 @@ ${filterStyle}
|
|
|
12670
12682
|
function onTarget(editor, oldValue) {
|
|
12671
12683
|
const { target } = editor;
|
|
12672
12684
|
if (target) {
|
|
12673
|
-
editor.leafList = target instanceof LeafList ? target : new LeafList(target instanceof Array ? target : target);
|
|
12685
|
+
const { list } = editor.leafList = target instanceof LeafList ? target : new LeafList(target instanceof Array ? target : target);
|
|
12686
|
+
if (!list.every(checkEditable)) {
|
|
12687
|
+
editor.target = list.filter(checkEditable);
|
|
12688
|
+
return;
|
|
12689
|
+
}
|
|
12674
12690
|
if (editor.multiple)
|
|
12675
12691
|
simulate(editor);
|
|
12676
12692
|
}
|
|
@@ -12697,6 +12713,9 @@ ${filterStyle}
|
|
|
12697
12713
|
function onHover(editor, oldValue) {
|
|
12698
12714
|
editor.emitEvent(new EditorEvent(EditorEvent.HOVER, { editor, value: editor.hoverTarget, oldValue }));
|
|
12699
12715
|
}
|
|
12716
|
+
function checkEditable(item) {
|
|
12717
|
+
return item.editable && !item.locked;
|
|
12718
|
+
}
|
|
12700
12719
|
|
|
12701
12720
|
const order = (a, b) => a.parent.children.indexOf(a) - b.parent.children.indexOf(b);
|
|
12702
12721
|
const reverseOrder = (a, b) => b.parent.children.indexOf(b) - a.parent.children.indexOf(a);
|
|
@@ -12794,10 +12813,13 @@ ${filterStyle}
|
|
|
12794
12813
|
super(type, data);
|
|
12795
12814
|
}
|
|
12796
12815
|
}
|
|
12816
|
+
EditorGroupEvent.BEFORE_GROUP = 'editor.before_group';
|
|
12797
12817
|
EditorGroupEvent.GROUP = 'editor.group';
|
|
12798
12818
|
EditorGroupEvent.BEFORE_UNGROUP = 'editor.before_ungroup';
|
|
12799
12819
|
EditorGroupEvent.UNGROUP = 'editor.ungroup';
|
|
12820
|
+
EditorGroupEvent.BEFORE_OPEN = 'editor.before_open_group';
|
|
12800
12821
|
EditorGroupEvent.OPEN = 'editor.open_group';
|
|
12822
|
+
EditorGroupEvent.BEFORE_CLOSE = 'editor.before_close_group';
|
|
12801
12823
|
EditorGroupEvent.CLOSE = 'editor.close_group';
|
|
12802
12824
|
|
|
12803
12825
|
const { updateMatrix } = LeafHelper;
|
|
@@ -12860,8 +12882,20 @@ ${filterStyle}
|
|
|
12860
12882
|
|
|
12861
12883
|
class Editor extends exports.Group {
|
|
12862
12884
|
get mergeConfig() {
|
|
12863
|
-
const { element,
|
|
12864
|
-
|
|
12885
|
+
const { config, element, dragPoint } = this, mergeConfig = Object.assign({}, config);
|
|
12886
|
+
if (element && element.editConfig)
|
|
12887
|
+
Object.assign(mergeConfig, element.editConfig);
|
|
12888
|
+
if (dragPoint) {
|
|
12889
|
+
if (dragPoint.editConfig)
|
|
12890
|
+
Object.assign(mergeConfig, dragPoint.editConfig);
|
|
12891
|
+
if (mergeConfig.editSize === 'font-size')
|
|
12892
|
+
mergeConfig.lockRatio = true;
|
|
12893
|
+
if (dragPoint.pointType === 'resize-rotate') {
|
|
12894
|
+
mergeConfig.around || (mergeConfig.around = 'center');
|
|
12895
|
+
isNull(mergeConfig.lockRatio) && (mergeConfig.lockRatio = true);
|
|
12896
|
+
}
|
|
12897
|
+
}
|
|
12898
|
+
return mergeConfig;
|
|
12865
12899
|
}
|
|
12866
12900
|
get list() { return this.leafList.list; }
|
|
12867
12901
|
get dragHoverExclude() { return [this.editBox.rect]; }
|
|
@@ -12871,6 +12905,7 @@ ${filterStyle}
|
|
|
12871
12905
|
get single() { return this.list.length === 1; }
|
|
12872
12906
|
get dragging() { return this.editBox.dragging; }
|
|
12873
12907
|
get moving() { return this.editBox.moving; }
|
|
12908
|
+
get dragPoint() { return this.editBox.dragPoint; }
|
|
12874
12909
|
get element() { return this.multiple ? this.simulateTarget : this.list[0]; }
|
|
12875
12910
|
get buttons() { return this.editBox.buttons; }
|
|
12876
12911
|
constructor(userConfig, data) {
|
|
@@ -12961,7 +12996,7 @@ ${filterStyle}
|
|
|
12961
12996
|
else
|
|
12962
12997
|
total.x = 0;
|
|
12963
12998
|
}
|
|
12964
|
-
this.move(exports.DragEvent.getValidMove(this.element, this.
|
|
12999
|
+
this.move(exports.DragEvent.getValidMove(this.element, this.editBox.dragStartData.point, total));
|
|
12965
13000
|
}
|
|
12966
13001
|
}
|
|
12967
13002
|
onScale(e) {
|
|
@@ -12975,7 +13010,7 @@ ${filterStyle}
|
|
|
12975
13010
|
const { direction } = e.current;
|
|
12976
13011
|
if (e.shiftKey || element.lockRatio)
|
|
12977
13012
|
lockRatio = true;
|
|
12978
|
-
const data = EditDataHelper.getScaleData(element, this.
|
|
13013
|
+
const data = EditDataHelper.getScaleData(element, this.editBox.dragStartData.bounds, direction, e.getInnerTotal(element), lockRatio, EditDataHelper.getAround(around, e.altKey), flipable, this.multiple || editSize === 'scale');
|
|
12979
13014
|
if (this.editTool.onScaleWithDrag) {
|
|
12980
13015
|
data.drag = e;
|
|
12981
13016
|
this.scaleWithDrag(data);
|
|
@@ -12990,26 +13025,29 @@ ${filterStyle}
|
|
|
12990
13025
|
const { direction, name } = e.current;
|
|
12991
13026
|
if (skewable && name === 'resize-line')
|
|
12992
13027
|
return this.onSkew(e);
|
|
12993
|
-
const { element } = this;
|
|
13028
|
+
const { element } = this, { dragStartData } = this.editBox;
|
|
12994
13029
|
let origin, rotation;
|
|
12995
13030
|
if (e instanceof exports.RotateEvent) {
|
|
12996
13031
|
if (rotateable === 'rotate')
|
|
12997
13032
|
e.stop(), rotation = e.rotation, origin = element.getBoxPoint(e);
|
|
12998
13033
|
else
|
|
12999
13034
|
return;
|
|
13035
|
+
if (element.scaleX * element.scaleY < 0)
|
|
13036
|
+
rotation = -rotation;
|
|
13000
13037
|
}
|
|
13001
13038
|
else {
|
|
13002
|
-
const
|
|
13003
|
-
const data = EditDataHelper.getRotateData(element.boxBounds, direction, e.getBoxPoint(element), element.getBoxPoint(last), e.shiftKey ? null : (element.around || element.origin || around || 'center'));
|
|
13039
|
+
const data = EditDataHelper.getRotateData(element.boxBounds, direction, e.getBoxPoint(element), element.getBoxPoint(dragStartData), e.shiftKey ? null : (element.around || element.origin || around || 'center'));
|
|
13004
13040
|
rotation = data.rotation;
|
|
13005
13041
|
origin = data.origin;
|
|
13006
13042
|
}
|
|
13007
|
-
rotation = MathHelper.getGapRotation(rotation, rotateGap, element.rotation);
|
|
13008
|
-
if (!rotation)
|
|
13009
|
-
return;
|
|
13010
13043
|
if (element.scaleX * element.scaleY < 0)
|
|
13011
13044
|
rotation = -rotation;
|
|
13012
|
-
|
|
13045
|
+
if (e instanceof exports.DragEvent)
|
|
13046
|
+
rotation = dragStartData.rotation + rotation - element.rotation;
|
|
13047
|
+
rotation = MathHelper.float(MathHelper.getGapRotation(rotation, rotateGap, element.rotation), 2);
|
|
13048
|
+
if (!rotation)
|
|
13049
|
+
return;
|
|
13050
|
+
this.rotateOf(origin, rotation);
|
|
13013
13051
|
}
|
|
13014
13052
|
onSkew(e) {
|
|
13015
13053
|
const { element } = this;
|
|
@@ -13026,7 +13064,9 @@ ${filterStyle}
|
|
|
13026
13064
|
const world = element.getWorldPointByLocal(typeof x === 'object' ? Object.assign({}, x) : { x, y }, null, true);
|
|
13027
13065
|
if (this.multiple)
|
|
13028
13066
|
element.safeChange(() => element.move(x, y));
|
|
13029
|
-
const
|
|
13067
|
+
const data = { target: element, editor: this, moveX: world.x, moveY: world.y };
|
|
13068
|
+
this.emitEvent(new EditorMoveEvent(EditorMoveEvent.BEFORE_MOVE, data));
|
|
13069
|
+
const event = new EditorMoveEvent(EditorMoveEvent.MOVE, data);
|
|
13030
13070
|
this.editTool.onMove(event);
|
|
13031
13071
|
this.emitEvent(event);
|
|
13032
13072
|
}
|
|
@@ -13034,7 +13074,9 @@ ${filterStyle}
|
|
|
13034
13074
|
if (!this.checkTransform('resizeable'))
|
|
13035
13075
|
return;
|
|
13036
13076
|
const { element } = this;
|
|
13037
|
-
|
|
13077
|
+
data = Object.assign(Object.assign({}, data), { target: element, editor: this, worldOrigin: element.getWorldPoint(data.origin) });
|
|
13078
|
+
this.emitEvent(new EditorScaleEvent(EditorScaleEvent.BEFORE_SCALE, data));
|
|
13079
|
+
const event = new EditorScaleEvent(EditorScaleEvent.SCALE, data);
|
|
13038
13080
|
this.editTool.onScaleWithDrag(event);
|
|
13039
13081
|
this.emitEvent(event);
|
|
13040
13082
|
}
|
|
@@ -13044,7 +13086,9 @@ ${filterStyle}
|
|
|
13044
13086
|
const { element } = this;
|
|
13045
13087
|
const worldOrigin = this.getWorldOrigin(origin);
|
|
13046
13088
|
const transform = this.multiple && this.getChangedTransform(() => element.safeChange(() => element.scaleOf(origin, scaleX, scaleY)));
|
|
13047
|
-
const
|
|
13089
|
+
const data = { target: element, editor: this, worldOrigin, scaleX, scaleY, transform };
|
|
13090
|
+
this.emitEvent(new EditorScaleEvent(EditorScaleEvent.BEFORE_SCALE, data));
|
|
13091
|
+
const event = new EditorScaleEvent(EditorScaleEvent.SCALE, data);
|
|
13048
13092
|
this.editTool.onScale(event);
|
|
13049
13093
|
this.emitEvent(event);
|
|
13050
13094
|
}
|
|
@@ -13054,7 +13098,9 @@ ${filterStyle}
|
|
|
13054
13098
|
const { element } = this;
|
|
13055
13099
|
const worldOrigin = this.getWorldOrigin('center');
|
|
13056
13100
|
const transform = this.multiple ? this.getChangedTransform(() => element.safeChange(() => element.flip(axis))) : new Matrix(LeafHelper.getFlipTransform(element, axis));
|
|
13057
|
-
const
|
|
13101
|
+
const data = { target: element, editor: this, worldOrigin, scaleX: axis === 'x' ? -1 : 1, scaleY: axis === 'y' ? -1 : 1, transform };
|
|
13102
|
+
this.emitEvent(new EditorScaleEvent(EditorScaleEvent.BEFORE_SCALE, data));
|
|
13103
|
+
const event = new EditorScaleEvent(EditorScaleEvent.SCALE, data);
|
|
13058
13104
|
this.editTool.onScale(event);
|
|
13059
13105
|
this.emitEvent(event);
|
|
13060
13106
|
}
|
|
@@ -13064,7 +13110,9 @@ ${filterStyle}
|
|
|
13064
13110
|
const { element } = this;
|
|
13065
13111
|
const worldOrigin = this.getWorldOrigin(origin);
|
|
13066
13112
|
const transform = this.multiple && this.getChangedTransform(() => element.safeChange(() => element.rotateOf(origin, rotation)));
|
|
13067
|
-
const
|
|
13113
|
+
const data = { target: element, editor: this, worldOrigin, rotation, transform };
|
|
13114
|
+
this.emitEvent(new EditorRotateEvent(EditorRotateEvent.BEFORE_ROTATE, data));
|
|
13115
|
+
const event = new EditorRotateEvent(EditorRotateEvent.ROTATE, data);
|
|
13068
13116
|
this.editTool.onRotate(event);
|
|
13069
13117
|
this.emitEvent(event);
|
|
13070
13118
|
}
|
|
@@ -13074,7 +13122,9 @@ ${filterStyle}
|
|
|
13074
13122
|
const { element } = this;
|
|
13075
13123
|
const worldOrigin = this.getWorldOrigin(origin);
|
|
13076
13124
|
const transform = this.multiple && this.getChangedTransform(() => element.safeChange(() => element.skewOf(origin, skewX, skewY)));
|
|
13077
|
-
const
|
|
13125
|
+
const data = { target: element, editor: this, worldOrigin, skewX, skewY, transform };
|
|
13126
|
+
this.emitEvent(new EditorSkewEvent(EditorSkewEvent.BEFORE_SKEW, data));
|
|
13127
|
+
const event = new EditorSkewEvent(EditorSkewEvent.SKEW, data);
|
|
13078
13128
|
this.editTool.onSkew(event);
|
|
13079
13129
|
this.emitEvent(event);
|
|
13080
13130
|
}
|
|
@@ -13092,6 +13142,7 @@ ${filterStyle}
|
|
|
13092
13142
|
}
|
|
13093
13143
|
group(userGroup) {
|
|
13094
13144
|
if (this.multiple) {
|
|
13145
|
+
this.emitGroupEvent(EditorGroupEvent.BEFORE_GROUP);
|
|
13095
13146
|
this.target = EditorHelper.group(this.list, this.element, userGroup);
|
|
13096
13147
|
this.emitGroupEvent(EditorGroupEvent.GROUP, this.target);
|
|
13097
13148
|
}
|
|
@@ -13107,11 +13158,13 @@ ${filterStyle}
|
|
|
13107
13158
|
return this.list;
|
|
13108
13159
|
}
|
|
13109
13160
|
openGroup(group) {
|
|
13161
|
+
this.emitGroupEvent(EditorGroupEvent.BEFORE_OPEN, group);
|
|
13110
13162
|
this.openedGroupList.add(group);
|
|
13111
13163
|
group.hitChildren = true;
|
|
13112
13164
|
this.emitGroupEvent(EditorGroupEvent.OPEN, group);
|
|
13113
13165
|
}
|
|
13114
13166
|
closeGroup(group) {
|
|
13167
|
+
this.emitGroupEvent(EditorGroupEvent.BEFORE_CLOSE, group);
|
|
13115
13168
|
this.openedGroupList.remove(group);
|
|
13116
13169
|
group.hitChildren = false;
|
|
13117
13170
|
this.emitGroupEvent(EditorGroupEvent.CLOSE, group);
|
|
@@ -13140,7 +13193,8 @@ ${filterStyle}
|
|
|
13140
13193
|
emitGroupEvent(type, group) {
|
|
13141
13194
|
const event = new EditorGroupEvent(type, { editTarget: group });
|
|
13142
13195
|
this.emitEvent(event);
|
|
13143
|
-
group
|
|
13196
|
+
if (group)
|
|
13197
|
+
group.emitEvent(event);
|
|
13144
13198
|
}
|
|
13145
13199
|
openInnerEditor(target, select) {
|
|
13146
13200
|
if (target && select)
|
|
@@ -13557,16 +13611,14 @@ ${filterStyle}
|
|
|
13557
13611
|
leaf.height *= scaleY;
|
|
13558
13612
|
}
|
|
13559
13613
|
}
|
|
13560
|
-
function scaleResizeFontSize(leaf, scaleX, scaleY) {
|
|
13561
|
-
const { app } = leaf;
|
|
13562
|
-
const editor = app && app.editor;
|
|
13614
|
+
function scaleResizeFontSize(leaf, scaleX, scaleY, direction) {
|
|
13563
13615
|
let fontScale = scaleX;
|
|
13564
|
-
if (
|
|
13616
|
+
if (direction !== undefined) {
|
|
13565
13617
|
const layout = leaf.__layout;
|
|
13566
13618
|
let { width, height } = layout.boxBounds;
|
|
13567
13619
|
width *= scaleY - scaleX;
|
|
13568
13620
|
height *= scaleX - scaleY;
|
|
13569
|
-
switch (
|
|
13621
|
+
switch (direction) {
|
|
13570
13622
|
case top:
|
|
13571
13623
|
case bottom:
|
|
13572
13624
|
fontScale = scaleY;
|
|
@@ -13634,8 +13686,9 @@ ${filterStyle}
|
|
|
13634
13686
|
this.scaleOf(this.__layout.boxBounds, this.__.lockRatio ? scale : 1, scale, true);
|
|
13635
13687
|
};
|
|
13636
13688
|
exports.Text.prototype.__scaleResize = function (scaleX, scaleY) {
|
|
13637
|
-
|
|
13638
|
-
|
|
13689
|
+
const { app, editConfig } = this, editor = app && app.editor, dragPoint = editor && editor.dragPoint;
|
|
13690
|
+
if (this.__.resizeFontSize || (editConfig && editConfig.editSize === 'font-size') || (dragPoint && editor.mergeConfig.editSize === 'font-size')) {
|
|
13691
|
+
scaleResizeFontSize(this, scaleX, scaleY, dragPoint && dragPoint.direction);
|
|
13639
13692
|
}
|
|
13640
13693
|
else {
|
|
13641
13694
|
scaleResize(this, scaleX, scaleY);
|
|
@@ -13684,34 +13737,15 @@ ${filterStyle}
|
|
|
13684
13737
|
|
|
13685
13738
|
Plugin.add('editor', 'resize');
|
|
13686
13739
|
Creator.editor = function (options) { return new Editor(options); };
|
|
13687
|
-
|
|
13688
|
-
|
|
13689
|
-
|
|
13690
|
-
|
|
13691
|
-
|
|
13692
|
-
|
|
13693
|
-
|
|
13694
|
-
|
|
13695
|
-
|
|
13696
|
-
});
|
|
13697
|
-
defineKey(exports.Text.prototype, 'editInner', {
|
|
13698
|
-
get() { return 'TextEditor'; }
|
|
13699
|
-
});
|
|
13700
|
-
exports.UI.setEditConfig = function (config) {
|
|
13701
|
-
defineKey(this.prototype, 'editConfig', {
|
|
13702
|
-
get() { return typeof config === 'function' ? config(this) : config; }
|
|
13703
|
-
});
|
|
13704
|
-
};
|
|
13705
|
-
exports.UI.setEditOuter = function (toolName) {
|
|
13706
|
-
defineKey(this.prototype, 'editOuter', {
|
|
13707
|
-
get() { return typeof toolName === 'string' ? toolName : toolName(this); }
|
|
13708
|
-
});
|
|
13709
|
-
};
|
|
13710
|
-
exports.UI.setEditInner = function (editorName) {
|
|
13711
|
-
defineKey(this.prototype, 'editInner', {
|
|
13712
|
-
get() { return typeof editorName === 'string' ? editorName : editorName(this); }
|
|
13713
|
-
});
|
|
13714
|
-
};
|
|
13740
|
+
exports.Box.addAttr('textBox', false, dataType);
|
|
13741
|
+
exports.UI.addAttr('editConfig', undefined, dataType);
|
|
13742
|
+
exports.UI.addAttr('editOuter', (ui) => ui.__.__isLinePath ? 'LineEditTool' : 'EditTool', dataType);
|
|
13743
|
+
exports.UI.addAttr('editInner', 'PathEditor', dataType);
|
|
13744
|
+
exports.Group.addAttr('editInner', '', dataType);
|
|
13745
|
+
exports.Text.addAttr('editInner', 'TextEditor', dataType);
|
|
13746
|
+
exports.UI.setEditConfig = function (config) { this.changeAttr('editConfig', config); };
|
|
13747
|
+
exports.UI.setEditOuter = function (toolName) { this.changeAttr('editOuter', toolName); };
|
|
13748
|
+
exports.UI.setEditInner = function (editorName) { this.changeAttr('editInner', editorName); };
|
|
13715
13749
|
|
|
13716
13750
|
function addViewport(leafer, mergeConfig, custom) {
|
|
13717
13751
|
addViewportConfig(leafer.parentApp ? leafer.parentApp : leafer, mergeConfig);
|
|
@@ -13722,10 +13756,8 @@ ${filterStyle}
|
|
|
13722
13756
|
}), leafer.on_(exports.ZoomEvent.BEFORE_ZOOM, (e) => {
|
|
13723
13757
|
const { zoomLayer } = leafer;
|
|
13724
13758
|
const changeScale = leafer.getValidScale(e.scale);
|
|
13725
|
-
if (changeScale !== 1)
|
|
13726
|
-
|
|
13727
|
-
zoomLayer.scale = zoomLayer.__.scaleX * changeScale;
|
|
13728
|
-
}
|
|
13759
|
+
if (changeScale !== 1)
|
|
13760
|
+
zoomLayer.scaleOfWorld(e, changeScale);
|
|
13729
13761
|
}));
|
|
13730
13762
|
}
|
|
13731
13763
|
function addViewportConfig(leafer, mergeConfig) {
|
|
@@ -13952,7 +13984,7 @@ ${filterStyle}
|
|
|
13952
13984
|
changeScale = min / scaleX;
|
|
13953
13985
|
else if (max && absScale > max)
|
|
13954
13986
|
changeScale = max / scaleX;
|
|
13955
|
-
return disabled ? 1 :
|
|
13987
|
+
return disabled ? 1 : changeScale;
|
|
13956
13988
|
};
|
|
13957
13989
|
|
|
13958
13990
|
function getMoveEventData(move, event) {
|
|
@@ -14093,7 +14125,7 @@ ${filterStyle}
|
|
|
14093
14125
|
const limitBounds = this.canvas.bounds.clone().shrink(padding !== undefined ? padding : 30), bounds = new Bounds();
|
|
14094
14126
|
const center = { x: limitBounds.x + limitBounds.width / 2, y: limitBounds.y + limitBounds.height / 2 };
|
|
14095
14127
|
let changeScale;
|
|
14096
|
-
const { scaleX } =
|
|
14128
|
+
const { x, y, scaleX, scaleY } = zoomLayer.__;
|
|
14097
14129
|
if (typeof zoomType === 'string') {
|
|
14098
14130
|
switch (zoomType) {
|
|
14099
14131
|
case 'in':
|
|
@@ -14123,7 +14155,6 @@ ${filterStyle}
|
|
|
14123
14155
|
zoomLayer.scaleOfWorld(center, changeScale, changeScale, false, transition);
|
|
14124
14156
|
}
|
|
14125
14157
|
else if (typeof zoomType === 'object') {
|
|
14126
|
-
const { x, y, scaleX, scaleY } = zoomLayer;
|
|
14127
14158
|
const data = { x, y, scaleX, scaleY };
|
|
14128
14159
|
const isArray = zoomType instanceof Array;
|
|
14129
14160
|
if (isArray || zoomType.tag) {
|
|
@@ -14271,6 +14302,18 @@ ${filterStyle}
|
|
|
14271
14302
|
class ArrowData extends LineData {
|
|
14272
14303
|
}
|
|
14273
14304
|
|
|
14305
|
+
function arrowType(defaultValue) {
|
|
14306
|
+
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
14307
|
+
set(value) {
|
|
14308
|
+
if (this.__setAttr(key, value)) {
|
|
14309
|
+
const data = this.__;
|
|
14310
|
+
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
14311
|
+
doStrokeType(this);
|
|
14312
|
+
}
|
|
14313
|
+
}
|
|
14314
|
+
}));
|
|
14315
|
+
}
|
|
14316
|
+
|
|
14274
14317
|
exports.Arrow = class Arrow extends exports.Line {
|
|
14275
14318
|
get __tag() { return 'Arrow'; }
|
|
14276
14319
|
constructor(data) {
|
|
@@ -14282,7 +14325,7 @@ ${filterStyle}
|
|
|
14282
14325
|
dataProcessor(ArrowData)
|
|
14283
14326
|
], exports.Arrow.prototype, "__", void 0);
|
|
14284
14327
|
__decorate([
|
|
14285
|
-
|
|
14328
|
+
arrowType('angle')
|
|
14286
14329
|
], exports.Arrow.prototype, "endArrow", void 0);
|
|
14287
14330
|
exports.Arrow = __decorate([
|
|
14288
14331
|
registerUI()
|
|
@@ -14515,22 +14558,9 @@ ${filterStyle}
|
|
|
14515
14558
|
data[startIndex + 1] = point.y;
|
|
14516
14559
|
}
|
|
14517
14560
|
|
|
14518
|
-
function arrowType(defaultValue) {
|
|
14519
|
-
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
14520
|
-
set(value) {
|
|
14521
|
-
if (this.__setAttr(key, value)) {
|
|
14522
|
-
const data = this.__;
|
|
14523
|
-
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
14524
|
-
doStrokeType(this);
|
|
14525
|
-
}
|
|
14526
|
-
}
|
|
14527
|
-
}));
|
|
14528
|
-
}
|
|
14529
|
-
|
|
14530
14561
|
Plugin.add('arrow');
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
arrowType('none')(ui$1, 'endArrow');
|
|
14562
|
+
exports.UI.addAttr('startArrow', 'none', arrowType);
|
|
14563
|
+
exports.UI.addAttr('endArrow', 'none', arrowType);
|
|
14534
14564
|
Object.assign(PathArrow, PathArrowModule);
|
|
14535
14565
|
|
|
14536
14566
|
const { Yes, NoAndSkip, YesAndSkip } = exports.Answer;
|
|
@@ -14698,124 +14728,134 @@ ${filterStyle}
|
|
|
14698
14728
|
}
|
|
14699
14729
|
|
|
14700
14730
|
const ExportModule = {
|
|
14701
|
-
|
|
14731
|
+
syncExport(leaf, filename, options) {
|
|
14702
14732
|
this.running = true;
|
|
14733
|
+
let result;
|
|
14703
14734
|
const fileType = FileHelper.fileType(filename);
|
|
14704
14735
|
const isDownload = filename.includes('.');
|
|
14705
14736
|
options = FileHelper.getExportOptions(options);
|
|
14706
|
-
|
|
14707
|
-
|
|
14708
|
-
|
|
14709
|
-
|
|
14710
|
-
|
|
14711
|
-
|
|
14712
|
-
|
|
14713
|
-
|
|
14714
|
-
|
|
14715
|
-
|
|
14716
|
-
|
|
14717
|
-
|
|
14718
|
-
|
|
14719
|
-
|
|
14720
|
-
|
|
14737
|
+
const { toURL } = Platform;
|
|
14738
|
+
const { download } = Platform.origin;
|
|
14739
|
+
if (fileType === 'json') {
|
|
14740
|
+
isDownload && download(toURL(JSON.stringify(leaf.toJSON(options.json)), 'text'), filename);
|
|
14741
|
+
result = { data: isDownload ? true : leaf.toJSON(options.json) };
|
|
14742
|
+
}
|
|
14743
|
+
else if (fileType === 'svg') {
|
|
14744
|
+
isDownload && download(toURL(leaf.toSVG(), 'svg'), filename);
|
|
14745
|
+
result = { data: isDownload ? true : leaf.toSVG() };
|
|
14746
|
+
}
|
|
14747
|
+
else {
|
|
14748
|
+
let renderBounds, trimBounds, scaleX = 1, scaleY = 1;
|
|
14749
|
+
const { worldTransform, isLeafer, leafer, isFrame } = leaf;
|
|
14750
|
+
const { slice, trim, padding, onCanvas } = options;
|
|
14751
|
+
const smooth = options.smooth === undefined ? (leafer ? leafer.config.smooth : true) : options.smooth;
|
|
14752
|
+
const contextSettings = options.contextSettings || (leafer ? leafer.config.contextSettings : undefined);
|
|
14753
|
+
const screenshot = options.screenshot || leaf.isApp;
|
|
14754
|
+
const fill = (isLeafer && screenshot) ? (options.fill === undefined ? leaf.fill : options.fill) : options.fill;
|
|
14755
|
+
const needFill = FileHelper.isOpaqueImage(filename) || fill, matrix = new Matrix();
|
|
14756
|
+
if (screenshot) {
|
|
14757
|
+
renderBounds = screenshot === true ? (isLeafer ? leafer.canvas.bounds : leaf.worldRenderBounds) : screenshot;
|
|
14721
14758
|
}
|
|
14722
|
-
|
|
14723
|
-
|
|
14724
|
-
|
|
14725
|
-
|
|
14726
|
-
|
|
14727
|
-
|
|
14728
|
-
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
|
|
14734
|
-
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
|
|
14738
|
-
|
|
14739
|
-
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
|
|
14745
|
-
|
|
14746
|
-
|
|
14747
|
-
|
|
14748
|
-
|
|
14749
|
-
|
|
14750
|
-
|
|
14751
|
-
|
|
14752
|
-
|
|
14753
|
-
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
14761
|
-
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
|
|
14767
|
-
|
|
14768
|
-
|
|
14769
|
-
|
|
14770
|
-
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
|
|
14774
|
-
let canvas = Creator.canvas({ width: Math.round(width), height: Math.round(height), pixelRatio, smooth, contextSettings });
|
|
14775
|
-
let sliceLeaf;
|
|
14776
|
-
if (slice) {
|
|
14777
|
-
sliceLeaf = leaf;
|
|
14778
|
-
sliceLeaf.__worldOpacity = 0;
|
|
14779
|
-
leaf = leafer;
|
|
14780
|
-
renderOptions.bounds = canvas.bounds;
|
|
14781
|
-
}
|
|
14782
|
-
canvas.save();
|
|
14783
|
-
if (isFrame && fill !== undefined) {
|
|
14784
|
-
const oldFill = leaf.get('fill');
|
|
14785
|
-
leaf.fill = '';
|
|
14786
|
-
leaf.__render(canvas, renderOptions);
|
|
14787
|
-
leaf.fill = oldFill;
|
|
14788
|
-
}
|
|
14789
|
-
else {
|
|
14790
|
-
leaf.__render(canvas, renderOptions);
|
|
14791
|
-
}
|
|
14792
|
-
canvas.restore();
|
|
14793
|
-
if (sliceLeaf)
|
|
14794
|
-
sliceLeaf.__updateWorldOpacity();
|
|
14795
|
-
if (trim) {
|
|
14796
|
-
trimBounds = getTrimBounds(canvas);
|
|
14797
|
-
const old = canvas, { width, height } = trimBounds;
|
|
14798
|
-
const config = { x: 0, y: 0, width, height, pixelRatio };
|
|
14799
|
-
canvas = Creator.canvas(config);
|
|
14800
|
-
canvas.copyWorld(old, trimBounds, config);
|
|
14801
|
-
}
|
|
14802
|
-
if (padding) {
|
|
14803
|
-
const [top, right, bottom, left] = MathHelper.fourNumber(padding);
|
|
14804
|
-
const old = canvas, { width, height } = old;
|
|
14805
|
-
canvas = Creator.canvas({ width: width + left + right, height: height + top + bottom, pixelRatio });
|
|
14806
|
-
canvas.copyWorld(old, old.bounds, { x: left, y: top, width, height });
|
|
14807
|
-
}
|
|
14808
|
-
if (needFill)
|
|
14809
|
-
canvas.fillWorld(canvas.bounds, fill || '#FFFFFF', 'destination-over');
|
|
14810
|
-
if (onCanvas)
|
|
14811
|
-
onCanvas(canvas);
|
|
14812
|
-
const data = filename === 'canvas' ? canvas : yield canvas.export(filename, options);
|
|
14813
|
-
over({ data, width: canvas.pixelWidth, height: canvas.pixelHeight, renderBounds, trimBounds });
|
|
14814
|
-
}));
|
|
14759
|
+
else {
|
|
14760
|
+
let relative = options.relative || (isLeafer ? 'inner' : 'local');
|
|
14761
|
+
scaleX = worldTransform.scaleX;
|
|
14762
|
+
scaleY = worldTransform.scaleY;
|
|
14763
|
+
switch (relative) {
|
|
14764
|
+
case 'inner':
|
|
14765
|
+
matrix.set(worldTransform);
|
|
14766
|
+
break;
|
|
14767
|
+
case 'local':
|
|
14768
|
+
matrix.set(worldTransform).divide(leaf.localTransform);
|
|
14769
|
+
scaleX /= leaf.scaleX;
|
|
14770
|
+
scaleY /= leaf.scaleY;
|
|
14771
|
+
break;
|
|
14772
|
+
case 'world':
|
|
14773
|
+
scaleX = 1;
|
|
14774
|
+
scaleY = 1;
|
|
14775
|
+
break;
|
|
14776
|
+
case 'page':
|
|
14777
|
+
relative = leafer || leaf;
|
|
14778
|
+
default:
|
|
14779
|
+
matrix.set(worldTransform).divide(leaf.getTransform(relative));
|
|
14780
|
+
const l = relative.worldTransform;
|
|
14781
|
+
scaleX /= scaleX / l.scaleX;
|
|
14782
|
+
scaleY /= scaleY / l.scaleY;
|
|
14783
|
+
}
|
|
14784
|
+
renderBounds = leaf.getBounds('render', relative);
|
|
14785
|
+
}
|
|
14786
|
+
const scaleData = { scaleX: 1, scaleY: 1 };
|
|
14787
|
+
MathHelper.getScaleData(options.scale, options.size, renderBounds, scaleData);
|
|
14788
|
+
let pixelRatio = options.pixelRatio || 1;
|
|
14789
|
+
if (leaf.isApp) {
|
|
14790
|
+
scaleData.scaleX *= pixelRatio;
|
|
14791
|
+
scaleData.scaleY *= pixelRatio;
|
|
14792
|
+
pixelRatio = leaf.app.pixelRatio;
|
|
14793
|
+
}
|
|
14794
|
+
const { x, y, width, height } = new Bounds(renderBounds).scale(scaleData.scaleX, scaleData.scaleY);
|
|
14795
|
+
const renderOptions = { matrix: matrix.scale(1 / scaleData.scaleX, 1 / scaleData.scaleY).invert().translate(-x, -y).withScale(1 / scaleX * scaleData.scaleX, 1 / scaleY * scaleData.scaleY) };
|
|
14796
|
+
let canvas = Creator.canvas({ width: Math.floor(width), height: Math.floor(height), pixelRatio, smooth, contextSettings });
|
|
14797
|
+
let sliceLeaf;
|
|
14798
|
+
if (slice) {
|
|
14799
|
+
sliceLeaf = leaf;
|
|
14800
|
+
sliceLeaf.__worldOpacity = 0;
|
|
14801
|
+
leaf = leafer || leaf;
|
|
14802
|
+
renderOptions.bounds = canvas.bounds;
|
|
14803
|
+
}
|
|
14804
|
+
canvas.save();
|
|
14805
|
+
if (isFrame && fill !== undefined) {
|
|
14806
|
+
const oldFill = leaf.get('fill');
|
|
14807
|
+
leaf.fill = '';
|
|
14808
|
+
leaf.__render(canvas, renderOptions);
|
|
14809
|
+
leaf.fill = oldFill;
|
|
14815
14810
|
}
|
|
14816
14811
|
else {
|
|
14817
|
-
|
|
14812
|
+
leaf.__render(canvas, renderOptions);
|
|
14813
|
+
}
|
|
14814
|
+
canvas.restore();
|
|
14815
|
+
if (sliceLeaf)
|
|
14816
|
+
sliceLeaf.__updateWorldOpacity();
|
|
14817
|
+
if (trim) {
|
|
14818
|
+
trimBounds = getTrimBounds(canvas);
|
|
14819
|
+
const old = canvas, { width, height } = trimBounds;
|
|
14820
|
+
const config = { x: 0, y: 0, width, height, pixelRatio };
|
|
14821
|
+
canvas = Creator.canvas(config);
|
|
14822
|
+
canvas.copyWorld(old, trimBounds, config);
|
|
14818
14823
|
}
|
|
14824
|
+
if (padding) {
|
|
14825
|
+
const [top, right, bottom, left] = MathHelper.fourNumber(padding);
|
|
14826
|
+
const old = canvas, { width, height } = old;
|
|
14827
|
+
canvas = Creator.canvas({ width: width + left + right, height: height + top + bottom, pixelRatio });
|
|
14828
|
+
canvas.copyWorld(old, old.bounds, { x: left, y: top, width, height });
|
|
14829
|
+
}
|
|
14830
|
+
if (needFill)
|
|
14831
|
+
canvas.fillWorld(canvas.bounds, fill || '#FFFFFF', 'destination-over');
|
|
14832
|
+
if (onCanvas)
|
|
14833
|
+
onCanvas(canvas);
|
|
14834
|
+
const data = filename === 'canvas' ? canvas : canvas.export(filename, options);
|
|
14835
|
+
result = { data, width: canvas.pixelWidth, height: canvas.pixelHeight, renderBounds, trimBounds };
|
|
14836
|
+
}
|
|
14837
|
+
this.running = false;
|
|
14838
|
+
return result;
|
|
14839
|
+
},
|
|
14840
|
+
export(leaf, filename, options) {
|
|
14841
|
+
this.running = true;
|
|
14842
|
+
return addTask((success) => new Promise((resolve) => {
|
|
14843
|
+
const getResult = () => __awaiter(this, void 0, void 0, function* () {
|
|
14844
|
+
if (!Resource.isComplete)
|
|
14845
|
+
return Platform.requestRender(getResult);
|
|
14846
|
+
const result = ExportModule.syncExport(leaf, filename, options);
|
|
14847
|
+
if (result.data instanceof Promise)
|
|
14848
|
+
result.data = yield result.data;
|
|
14849
|
+
success(result);
|
|
14850
|
+
resolve();
|
|
14851
|
+
});
|
|
14852
|
+
leaf.updateLayout();
|
|
14853
|
+
checkLazy(leaf);
|
|
14854
|
+
const { leafer } = leaf;
|
|
14855
|
+
if (leafer)
|
|
14856
|
+
leafer.waitViewCompleted(getResult);
|
|
14857
|
+
else
|
|
14858
|
+
getResult();
|
|
14819
14859
|
}));
|
|
14820
14860
|
}
|
|
14821
14861
|
};
|
|
@@ -14874,6 +14914,9 @@ ${filterStyle}
|
|
|
14874
14914
|
exports.UI.prototype.export = function (filename, options) {
|
|
14875
14915
|
return Export.export(this, filename, options);
|
|
14876
14916
|
};
|
|
14917
|
+
exports.UI.prototype.syncExport = function (filename, options) {
|
|
14918
|
+
return Export.syncExport(this, filename, options);
|
|
14919
|
+
};
|
|
14877
14920
|
|
|
14878
14921
|
const textCaseMap = {
|
|
14879
14922
|
'none': 'none',
|
|
@@ -14982,10 +15025,10 @@ ${filterStyle}
|
|
|
14982
15025
|
this.onFocus = this.onFocus.bind(this);
|
|
14983
15026
|
this.onInput = this.onInput.bind(this);
|
|
14984
15027
|
this.onUpdate = this.onUpdate.bind(this);
|
|
14985
|
-
this.
|
|
15028
|
+
this.onKeydown = this.onKeydown.bind(this);
|
|
14986
15029
|
div.addEventListener("focus", this.onFocus);
|
|
14987
15030
|
div.addEventListener("input", this.onInput);
|
|
14988
|
-
window.addEventListener('keydown', this.
|
|
15031
|
+
window.addEventListener('keydown', this.onKeydown);
|
|
14989
15032
|
window.addEventListener('scroll', this.onUpdate);
|
|
14990
15033
|
const selection = window.getSelection();
|
|
14991
15034
|
const range = document.createRange();
|
|
@@ -15003,14 +15046,25 @@ ${filterStyle}
|
|
|
15003
15046
|
}
|
|
15004
15047
|
onInput() {
|
|
15005
15048
|
const { editDom } = this;
|
|
15006
|
-
this.editTarget.text = this.isHTMLText ? editDom.innerHTML : editDom.innerText
|
|
15049
|
+
this.editTarget.text = this.isHTMLText ? editDom.innerHTML : editDom.innerText;
|
|
15007
15050
|
}
|
|
15008
15051
|
onFocus() {
|
|
15009
15052
|
this.editDom.style.outline = 'none';
|
|
15010
15053
|
}
|
|
15011
|
-
|
|
15054
|
+
onKeydown(e) {
|
|
15012
15055
|
if (e.code === 'Escape')
|
|
15013
15056
|
this.editor.closeInnerEditor();
|
|
15057
|
+
if (e.key === 'Enter') {
|
|
15058
|
+
e.preventDefault();
|
|
15059
|
+
const br = document.createElement('br');
|
|
15060
|
+
const selection = window.getSelection();
|
|
15061
|
+
const range = selection.getRangeAt(0);
|
|
15062
|
+
range.deleteContents();
|
|
15063
|
+
range.insertNode(br);
|
|
15064
|
+
range.setStartAfter(br);
|
|
15065
|
+
range.setEndAfter(br);
|
|
15066
|
+
this.onInput();
|
|
15067
|
+
}
|
|
15014
15068
|
}
|
|
15015
15069
|
onUpdate() {
|
|
15016
15070
|
const { editTarget: text } = this;
|
|
@@ -15066,7 +15120,7 @@ ${filterStyle}
|
|
|
15066
15120
|
editor.off_(this.eventIds);
|
|
15067
15121
|
dom.removeEventListener("focus", this.onFocus);
|
|
15068
15122
|
dom.removeEventListener("input", this.onInput);
|
|
15069
|
-
window.removeEventListener('keydown', this.
|
|
15123
|
+
window.removeEventListener('keydown', this.onKeydown);
|
|
15070
15124
|
window.removeEventListener('scroll', this.onUpdate);
|
|
15071
15125
|
dom.remove();
|
|
15072
15126
|
this.editDom = this.eventIds = undefined;
|
|
@@ -15088,7 +15142,6 @@ ${filterStyle}
|
|
|
15088
15142
|
|
|
15089
15143
|
exports.HTMLText = class HTMLText extends exports.Image {
|
|
15090
15144
|
get __tag() { return 'HTMLText'; }
|
|
15091
|
-
get editInner() { return 'TextEditor'; }
|
|
15092
15145
|
constructor(data) {
|
|
15093
15146
|
super(data);
|
|
15094
15147
|
}
|
|
@@ -15133,6 +15186,9 @@ ${filterStyle}
|
|
|
15133
15186
|
__decorate([
|
|
15134
15187
|
boundsType('')
|
|
15135
15188
|
], exports.HTMLText.prototype, "text", void 0);
|
|
15189
|
+
__decorate([
|
|
15190
|
+
dataType('TextEditor')
|
|
15191
|
+
], exports.HTMLText.prototype, "editInner", void 0);
|
|
15136
15192
|
exports.HTMLText = __decorate([
|
|
15137
15193
|
registerUI()
|
|
15138
15194
|
], exports.HTMLText);
|