@leafer-ui/draw 1.0.0-rc.22 → 1.0.0-rc.24
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/lib/draw.cjs +171 -93
- package/lib/draw.esm.js +173 -94
- package/lib/draw.esm.min.js +1 -1
- package/lib/draw.min.cjs +1 -1
- package/package.json +6 -6
- package/src/index.ts +0 -2
- package/types/index.d.ts +0 -4
package/lib/draw.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { decorateLeafAttr, attr, doStrokeType, defineKey, Debug, LeafData, PathConvert,
|
|
1
|
+
import { decorateLeafAttr, attr, doStrokeType, defineKey, Debug, LeafData, PathConvert, dataProcessor, dataType, surfaceType, opacityType, visibleType, sortType, maskType, eraserType, positionType, boundsType, scaleType, rotationType, autoLayoutType, naturalBoundsType, pathInputType, pathType, hitType, strokeType, cursorType, rewrite, Leaf, useModule, rewriteAble, pen, PathCorner, PathDrawer, UICreator, registerUI, Branch, LeafList, ImageManager, DataHelper, Creator, CanvasManager, WaitHelper, LeaferEvent, canvasSizeAttrs, Bounds, ResizeEvent, AutoBounds, Run, LayoutEvent, RenderEvent, WatchEvent, affectRenderBoundsType, BoundsHelper, Platform, PathCommandDataHelper, affectStrokeBoundsType, getPointData, PointHelper, PathBounds, ImageEvent, Matrix, MathHelper, PathCreator } from '@leafer/core';
|
|
2
2
|
export * from '@leafer/core';
|
|
3
3
|
|
|
4
4
|
/******************************************************************************
|
|
@@ -52,10 +52,11 @@ function stateType(defaultValue) {
|
|
|
52
52
|
function arrowType(defaultValue) {
|
|
53
53
|
return decorateLeafAttr(defaultValue, (key) => attr({
|
|
54
54
|
set(value) {
|
|
55
|
-
this.__setAttr(key, value)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
if (this.__setAttr(key, value)) {
|
|
56
|
+
const data = this.__;
|
|
57
|
+
data.__useArrow = data.startArrow !== 'none' || data.endArrow !== 'none';
|
|
58
|
+
doStrokeType(this);
|
|
59
|
+
}
|
|
59
60
|
}
|
|
60
61
|
}));
|
|
61
62
|
}
|
|
@@ -228,7 +229,7 @@ class UIData extends LeafData {
|
|
|
228
229
|
const UnitConvert = {
|
|
229
230
|
number(value, percentRefer) {
|
|
230
231
|
if (typeof value === 'object')
|
|
231
|
-
return value.type === 'percent' ? value.value
|
|
232
|
+
return value.type === 'percent' ? value.value * percentRefer : value.value;
|
|
232
233
|
return value;
|
|
233
234
|
}
|
|
234
235
|
};
|
|
@@ -237,7 +238,7 @@ class GroupData extends UIData {
|
|
|
237
238
|
}
|
|
238
239
|
|
|
239
240
|
class BoxData extends GroupData {
|
|
240
|
-
get __boxStroke() { return
|
|
241
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
241
242
|
}
|
|
242
243
|
|
|
243
244
|
class LeaferData extends GroupData {
|
|
@@ -250,11 +251,11 @@ class LineData extends UIData {
|
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
class RectData extends UIData {
|
|
253
|
-
get __boxStroke() { return
|
|
254
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
254
255
|
}
|
|
255
256
|
|
|
256
257
|
class EllipseData extends UIData {
|
|
257
|
-
get __boxStroke() { return
|
|
258
|
+
get __boxStroke() { return !this.__pathInputed; }
|
|
258
259
|
}
|
|
259
260
|
|
|
260
261
|
class PolygonData extends UIData {
|
|
@@ -281,6 +282,7 @@ const fontWeightMap = {
|
|
|
281
282
|
'black': 900
|
|
282
283
|
};
|
|
283
284
|
class TextData extends UIData {
|
|
285
|
+
get __useNaturalRatio() { return false; }
|
|
284
286
|
setFontWeight(value) {
|
|
285
287
|
if (typeof value === 'string') {
|
|
286
288
|
this.__setInput('fontWeight', value);
|
|
@@ -322,19 +324,18 @@ class CanvasData extends RectData {
|
|
|
322
324
|
const UIBounds = {
|
|
323
325
|
__updateStrokeSpread() {
|
|
324
326
|
let width = 0, boxWidth = 0;
|
|
325
|
-
const
|
|
326
|
-
if ((stroke || hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
327
|
+
const data = this.__, { strokeAlign, strokeWidth } = data;
|
|
328
|
+
if ((data.stroke || data.hitStroke === 'all') && strokeWidth && strokeAlign !== 'inside') {
|
|
327
329
|
boxWidth = width = strokeAlign === 'center' ? strokeWidth / 2 : strokeWidth;
|
|
328
|
-
if (!
|
|
329
|
-
const
|
|
330
|
-
const
|
|
331
|
-
const storkeCapAddWidth = strokeCap === 'none' ? 0 : strokeWidth;
|
|
330
|
+
if (!data.__boxStroke) {
|
|
331
|
+
const miterLimitAddWidth = data.__isLinePath ? 0 : 10 * width;
|
|
332
|
+
const storkeCapAddWidth = data.strokeCap === 'none' ? 0 : strokeWidth;
|
|
332
333
|
width += Math.max(miterLimitAddWidth, storkeCapAddWidth);
|
|
333
334
|
}
|
|
334
335
|
}
|
|
335
|
-
|
|
336
|
-
if (this.__.__useArrow)
|
|
336
|
+
if (data.__useArrow)
|
|
337
337
|
width += strokeWidth * 5;
|
|
338
|
+
this.__layout.strokeBoxSpread = boxWidth;
|
|
338
339
|
return width;
|
|
339
340
|
},
|
|
340
341
|
__updateRenderSpread() {
|
|
@@ -354,7 +355,7 @@ const UIBounds = {
|
|
|
354
355
|
if (backgroundBlur)
|
|
355
356
|
shapeWidth = Math.max(shapeWidth, backgroundBlur);
|
|
356
357
|
this.__layout.renderShapeSpread = shapeWidth;
|
|
357
|
-
return width;
|
|
358
|
+
return width + (this.__layout.strokeSpread || 0);
|
|
358
359
|
}
|
|
359
360
|
};
|
|
360
361
|
|
|
@@ -445,7 +446,7 @@ function drawFast(ui, canvas, options) {
|
|
|
445
446
|
|
|
446
447
|
const RectRender = {
|
|
447
448
|
__drawFast(canvas, options) {
|
|
448
|
-
|
|
449
|
+
let { width, height, fill, stroke, __drawAfterFill } = this.__;
|
|
449
450
|
if (fill) {
|
|
450
451
|
canvas.fillStyle = fill;
|
|
451
452
|
canvas.fillRect(0, 0, width, height);
|
|
@@ -463,7 +464,16 @@ const RectRender = {
|
|
|
463
464
|
canvas.strokeRect(0, 0, width, height);
|
|
464
465
|
break;
|
|
465
466
|
case 'inside':
|
|
466
|
-
|
|
467
|
+
width -= __strokeWidth, height -= __strokeWidth;
|
|
468
|
+
if (width < 0 || height < 0) {
|
|
469
|
+
canvas.save();
|
|
470
|
+
this.__clip(canvas, options);
|
|
471
|
+
canvas.strokeRect(half, half, width, height);
|
|
472
|
+
canvas.restore();
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
canvas.strokeRect(half, half, width, height);
|
|
476
|
+
}
|
|
467
477
|
break;
|
|
468
478
|
case 'outside':
|
|
469
479
|
canvas.strokeRect(-half, -half, width + __strokeWidth, height + __strokeWidth);
|
|
@@ -491,11 +501,14 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
491
501
|
return scaleX !== scaleY ? { x: scaleX, y: scaleY } : scaleX;
|
|
492
502
|
}
|
|
493
503
|
get pen() {
|
|
494
|
-
|
|
504
|
+
const { path } = this.__;
|
|
505
|
+
pen.set(this.path = path || []);
|
|
506
|
+
if (!path)
|
|
507
|
+
this.__drawPathByBox(pen);
|
|
495
508
|
return pen;
|
|
496
509
|
}
|
|
497
510
|
get editConfig() { return undefined; }
|
|
498
|
-
get editOuter() { return 'EditTool'; }
|
|
511
|
+
get editOuter() { return this.__.__isLinePath ? 'LineEditTool' : 'EditTool'; }
|
|
499
512
|
get editInner() { return 'PathEditor'; }
|
|
500
513
|
constructor(data) {
|
|
501
514
|
super(data);
|
|
@@ -509,22 +522,22 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
509
522
|
}
|
|
510
523
|
createProxyData() { return undefined; }
|
|
511
524
|
find(_condition, _options) { return undefined; }
|
|
525
|
+
findTag(tag) { return this.find({ tag }); }
|
|
512
526
|
findOne(_condition, _options) { return undefined; }
|
|
527
|
+
findId(id) { return this.findOne({ id }); }
|
|
513
528
|
getPath(curve, pathForRender) {
|
|
514
529
|
this.__layout.update();
|
|
515
530
|
let path = pathForRender ? this.__.__pathForRender : this.__.path;
|
|
516
|
-
if (!path)
|
|
517
|
-
|
|
518
|
-
if (width || height) {
|
|
519
|
-
pen.set(path = []);
|
|
520
|
-
this.__drawPathByBox(pen);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
531
|
+
if (!path)
|
|
532
|
+
pen.set(path = []), this.__drawPathByBox(pen);
|
|
523
533
|
return curve ? PathConvert.toCanvasData(path, true) : path;
|
|
524
534
|
}
|
|
525
535
|
getPathString(curve, pathForRender) {
|
|
526
536
|
return PathConvert.stringify(this.getPath(curve, pathForRender));
|
|
527
537
|
}
|
|
538
|
+
load() {
|
|
539
|
+
this.__.__computePaint();
|
|
540
|
+
}
|
|
528
541
|
__onUpdateSize() {
|
|
529
542
|
if (this.__.__input) {
|
|
530
543
|
const data = this.__;
|
|
@@ -610,7 +623,7 @@ __decorate([
|
|
|
610
623
|
opacityType(1)
|
|
611
624
|
], UI.prototype, "opacity", void 0);
|
|
612
625
|
__decorate([
|
|
613
|
-
|
|
626
|
+
visibleType(true)
|
|
614
627
|
], UI.prototype, "visible", void 0);
|
|
615
628
|
__decorate([
|
|
616
629
|
stateType(false)
|
|
@@ -627,9 +640,6 @@ __decorate([
|
|
|
627
640
|
__decorate([
|
|
628
641
|
maskType(false)
|
|
629
642
|
], UI.prototype, "mask", void 0);
|
|
630
|
-
__decorate([
|
|
631
|
-
surfaceType('pixel')
|
|
632
|
-
], UI.prototype, "maskType", void 0);
|
|
633
643
|
__decorate([
|
|
634
644
|
eraserType(false)
|
|
635
645
|
], UI.prototype, "eraser", void 0);
|
|
@@ -660,9 +670,75 @@ __decorate([
|
|
|
660
670
|
__decorate([
|
|
661
671
|
rotationType(0, true)
|
|
662
672
|
], UI.prototype, "skewY", void 0);
|
|
673
|
+
__decorate([
|
|
674
|
+
positionType(0, true)
|
|
675
|
+
], UI.prototype, "offsetX", void 0);
|
|
676
|
+
__decorate([
|
|
677
|
+
positionType(0, true)
|
|
678
|
+
], UI.prototype, "offsetY", void 0);
|
|
679
|
+
__decorate([
|
|
680
|
+
positionType(0, true)
|
|
681
|
+
], UI.prototype, "scrollX", void 0);
|
|
682
|
+
__decorate([
|
|
683
|
+
positionType(0, true)
|
|
684
|
+
], UI.prototype, "scrollY", void 0);
|
|
685
|
+
__decorate([
|
|
686
|
+
autoLayoutType()
|
|
687
|
+
], UI.prototype, "origin", void 0);
|
|
663
688
|
__decorate([
|
|
664
689
|
autoLayoutType()
|
|
665
690
|
], UI.prototype, "around", void 0);
|
|
691
|
+
__decorate([
|
|
692
|
+
dataType(false)
|
|
693
|
+
], UI.prototype, "lazy", void 0);
|
|
694
|
+
__decorate([
|
|
695
|
+
naturalBoundsType(1)
|
|
696
|
+
], UI.prototype, "pixelRatio", void 0);
|
|
697
|
+
__decorate([
|
|
698
|
+
pathInputType()
|
|
699
|
+
], UI.prototype, "path", void 0);
|
|
700
|
+
__decorate([
|
|
701
|
+
pathType()
|
|
702
|
+
], UI.prototype, "windingRule", void 0);
|
|
703
|
+
__decorate([
|
|
704
|
+
pathType(true)
|
|
705
|
+
], UI.prototype, "closed", void 0);
|
|
706
|
+
__decorate([
|
|
707
|
+
autoLayoutType(false)
|
|
708
|
+
], UI.prototype, "flow", void 0);
|
|
709
|
+
__decorate([
|
|
710
|
+
boundsType(0)
|
|
711
|
+
], UI.prototype, "padding", void 0);
|
|
712
|
+
__decorate([
|
|
713
|
+
boundsType(0)
|
|
714
|
+
], UI.prototype, "gap", void 0);
|
|
715
|
+
__decorate([
|
|
716
|
+
boundsType('top-left')
|
|
717
|
+
], UI.prototype, "align", void 0);
|
|
718
|
+
__decorate([
|
|
719
|
+
boundsType(false)
|
|
720
|
+
], UI.prototype, "wrap", void 0);
|
|
721
|
+
__decorate([
|
|
722
|
+
boundsType('box')
|
|
723
|
+
], UI.prototype, "itemBox", void 0);
|
|
724
|
+
__decorate([
|
|
725
|
+
boundsType(true)
|
|
726
|
+
], UI.prototype, "inFlow", void 0);
|
|
727
|
+
__decorate([
|
|
728
|
+
boundsType()
|
|
729
|
+
], UI.prototype, "autoWidth", void 0);
|
|
730
|
+
__decorate([
|
|
731
|
+
boundsType()
|
|
732
|
+
], UI.prototype, "autoHeight", void 0);
|
|
733
|
+
__decorate([
|
|
734
|
+
boundsType()
|
|
735
|
+
], UI.prototype, "autoBox", void 0);
|
|
736
|
+
__decorate([
|
|
737
|
+
boundsType()
|
|
738
|
+
], UI.prototype, "widthRange", void 0);
|
|
739
|
+
__decorate([
|
|
740
|
+
boundsType()
|
|
741
|
+
], UI.prototype, "heightRange", void 0);
|
|
666
742
|
__decorate([
|
|
667
743
|
dataType(false)
|
|
668
744
|
], UI.prototype, "draggable", void 0);
|
|
@@ -672,9 +748,6 @@ __decorate([
|
|
|
672
748
|
__decorate([
|
|
673
749
|
dataType(false)
|
|
674
750
|
], UI.prototype, "editable", void 0);
|
|
675
|
-
__decorate([
|
|
676
|
-
dataType('size')
|
|
677
|
-
], UI.prototype, "editSize", void 0);
|
|
678
751
|
__decorate([
|
|
679
752
|
hitType(true)
|
|
680
753
|
], UI.prototype, "hittable", void 0);
|
|
@@ -729,21 +802,6 @@ __decorate([
|
|
|
729
802
|
__decorate([
|
|
730
803
|
strokeType(10)
|
|
731
804
|
], UI.prototype, "miterLimit", void 0);
|
|
732
|
-
__decorate([
|
|
733
|
-
dataType(false)
|
|
734
|
-
], UI.prototype, "lazy", void 0);
|
|
735
|
-
__decorate([
|
|
736
|
-
naturalBoundsType(1)
|
|
737
|
-
], UI.prototype, "pixelRatio", void 0);
|
|
738
|
-
__decorate([
|
|
739
|
-
pathInputType()
|
|
740
|
-
], UI.prototype, "path", void 0);
|
|
741
|
-
__decorate([
|
|
742
|
-
pathType()
|
|
743
|
-
], UI.prototype, "windingRule", void 0);
|
|
744
|
-
__decorate([
|
|
745
|
-
pathType(true)
|
|
746
|
-
], UI.prototype, "closed", void 0);
|
|
747
805
|
__decorate([
|
|
748
806
|
arrowType('none')
|
|
749
807
|
], UI.prototype, "startArrow", void 0);
|
|
@@ -874,6 +932,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
874
932
|
get layoutLocked() { return !this.layouter.running; }
|
|
875
933
|
get FPS() { return this.renderer ? this.renderer.FPS : 60; }
|
|
876
934
|
get cursorPoint() { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 }; }
|
|
935
|
+
get clientBounds() { return this.canvas && this.canvas.getClientBounds(); }
|
|
877
936
|
constructor(userConfig, data) {
|
|
878
937
|
super(data);
|
|
879
938
|
this.config = {
|
|
@@ -977,9 +1036,6 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
977
1036
|
const data = DataHelper.copyAttrs({}, size, canvasSizeAttrs);
|
|
978
1037
|
Object.keys(data).forEach(key => this[key] = data[key]);
|
|
979
1038
|
}
|
|
980
|
-
forceFullRender() {
|
|
981
|
-
this.forceRender();
|
|
982
|
-
}
|
|
983
1039
|
forceRender(bounds) {
|
|
984
1040
|
this.renderer.addBlock(bounds ? new Bounds(bounds) : this.canvas.bounds);
|
|
985
1041
|
if (this.viewReady)
|
|
@@ -1034,7 +1090,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
1034
1090
|
this.__changeFill(newValue);
|
|
1035
1091
|
}
|
|
1036
1092
|
else if (attrName === 'hittable') {
|
|
1037
|
-
this.
|
|
1093
|
+
if (!this.parent)
|
|
1094
|
+
this.canvas.hittable = newValue;
|
|
1038
1095
|
}
|
|
1039
1096
|
}
|
|
1040
1097
|
return super.__setAttr(attrName, newValue);
|
|
@@ -1057,7 +1114,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
1057
1114
|
this.canvas.backgroundColor = newValue;
|
|
1058
1115
|
}
|
|
1059
1116
|
else {
|
|
1060
|
-
this.
|
|
1117
|
+
this.forceRender();
|
|
1061
1118
|
}
|
|
1062
1119
|
}
|
|
1063
1120
|
__onCreated() {
|
|
@@ -1152,6 +1209,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
1152
1209
|
zoom(_zoomType, _padding, _fixedScale) { return undefined; }
|
|
1153
1210
|
getValidMove(moveX, moveY) { return { x: moveX, y: moveY }; }
|
|
1154
1211
|
getValidScale(changeScale) { return changeScale; }
|
|
1212
|
+
getWorldPointByClient(clientPoint, updateClient) {
|
|
1213
|
+
return this.interaction && this.interaction.getLocal(clientPoint, updateClient);
|
|
1214
|
+
}
|
|
1155
1215
|
__checkUpdateLayout() {
|
|
1156
1216
|
this.__layout.update();
|
|
1157
1217
|
}
|
|
@@ -1234,8 +1294,8 @@ Rect = __decorate([
|
|
|
1234
1294
|
|
|
1235
1295
|
const rect = Rect.prototype;
|
|
1236
1296
|
const group = Group.prototype;
|
|
1237
|
-
const
|
|
1238
|
-
const { copy, add } = BoundsHelper;
|
|
1297
|
+
const childrenRenderBounds = {};
|
|
1298
|
+
const { copy, add, includes: includes$1 } = BoundsHelper;
|
|
1239
1299
|
let Box = class Box extends Group {
|
|
1240
1300
|
get __tag() { return 'Box'; }
|
|
1241
1301
|
get isBranchLeaf() { return true; }
|
|
@@ -1246,24 +1306,29 @@ let Box = class Box extends Group {
|
|
|
1246
1306
|
__updateStrokeSpread() { return 0; }
|
|
1247
1307
|
__updateRectRenderSpread() { return 0; }
|
|
1248
1308
|
__updateRenderSpread() {
|
|
1249
|
-
|
|
1250
|
-
const hide = this.__.__drawAfterFill = this.__.overflow === 'hide';
|
|
1251
|
-
return (width || hide) ? width : -1;
|
|
1309
|
+
return this.__updateRectRenderSpread() || -1;
|
|
1252
1310
|
}
|
|
1253
1311
|
__updateRectBoxBounds() { }
|
|
1254
1312
|
__updateBoxBounds() {
|
|
1255
1313
|
const data = this.__;
|
|
1256
|
-
if (
|
|
1257
|
-
if (
|
|
1258
|
-
this.leafer.
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1314
|
+
if (this.children.length) {
|
|
1315
|
+
if (data.__autoSide) {
|
|
1316
|
+
if (this.leafer && this.leafer.ready)
|
|
1317
|
+
this.leafer.layouter.addExtra(this);
|
|
1318
|
+
super.__updateBoxBounds();
|
|
1319
|
+
if (!data.__autoSize) {
|
|
1320
|
+
const b = this.__layout.boxBounds;
|
|
1321
|
+
if (!data.__autoWidth)
|
|
1322
|
+
b.x = 0, b.width = data.width;
|
|
1323
|
+
if (!data.__autoHeight)
|
|
1324
|
+
b.y = 0, b.height = data.height;
|
|
1325
|
+
}
|
|
1266
1326
|
}
|
|
1327
|
+
else {
|
|
1328
|
+
this.__updateRectBoxBounds();
|
|
1329
|
+
}
|
|
1330
|
+
if (data.flow)
|
|
1331
|
+
this.__updateContentBounds();
|
|
1267
1332
|
}
|
|
1268
1333
|
else {
|
|
1269
1334
|
this.__updateRectBoxBounds();
|
|
@@ -1271,13 +1336,20 @@ let Box = class Box extends Group {
|
|
|
1271
1336
|
}
|
|
1272
1337
|
__updateStrokeBounds() { }
|
|
1273
1338
|
__updateRenderBounds() {
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
copy(bounds, renderBounds);
|
|
1339
|
+
let isOverflow;
|
|
1340
|
+
const { renderBounds } = this.__layout;
|
|
1341
|
+
if (this.children.length) {
|
|
1278
1342
|
super.__updateRenderBounds();
|
|
1279
|
-
|
|
1343
|
+
copy(childrenRenderBounds, renderBounds);
|
|
1344
|
+
this.__updateRectRenderBounds();
|
|
1345
|
+
isOverflow = !includes$1(renderBounds, childrenRenderBounds) || undefined;
|
|
1346
|
+
}
|
|
1347
|
+
else {
|
|
1348
|
+
this.__updateRectRenderBounds();
|
|
1280
1349
|
}
|
|
1350
|
+
this.isOverflow !== isOverflow && (this.isOverflow = isOverflow);
|
|
1351
|
+
if (isOverflow && !(this.__.__drawAfterFill = this.__.overflow === 'hide'))
|
|
1352
|
+
add(renderBounds, childrenRenderBounds);
|
|
1281
1353
|
}
|
|
1282
1354
|
__updateRectRenderBounds() { }
|
|
1283
1355
|
__updateRectChange() { }
|
|
@@ -1293,16 +1365,27 @@ let Box = class Box extends Group {
|
|
|
1293
1365
|
}
|
|
1294
1366
|
else {
|
|
1295
1367
|
this.__renderRect(canvas, options);
|
|
1296
|
-
this.
|
|
1368
|
+
if (this.children.length)
|
|
1369
|
+
this.__renderGroup(canvas, options);
|
|
1297
1370
|
}
|
|
1298
1371
|
}
|
|
1299
1372
|
__drawAfterFill(canvas, options) {
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1373
|
+
const { length } = this.children;
|
|
1374
|
+
if (this.isOverflow) {
|
|
1375
|
+
canvas.save();
|
|
1376
|
+
canvas.clip();
|
|
1377
|
+
if (length)
|
|
1378
|
+
this.__renderGroup(canvas, options);
|
|
1379
|
+
canvas.restore();
|
|
1380
|
+
}
|
|
1381
|
+
else {
|
|
1382
|
+
if (length)
|
|
1383
|
+
this.__renderGroup(canvas, options);
|
|
1384
|
+
}
|
|
1385
|
+
if (this.__.stroke && length) {
|
|
1386
|
+
canvas.setWorld(this.__nowWorld);
|
|
1305
1387
|
this.__drawRenderPath(canvas);
|
|
1388
|
+
}
|
|
1306
1389
|
}
|
|
1307
1390
|
};
|
|
1308
1391
|
__decorate([
|
|
@@ -1440,9 +1523,10 @@ let Line = class Line extends UI {
|
|
|
1440
1523
|
super(data);
|
|
1441
1524
|
}
|
|
1442
1525
|
__updatePath() {
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
|
|
1526
|
+
const data = this.__;
|
|
1527
|
+
const path = data.path = [];
|
|
1528
|
+
if (data.points) {
|
|
1529
|
+
drawPoints$1(path, data.points, false, data.closed);
|
|
1446
1530
|
}
|
|
1447
1531
|
else {
|
|
1448
1532
|
moveTo$2(path, 0, 0);
|
|
@@ -1677,7 +1761,7 @@ Canvas = __decorate([
|
|
|
1677
1761
|
registerUI()
|
|
1678
1762
|
], Canvas);
|
|
1679
1763
|
|
|
1680
|
-
const { copyAndSpread, includes, spread, setList } = BoundsHelper;
|
|
1764
|
+
const { copyAndSpread, includes, isSame, spread, setList } = BoundsHelper;
|
|
1681
1765
|
let Text = class Text extends UI {
|
|
1682
1766
|
get __tag() { return 'Text'; }
|
|
1683
1767
|
get editInner() { return 'TextEditor'; }
|
|
@@ -1750,7 +1834,7 @@ let Text = class Text extends UI {
|
|
|
1750
1834
|
if (italic)
|
|
1751
1835
|
b.width += fontSize * 0.16;
|
|
1752
1836
|
const contentBounds = includes(b, bounds) ? b : bounds;
|
|
1753
|
-
if (contentBounds
|
|
1837
|
+
if (!isSame(contentBounds, layout.contentBounds)) {
|
|
1754
1838
|
layout.contentBounds = contentBounds;
|
|
1755
1839
|
layout.renderChanged = true;
|
|
1756
1840
|
setList(data.__textBoxBounds = {}, [b, bounds]);
|
|
@@ -1778,9 +1862,6 @@ __decorate([
|
|
|
1778
1862
|
__decorate([
|
|
1779
1863
|
boundsType(0)
|
|
1780
1864
|
], Text.prototype, "height", void 0);
|
|
1781
|
-
__decorate([
|
|
1782
|
-
boundsType(0)
|
|
1783
|
-
], Text.prototype, "padding", void 0);
|
|
1784
1865
|
__decorate([
|
|
1785
1866
|
surfaceType('#000000')
|
|
1786
1867
|
], Text.prototype, "fill", void 0);
|
|
@@ -1815,7 +1896,7 @@ __decorate([
|
|
|
1815
1896
|
boundsType(0)
|
|
1816
1897
|
], Text.prototype, "letterSpacing", void 0);
|
|
1817
1898
|
__decorate([
|
|
1818
|
-
boundsType({ type: 'percent', value:
|
|
1899
|
+
boundsType({ type: 'percent', value: 1.5 })
|
|
1819
1900
|
], Text.prototype, "lineHeight", void 0);
|
|
1820
1901
|
__decorate([
|
|
1821
1902
|
boundsType(0)
|
|
@@ -1909,6 +1990,4 @@ function penPathType() {
|
|
|
1909
1990
|
};
|
|
1910
1991
|
}
|
|
1911
1992
|
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
export { Box, BoxData, Canvas, CanvasData, ColorConvert, Effect, Ellipse, EllipseData, Export, Frame, FrameData, Group, GroupData, Image, ImageData, Leafer, LeaferData, Line, LineData, Paint, PaintGradient, PaintImage, Path, PathArrow, PathData, Pen, PenData, Polygon, PolygonData, Rect, RectData, RectRender, Star, StarData, State, Text, TextConvert, TextData, UI, UIBounds, UIData, UIRender, UnitConvert, arrowType, effectType, resizeType, stateType, version, zoomLayerType };
|
|
1993
|
+
export { Box, BoxData, Canvas, CanvasData, ColorConvert, Effect, Ellipse, EllipseData, Export, Frame, FrameData, Group, GroupData, Image, ImageData, Leafer, LeaferData, Line, LineData, Paint, PaintGradient, PaintImage, Path, PathArrow, PathData, Pen, PenData, Polygon, PolygonData, Rect, RectData, RectRender, Star, StarData, State, Text, TextConvert, TextData, UI, UIBounds, UIData, UIRender, UnitConvert, arrowType, effectType, resizeType, stateType, zoomLayerType };
|