@leafer-ui/draw 1.9.3 → 1.9.5
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 +32 -87
- package/lib/draw.esm.js +33 -88
- package/lib/draw.esm.min.js +1 -1
- package/lib/draw.esm.min.js.map +1 -1
- package/lib/draw.min.cjs +1 -1
- package/lib/draw.min.cjs.map +1 -1
- package/package.json +6 -6
package/lib/draw.cjs
CHANGED
|
@@ -304,7 +304,11 @@ class LeaferData extends GroupData {
|
|
|
304
304
|
|
|
305
305
|
class FrameData extends BoxData {}
|
|
306
306
|
|
|
307
|
-
class LineData extends UIData {
|
|
307
|
+
class LineData extends UIData {
|
|
308
|
+
get __usePathBox() {
|
|
309
|
+
return this.points || this.__pathInputed;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
308
312
|
|
|
309
313
|
class RectData extends UIData {
|
|
310
314
|
get __boxStroke() {
|
|
@@ -318,7 +322,7 @@ class EllipseData extends UIData {
|
|
|
318
322
|
}
|
|
319
323
|
}
|
|
320
324
|
|
|
321
|
-
class PolygonData extends
|
|
325
|
+
class PolygonData extends LineData {}
|
|
322
326
|
|
|
323
327
|
class StarData extends UIData {}
|
|
324
328
|
|
|
@@ -628,20 +632,9 @@ exports.UI = UI_1 = class UI extends core.Leaf {
|
|
|
628
632
|
if (!path) this.__drawPathByBox(core.pen);
|
|
629
633
|
return core.pen;
|
|
630
634
|
}
|
|
631
|
-
constructor(data) {
|
|
632
|
-
super(data);
|
|
633
|
-
}
|
|
634
635
|
reset(_data) {}
|
|
635
|
-
set(data,
|
|
636
|
-
if (data)
|
|
637
|
-
if (transition) {
|
|
638
|
-
if (transition === "temp") {
|
|
639
|
-
this.lockNormalStyle = true;
|
|
640
|
-
Object.assign(this, data);
|
|
641
|
-
this.lockNormalStyle = false;
|
|
642
|
-
} else this.animate(data, transition);
|
|
643
|
-
} else Object.assign(this, data);
|
|
644
|
-
}
|
|
636
|
+
set(data, _transition) {
|
|
637
|
+
if (data) Object.assign(this, data);
|
|
645
638
|
}
|
|
646
639
|
get(name) {
|
|
647
640
|
return core.isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -687,7 +680,7 @@ exports.UI = UI_1 = class UI extends core.Leaf {
|
|
|
687
680
|
const data = this.__;
|
|
688
681
|
if (data.path) {
|
|
689
682
|
data.__pathForRender = data.cornerRadius ? core.PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
690
|
-
if (data.__useArrow) PathArrow.addArrows(this
|
|
683
|
+
if (data.__useArrow) PathArrow.addArrows(this);
|
|
691
684
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
692
685
|
}
|
|
693
686
|
__drawRenderPath(canvas) {
|
|
@@ -711,7 +704,8 @@ exports.UI = UI_1 = class UI extends core.Leaf {
|
|
|
711
704
|
drawImagePlaceholder(canvas, _image) {
|
|
712
705
|
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
713
706
|
}
|
|
714
|
-
animate(
|
|
707
|
+
animate(keyframe, _options, _type, _isTemp) {
|
|
708
|
+
this.set(keyframe);
|
|
715
709
|
return core.Plugin.need("animate");
|
|
716
710
|
}
|
|
717
711
|
killAnimate(_type, _nextStyle) {}
|
|
@@ -900,9 +894,6 @@ exports.Group = class Group extends exports.UI {
|
|
|
900
894
|
get isBranch() {
|
|
901
895
|
return true;
|
|
902
896
|
}
|
|
903
|
-
constructor(data) {
|
|
904
|
-
super(data);
|
|
905
|
-
}
|
|
906
897
|
reset(data) {
|
|
907
898
|
this.__setBranch();
|
|
908
899
|
super.reset(data);
|
|
@@ -1027,7 +1018,7 @@ exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
|
|
|
1027
1018
|
const canvas = this.canvas = core.Creator.canvas(config);
|
|
1028
1019
|
this.__controllers.push(this.renderer = core.Creator.renderer(this, canvas, config), this.watcher = core.Creator.watcher(this, config), this.layouter = core.Creator.layouter(this, config));
|
|
1029
1020
|
if (this.isApp) this.__setApp();
|
|
1030
|
-
this.__checkAutoLayout(
|
|
1021
|
+
this.__checkAutoLayout();
|
|
1031
1022
|
this.view = canvas.view;
|
|
1032
1023
|
if (!parentApp) {
|
|
1033
1024
|
this.selector = core.Creator.selector(this);
|
|
@@ -1126,7 +1117,8 @@ exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
|
|
|
1126
1117
|
this.leafer = leafer;
|
|
1127
1118
|
this.__level = 1;
|
|
1128
1119
|
}
|
|
1129
|
-
__checkAutoLayout(
|
|
1120
|
+
__checkAutoLayout() {
|
|
1121
|
+
const {config: config, parentApp: parentApp} = this;
|
|
1130
1122
|
if (!parentApp) {
|
|
1131
1123
|
if (!config.width || !config.height) this.autoLayout = new core.AutoBounds(config);
|
|
1132
1124
|
this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this));
|
|
@@ -1152,9 +1144,10 @@ exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
|
|
|
1152
1144
|
return super.__getAttr(attrName);
|
|
1153
1145
|
}
|
|
1154
1146
|
__changeCanvasSize(attrName, newValue) {
|
|
1155
|
-
const
|
|
1156
|
-
data
|
|
1157
|
-
|
|
1147
|
+
const {config: config, canvas: canvas} = this;
|
|
1148
|
+
const data = core.DataHelper.copyAttrs({}, canvas, core.canvasSizeAttrs);
|
|
1149
|
+
data[attrName] = config[attrName] = newValue;
|
|
1150
|
+
config.width && config.height ? canvas.stopAutoLayout() : this.__checkAutoLayout();
|
|
1158
1151
|
this.__doResize(data);
|
|
1159
1152
|
}
|
|
1160
1153
|
__changeFill(newValue) {
|
|
@@ -1301,9 +1294,9 @@ exports.Leafer = Leafer_1 = class Leafer extends exports.Group {
|
|
|
1301
1294
|
if (!this.parent) {
|
|
1302
1295
|
if (this.selector) this.selector.destroy();
|
|
1303
1296
|
if (this.hitCanvasManager) this.hitCanvasManager.destroy();
|
|
1304
|
-
this.canvasManager.destroy();
|
|
1297
|
+
if (this.canvasManager) this.canvasManager.destroy();
|
|
1305
1298
|
}
|
|
1306
|
-
this.canvas.destroy();
|
|
1299
|
+
if (this.canvas) this.canvas.destroy();
|
|
1307
1300
|
this.config.view = this.view = this.parentApp = null;
|
|
1308
1301
|
if (this.userConfig) this.userConfig.view = null;
|
|
1309
1302
|
super.destroy();
|
|
@@ -1331,9 +1324,6 @@ exports.Rect = class Rect extends exports.UI {
|
|
|
1331
1324
|
get __tag() {
|
|
1332
1325
|
return "Rect";
|
|
1333
1326
|
}
|
|
1334
|
-
constructor(data) {
|
|
1335
|
-
super(data);
|
|
1336
|
-
}
|
|
1337
1327
|
};
|
|
1338
1328
|
|
|
1339
1329
|
__decorate([ core.dataProcessor(RectData) ], exports.Rect.prototype, "__", void 0);
|
|
@@ -1387,29 +1377,24 @@ exports.Box = class Box extends exports.Group {
|
|
|
1387
1377
|
}
|
|
1388
1378
|
__updateStrokeBounds() {}
|
|
1389
1379
|
__updateRenderBounds() {
|
|
1390
|
-
let isOverflow;
|
|
1380
|
+
let isOverflow, isScrollMode;
|
|
1391
1381
|
if (this.children.length) {
|
|
1392
|
-
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
1382
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
|
|
1393
1383
|
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = core.getBoundsData());
|
|
1394
1384
|
super.__updateRenderBounds(childrenRenderBounds);
|
|
1395
|
-
if (
|
|
1385
|
+
if (isScrollMode = overflow.includes("scroll")) {
|
|
1396
1386
|
add(childrenRenderBounds, boxBounds);
|
|
1397
1387
|
scroll(childrenRenderBounds, data);
|
|
1398
1388
|
}
|
|
1399
1389
|
this.__updateRectRenderBounds();
|
|
1400
1390
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
1401
|
-
if (isOverflow &&
|
|
1391
|
+
if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
1402
1392
|
} else this.__updateRectRenderBounds();
|
|
1403
1393
|
core.DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
1404
|
-
this.__checkScroll();
|
|
1394
|
+
this.__checkScroll(isScrollMode);
|
|
1405
1395
|
}
|
|
1406
1396
|
__updateRectRenderBounds() {}
|
|
1407
|
-
|
|
1408
|
-
if (this.hasScroller) this.__updateScroll();
|
|
1409
|
-
super.__updateWorldBounds();
|
|
1410
|
-
}
|
|
1411
|
-
__checkScroll() {}
|
|
1412
|
-
__updateScroll() {}
|
|
1397
|
+
__checkScroll(_isScrollMode) {}
|
|
1413
1398
|
__updateRectChange() {}
|
|
1414
1399
|
__updateChange() {
|
|
1415
1400
|
super.__updateChange();
|
|
@@ -1470,9 +1455,6 @@ exports.Frame = class Frame extends exports.Box {
|
|
|
1470
1455
|
get isFrame() {
|
|
1471
1456
|
return true;
|
|
1472
1457
|
}
|
|
1473
|
-
constructor(data) {
|
|
1474
|
-
super(data);
|
|
1475
|
-
}
|
|
1476
1458
|
};
|
|
1477
1459
|
|
|
1478
1460
|
__decorate([ core.dataProcessor(FrameData) ], exports.Frame.prototype, "__", void 0);
|
|
@@ -1489,9 +1471,6 @@ exports.Ellipse = class Ellipse extends exports.UI {
|
|
|
1489
1471
|
get __tag() {
|
|
1490
1472
|
return "Ellipse";
|
|
1491
1473
|
}
|
|
1492
|
-
constructor(data) {
|
|
1493
|
-
super(data);
|
|
1494
|
-
}
|
|
1495
1474
|
__updatePath() {
|
|
1496
1475
|
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
|
|
1497
1476
|
const rx = width / 2, ry = height / 2;
|
|
@@ -1535,8 +1514,6 @@ const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = core.Path
|
|
|
1535
1514
|
|
|
1536
1515
|
const {rotate: rotate, getAngle: getAngle, getDistance: getDistance, defaultPoint: defaultPoint} = core.PointHelper;
|
|
1537
1516
|
|
|
1538
|
-
const {toBounds: toBounds} = core.PathBounds;
|
|
1539
|
-
|
|
1540
1517
|
exports.Line = class Line extends exports.UI {
|
|
1541
1518
|
get __tag() {
|
|
1542
1519
|
return "Line";
|
|
@@ -1553,31 +1530,16 @@ exports.Line = class Line extends exports.UI {
|
|
|
1553
1530
|
this.rotation = getAngle(defaultPoint, value);
|
|
1554
1531
|
if (this.height) this.height = 0;
|
|
1555
1532
|
}
|
|
1556
|
-
constructor(data) {
|
|
1557
|
-
super(data);
|
|
1558
|
-
}
|
|
1559
1533
|
__updatePath() {
|
|
1560
1534
|
const data = this.__;
|
|
1561
1535
|
const path = data.path = [];
|
|
1562
1536
|
if (data.points) {
|
|
1563
|
-
drawPoints$1(path, data.points,
|
|
1537
|
+
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
1564
1538
|
} else {
|
|
1565
1539
|
moveTo$2(path, 0, 0);
|
|
1566
1540
|
lineTo$2(path, this.width, 0);
|
|
1567
1541
|
}
|
|
1568
1542
|
}
|
|
1569
|
-
__updateRenderPath() {
|
|
1570
|
-
const data = this.__;
|
|
1571
|
-
if (!this.pathInputed && data.points && data.curve) {
|
|
1572
|
-
drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
|
|
1573
|
-
if (data.__useArrow) PathArrow.addArrows(this, false);
|
|
1574
|
-
} else super.__updateRenderPath();
|
|
1575
|
-
}
|
|
1576
|
-
__updateBoxBounds() {
|
|
1577
|
-
if (this.points) {
|
|
1578
|
-
toBounds(this.__.__pathForRender, this.__layout.boxBounds);
|
|
1579
|
-
} else super.__updateBoxBounds();
|
|
1580
|
-
}
|
|
1581
1543
|
};
|
|
1582
1544
|
|
|
1583
1545
|
__decorate([ core.dataProcessor(LineData) ], exports.Line.prototype, "__", void 0);
|
|
@@ -1604,15 +1566,13 @@ exports.Polygon = class Polygon extends exports.UI {
|
|
|
1604
1566
|
get __tag() {
|
|
1605
1567
|
return "Polygon";
|
|
1606
1568
|
}
|
|
1607
|
-
constructor(data) {
|
|
1608
|
-
super(data);
|
|
1609
|
-
}
|
|
1610
1569
|
__updatePath() {
|
|
1611
|
-
const
|
|
1612
|
-
|
|
1613
|
-
|
|
1570
|
+
const data = this.__;
|
|
1571
|
+
const path = data.path = [];
|
|
1572
|
+
if (data.points) {
|
|
1573
|
+
drawPoints(path, data.points, data.curve, true);
|
|
1614
1574
|
} else {
|
|
1615
|
-
const {width: width, height: height, sides: sides} =
|
|
1575
|
+
const {width: width, height: height, sides: sides} = data;
|
|
1616
1576
|
const rx = width / 2, ry = height / 2;
|
|
1617
1577
|
moveTo$1(path, rx, 0);
|
|
1618
1578
|
for (let i = 1; i < sides; i++) {
|
|
@@ -1647,9 +1607,6 @@ exports.Star = class Star extends exports.UI {
|
|
|
1647
1607
|
get __tag() {
|
|
1648
1608
|
return "Star";
|
|
1649
1609
|
}
|
|
1650
|
-
constructor(data) {
|
|
1651
|
-
super(data);
|
|
1652
|
-
}
|
|
1653
1610
|
__updatePath() {
|
|
1654
1611
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
1655
1612
|
const rx = width / 2, ry = height / 2;
|
|
@@ -1682,9 +1639,6 @@ exports.Image = class Image extends exports.Rect {
|
|
|
1682
1639
|
const {fill: fill} = this.__;
|
|
1683
1640
|
return core.isArray(fill) && fill[0].image;
|
|
1684
1641
|
}
|
|
1685
|
-
constructor(data) {
|
|
1686
|
-
super(data);
|
|
1687
|
-
}
|
|
1688
1642
|
};
|
|
1689
1643
|
|
|
1690
1644
|
__decorate([ core.dataProcessor(ImageData) ], exports.Image.prototype, "__", void 0);
|
|
@@ -1784,9 +1738,6 @@ exports.Text = class Text extends exports.UI {
|
|
|
1784
1738
|
this.updateLayout();
|
|
1785
1739
|
return this.__.__textDrawData;
|
|
1786
1740
|
}
|
|
1787
|
-
constructor(data) {
|
|
1788
|
-
super(data);
|
|
1789
|
-
}
|
|
1790
1741
|
__updateTextDrawData() {
|
|
1791
1742
|
const data = this.__;
|
|
1792
1743
|
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
|
|
@@ -1919,9 +1870,6 @@ exports.Path = class Path extends exports.UI {
|
|
|
1919
1870
|
get __tag() {
|
|
1920
1871
|
return "Path";
|
|
1921
1872
|
}
|
|
1922
|
-
constructor(data) {
|
|
1923
|
-
super(data);
|
|
1924
|
-
}
|
|
1925
1873
|
};
|
|
1926
1874
|
|
|
1927
1875
|
__decorate([ core.dataProcessor(PathData) ], exports.Path.prototype, "__", void 0);
|
|
@@ -1934,9 +1882,6 @@ exports.Pen = class Pen extends exports.Group {
|
|
|
1934
1882
|
get __tag() {
|
|
1935
1883
|
return "Pen";
|
|
1936
1884
|
}
|
|
1937
|
-
constructor(data) {
|
|
1938
|
-
super(data);
|
|
1939
|
-
}
|
|
1940
1885
|
setStyle(data) {
|
|
1941
1886
|
const path = this.pathElement = new exports.Path(data);
|
|
1942
1887
|
this.pathStyle = data;
|
package/lib/draw.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineKey, decorateLeafAttr, attr, createDescriptor, Plugin, isObject, PathConvert, DataHelper, Debug, LeafData, isString, isUndefined, isArray, canvasSizeAttrs, UICreator, MathHelper, dataProcessor, dataType, surfaceType, opacityType, visibleType, sortType, maskType, eraserType, positionType, boundsType, scaleType, rotationType, scrollType, autoLayoutType, naturalBoundsType, affectRenderBoundsType, pathInputType, pathType, hitType, strokeType, cursorType, rewrite, Leaf, useModule, rewriteAble, pen, PathCorner, PathDrawer, isNumber, registerUI, Branch, LeafList, Resource, getBoundsData, Creator, CanvasManager, WaitHelper, LeaferEvent, Bounds, ResizeEvent, AutoBounds, Run, LayoutEvent, RenderEvent, WatchEvent, ImageManager, BoundsHelper, PathCommandDataHelper, Platform, PointHelper,
|
|
1
|
+
import { defineKey, decorateLeafAttr, attr, createDescriptor, Plugin, isObject, PathConvert, DataHelper, Debug, LeafData, isString, isUndefined, isArray, canvasSizeAttrs, UICreator, MathHelper, dataProcessor, dataType, surfaceType, opacityType, visibleType, sortType, maskType, eraserType, positionType, boundsType, scaleType, rotationType, scrollType, autoLayoutType, naturalBoundsType, affectRenderBoundsType, pathInputType, pathType, hitType, strokeType, cursorType, rewrite, Leaf, useModule, rewriteAble, pen, PathCorner, PathDrawer, isNumber, registerUI, Branch, LeafList, Resource, getBoundsData, Creator, CanvasManager, WaitHelper, LeaferEvent, Bounds, ResizeEvent, AutoBounds, Run, LayoutEvent, RenderEvent, WatchEvent, ImageManager, BoundsHelper, PathCommandDataHelper, Platform, PointHelper, affectStrokeBoundsType, getPointData, LeaferImage, ImageEvent, Matrix, PathCreator } from "@leafer/core";
|
|
2
2
|
|
|
3
3
|
export * from "@leafer/core";
|
|
4
4
|
|
|
@@ -304,7 +304,11 @@ class LeaferData extends GroupData {
|
|
|
304
304
|
|
|
305
305
|
class FrameData extends BoxData {}
|
|
306
306
|
|
|
307
|
-
class LineData extends UIData {
|
|
307
|
+
class LineData extends UIData {
|
|
308
|
+
get __usePathBox() {
|
|
309
|
+
return this.points || this.__pathInputed;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
308
312
|
|
|
309
313
|
class RectData extends UIData {
|
|
310
314
|
get __boxStroke() {
|
|
@@ -318,7 +322,7 @@ class EllipseData extends UIData {
|
|
|
318
322
|
}
|
|
319
323
|
}
|
|
320
324
|
|
|
321
|
-
class PolygonData extends
|
|
325
|
+
class PolygonData extends LineData {}
|
|
322
326
|
|
|
323
327
|
class StarData extends UIData {}
|
|
324
328
|
|
|
@@ -628,20 +632,9 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
628
632
|
if (!path) this.__drawPathByBox(pen);
|
|
629
633
|
return pen;
|
|
630
634
|
}
|
|
631
|
-
constructor(data) {
|
|
632
|
-
super(data);
|
|
633
|
-
}
|
|
634
635
|
reset(_data) {}
|
|
635
|
-
set(data,
|
|
636
|
-
if (data)
|
|
637
|
-
if (transition) {
|
|
638
|
-
if (transition === "temp") {
|
|
639
|
-
this.lockNormalStyle = true;
|
|
640
|
-
Object.assign(this, data);
|
|
641
|
-
this.lockNormalStyle = false;
|
|
642
|
-
} else this.animate(data, transition);
|
|
643
|
-
} else Object.assign(this, data);
|
|
644
|
-
}
|
|
636
|
+
set(data, _transition) {
|
|
637
|
+
if (data) Object.assign(this, data);
|
|
645
638
|
}
|
|
646
639
|
get(name) {
|
|
647
640
|
return isString(name) ? this.__.__getInput(name) : this.__.__getInputData(name);
|
|
@@ -687,7 +680,7 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
687
680
|
const data = this.__;
|
|
688
681
|
if (data.path) {
|
|
689
682
|
data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path;
|
|
690
|
-
if (data.__useArrow) PathArrow.addArrows(this
|
|
683
|
+
if (data.__useArrow) PathArrow.addArrows(this);
|
|
691
684
|
} else data.__pathForRender && (data.__pathForRender = undefined);
|
|
692
685
|
}
|
|
693
686
|
__drawRenderPath(canvas) {
|
|
@@ -711,7 +704,8 @@ let UI = UI_1 = class UI extends Leaf {
|
|
|
711
704
|
drawImagePlaceholder(canvas, _image) {
|
|
712
705
|
Paint.fill(this.__.placeholderColor, this, canvas);
|
|
713
706
|
}
|
|
714
|
-
animate(
|
|
707
|
+
animate(keyframe, _options, _type, _isTemp) {
|
|
708
|
+
this.set(keyframe);
|
|
715
709
|
return Plugin.need("animate");
|
|
716
710
|
}
|
|
717
711
|
killAnimate(_type, _nextStyle) {}
|
|
@@ -900,9 +894,6 @@ let Group = class Group extends UI {
|
|
|
900
894
|
get isBranch() {
|
|
901
895
|
return true;
|
|
902
896
|
}
|
|
903
|
-
constructor(data) {
|
|
904
|
-
super(data);
|
|
905
|
-
}
|
|
906
897
|
reset(data) {
|
|
907
898
|
this.__setBranch();
|
|
908
899
|
super.reset(data);
|
|
@@ -1027,7 +1018,7 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
1027
1018
|
const canvas = this.canvas = Creator.canvas(config);
|
|
1028
1019
|
this.__controllers.push(this.renderer = Creator.renderer(this, canvas, config), this.watcher = Creator.watcher(this, config), this.layouter = Creator.layouter(this, config));
|
|
1029
1020
|
if (this.isApp) this.__setApp();
|
|
1030
|
-
this.__checkAutoLayout(
|
|
1021
|
+
this.__checkAutoLayout();
|
|
1031
1022
|
this.view = canvas.view;
|
|
1032
1023
|
if (!parentApp) {
|
|
1033
1024
|
this.selector = Creator.selector(this);
|
|
@@ -1126,7 +1117,8 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
1126
1117
|
this.leafer = leafer;
|
|
1127
1118
|
this.__level = 1;
|
|
1128
1119
|
}
|
|
1129
|
-
__checkAutoLayout(
|
|
1120
|
+
__checkAutoLayout() {
|
|
1121
|
+
const {config: config, parentApp: parentApp} = this;
|
|
1130
1122
|
if (!parentApp) {
|
|
1131
1123
|
if (!config.width || !config.height) this.autoLayout = new AutoBounds(config);
|
|
1132
1124
|
this.canvas.startAutoLayout(this.autoLayout, this.__onResize.bind(this));
|
|
@@ -1152,9 +1144,10 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
1152
1144
|
return super.__getAttr(attrName);
|
|
1153
1145
|
}
|
|
1154
1146
|
__changeCanvasSize(attrName, newValue) {
|
|
1155
|
-
const
|
|
1156
|
-
data
|
|
1157
|
-
|
|
1147
|
+
const {config: config, canvas: canvas} = this;
|
|
1148
|
+
const data = DataHelper.copyAttrs({}, canvas, canvasSizeAttrs);
|
|
1149
|
+
data[attrName] = config[attrName] = newValue;
|
|
1150
|
+
config.width && config.height ? canvas.stopAutoLayout() : this.__checkAutoLayout();
|
|
1158
1151
|
this.__doResize(data);
|
|
1159
1152
|
}
|
|
1160
1153
|
__changeFill(newValue) {
|
|
@@ -1301,9 +1294,9 @@ let Leafer = Leafer_1 = class Leafer extends Group {
|
|
|
1301
1294
|
if (!this.parent) {
|
|
1302
1295
|
if (this.selector) this.selector.destroy();
|
|
1303
1296
|
if (this.hitCanvasManager) this.hitCanvasManager.destroy();
|
|
1304
|
-
this.canvasManager.destroy();
|
|
1297
|
+
if (this.canvasManager) this.canvasManager.destroy();
|
|
1305
1298
|
}
|
|
1306
|
-
this.canvas.destroy();
|
|
1299
|
+
if (this.canvas) this.canvas.destroy();
|
|
1307
1300
|
this.config.view = this.view = this.parentApp = null;
|
|
1308
1301
|
if (this.userConfig) this.userConfig.view = null;
|
|
1309
1302
|
super.destroy();
|
|
@@ -1331,9 +1324,6 @@ let Rect = class Rect extends UI {
|
|
|
1331
1324
|
get __tag() {
|
|
1332
1325
|
return "Rect";
|
|
1333
1326
|
}
|
|
1334
|
-
constructor(data) {
|
|
1335
|
-
super(data);
|
|
1336
|
-
}
|
|
1337
1327
|
};
|
|
1338
1328
|
|
|
1339
1329
|
__decorate([ dataProcessor(RectData) ], Rect.prototype, "__", void 0);
|
|
@@ -1387,29 +1377,24 @@ let Box = class Box extends Group {
|
|
|
1387
1377
|
}
|
|
1388
1378
|
__updateStrokeBounds() {}
|
|
1389
1379
|
__updateRenderBounds() {
|
|
1390
|
-
let isOverflow;
|
|
1380
|
+
let isOverflow, isScrollMode;
|
|
1391
1381
|
if (this.children.length) {
|
|
1392
|
-
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout;
|
|
1382
|
+
const data = this.__, layout = this.__layout, {renderBounds: renderBounds, boxBounds: boxBounds} = layout, {overflow: overflow} = data;
|
|
1393
1383
|
const childrenRenderBounds = layout.childrenRenderBounds || (layout.childrenRenderBounds = getBoundsData());
|
|
1394
1384
|
super.__updateRenderBounds(childrenRenderBounds);
|
|
1395
|
-
if (
|
|
1385
|
+
if (isScrollMode = overflow.includes("scroll")) {
|
|
1396
1386
|
add(childrenRenderBounds, boxBounds);
|
|
1397
1387
|
scroll(childrenRenderBounds, data);
|
|
1398
1388
|
}
|
|
1399
1389
|
this.__updateRectRenderBounds();
|
|
1400
1390
|
isOverflow = !includes$1(boxBounds, childrenRenderBounds);
|
|
1401
|
-
if (isOverflow &&
|
|
1391
|
+
if (isOverflow && overflow === "show") add(renderBounds, childrenRenderBounds);
|
|
1402
1392
|
} else this.__updateRectRenderBounds();
|
|
1403
1393
|
DataHelper.stintSet(this, "isOverflow", isOverflow);
|
|
1404
|
-
this.__checkScroll();
|
|
1394
|
+
this.__checkScroll(isScrollMode);
|
|
1405
1395
|
}
|
|
1406
1396
|
__updateRectRenderBounds() {}
|
|
1407
|
-
|
|
1408
|
-
if (this.hasScroller) this.__updateScroll();
|
|
1409
|
-
super.__updateWorldBounds();
|
|
1410
|
-
}
|
|
1411
|
-
__checkScroll() {}
|
|
1412
|
-
__updateScroll() {}
|
|
1397
|
+
__checkScroll(_isScrollMode) {}
|
|
1413
1398
|
__updateRectChange() {}
|
|
1414
1399
|
__updateChange() {
|
|
1415
1400
|
super.__updateChange();
|
|
@@ -1470,9 +1455,6 @@ let Frame = class Frame extends Box {
|
|
|
1470
1455
|
get isFrame() {
|
|
1471
1456
|
return true;
|
|
1472
1457
|
}
|
|
1473
|
-
constructor(data) {
|
|
1474
|
-
super(data);
|
|
1475
|
-
}
|
|
1476
1458
|
};
|
|
1477
1459
|
|
|
1478
1460
|
__decorate([ dataProcessor(FrameData) ], Frame.prototype, "__", void 0);
|
|
@@ -1489,9 +1471,6 @@ let Ellipse = class Ellipse extends UI {
|
|
|
1489
1471
|
get __tag() {
|
|
1490
1472
|
return "Ellipse";
|
|
1491
1473
|
}
|
|
1492
|
-
constructor(data) {
|
|
1493
|
-
super(data);
|
|
1494
|
-
}
|
|
1495
1474
|
__updatePath() {
|
|
1496
1475
|
const {width: width, height: height, innerRadius: innerRadius, startAngle: startAngle, endAngle: endAngle} = this.__;
|
|
1497
1476
|
const rx = width / 2, ry = height / 2;
|
|
@@ -1535,8 +1514,6 @@ const {moveTo: moveTo$2, lineTo: lineTo$2, drawPoints: drawPoints$1} = PathComma
|
|
|
1535
1514
|
|
|
1536
1515
|
const {rotate: rotate, getAngle: getAngle, getDistance: getDistance, defaultPoint: defaultPoint} = PointHelper;
|
|
1537
1516
|
|
|
1538
|
-
const {toBounds: toBounds} = PathBounds;
|
|
1539
|
-
|
|
1540
1517
|
let Line = class Line extends UI {
|
|
1541
1518
|
get __tag() {
|
|
1542
1519
|
return "Line";
|
|
@@ -1553,31 +1530,16 @@ let Line = class Line extends UI {
|
|
|
1553
1530
|
this.rotation = getAngle(defaultPoint, value);
|
|
1554
1531
|
if (this.height) this.height = 0;
|
|
1555
1532
|
}
|
|
1556
|
-
constructor(data) {
|
|
1557
|
-
super(data);
|
|
1558
|
-
}
|
|
1559
1533
|
__updatePath() {
|
|
1560
1534
|
const data = this.__;
|
|
1561
1535
|
const path = data.path = [];
|
|
1562
1536
|
if (data.points) {
|
|
1563
|
-
drawPoints$1(path, data.points,
|
|
1537
|
+
drawPoints$1(path, data.points, data.curve, data.closed);
|
|
1564
1538
|
} else {
|
|
1565
1539
|
moveTo$2(path, 0, 0);
|
|
1566
1540
|
lineTo$2(path, this.width, 0);
|
|
1567
1541
|
}
|
|
1568
1542
|
}
|
|
1569
|
-
__updateRenderPath() {
|
|
1570
|
-
const data = this.__;
|
|
1571
|
-
if (!this.pathInputed && data.points && data.curve) {
|
|
1572
|
-
drawPoints$1(data.__pathForRender = [], data.points, data.curve, data.closed);
|
|
1573
|
-
if (data.__useArrow) PathArrow.addArrows(this, false);
|
|
1574
|
-
} else super.__updateRenderPath();
|
|
1575
|
-
}
|
|
1576
|
-
__updateBoxBounds() {
|
|
1577
|
-
if (this.points) {
|
|
1578
|
-
toBounds(this.__.__pathForRender, this.__layout.boxBounds);
|
|
1579
|
-
} else super.__updateBoxBounds();
|
|
1580
|
-
}
|
|
1581
1543
|
};
|
|
1582
1544
|
|
|
1583
1545
|
__decorate([ dataProcessor(LineData) ], Line.prototype, "__", void 0);
|
|
@@ -1604,15 +1566,13 @@ let Polygon = class Polygon extends UI {
|
|
|
1604
1566
|
get __tag() {
|
|
1605
1567
|
return "Polygon";
|
|
1606
1568
|
}
|
|
1607
|
-
constructor(data) {
|
|
1608
|
-
super(data);
|
|
1609
|
-
}
|
|
1610
1569
|
__updatePath() {
|
|
1611
|
-
const
|
|
1612
|
-
|
|
1613
|
-
|
|
1570
|
+
const data = this.__;
|
|
1571
|
+
const path = data.path = [];
|
|
1572
|
+
if (data.points) {
|
|
1573
|
+
drawPoints(path, data.points, data.curve, true);
|
|
1614
1574
|
} else {
|
|
1615
|
-
const {width: width, height: height, sides: sides} =
|
|
1575
|
+
const {width: width, height: height, sides: sides} = data;
|
|
1616
1576
|
const rx = width / 2, ry = height / 2;
|
|
1617
1577
|
moveTo$1(path, rx, 0);
|
|
1618
1578
|
for (let i = 1; i < sides; i++) {
|
|
@@ -1647,9 +1607,6 @@ let Star = class Star extends UI {
|
|
|
1647
1607
|
get __tag() {
|
|
1648
1608
|
return "Star";
|
|
1649
1609
|
}
|
|
1650
|
-
constructor(data) {
|
|
1651
|
-
super(data);
|
|
1652
|
-
}
|
|
1653
1610
|
__updatePath() {
|
|
1654
1611
|
const {width: width, height: height, corners: corners, innerRadius: innerRadius} = this.__;
|
|
1655
1612
|
const rx = width / 2, ry = height / 2;
|
|
@@ -1682,9 +1639,6 @@ let Image = class Image extends Rect {
|
|
|
1682
1639
|
const {fill: fill} = this.__;
|
|
1683
1640
|
return isArray(fill) && fill[0].image;
|
|
1684
1641
|
}
|
|
1685
|
-
constructor(data) {
|
|
1686
|
-
super(data);
|
|
1687
|
-
}
|
|
1688
1642
|
};
|
|
1689
1643
|
|
|
1690
1644
|
__decorate([ dataProcessor(ImageData) ], Image.prototype, "__", void 0);
|
|
@@ -1784,9 +1738,6 @@ let Text = class Text extends UI {
|
|
|
1784
1738
|
this.updateLayout();
|
|
1785
1739
|
return this.__.__textDrawData;
|
|
1786
1740
|
}
|
|
1787
|
-
constructor(data) {
|
|
1788
|
-
super(data);
|
|
1789
|
-
}
|
|
1790
1741
|
__updateTextDrawData() {
|
|
1791
1742
|
const data = this.__;
|
|
1792
1743
|
const {lineHeight: lineHeight, letterSpacing: letterSpacing, fontFamily: fontFamily, fontSize: fontSize, fontWeight: fontWeight, italic: italic, textCase: textCase, textOverflow: textOverflow, padding: padding} = data;
|
|
@@ -1919,9 +1870,6 @@ let Path = class Path extends UI {
|
|
|
1919
1870
|
get __tag() {
|
|
1920
1871
|
return "Path";
|
|
1921
1872
|
}
|
|
1922
|
-
constructor(data) {
|
|
1923
|
-
super(data);
|
|
1924
|
-
}
|
|
1925
1873
|
};
|
|
1926
1874
|
|
|
1927
1875
|
__decorate([ dataProcessor(PathData) ], Path.prototype, "__", void 0);
|
|
@@ -1934,9 +1882,6 @@ let Pen = class Pen extends Group {
|
|
|
1934
1882
|
get __tag() {
|
|
1935
1883
|
return "Pen";
|
|
1936
1884
|
}
|
|
1937
|
-
constructor(data) {
|
|
1938
|
-
super(data);
|
|
1939
|
-
}
|
|
1940
1885
|
setStyle(data) {
|
|
1941
1886
|
const path = this.pathElement = new Path(data);
|
|
1942
1887
|
this.pathStyle = data;
|