@leafer/worker 1.11.1 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/worker.cjs +9 -0
- package/dist/worker.esm.js +11 -0
- package/dist/worker.esm.min.js +1 -1
- package/dist/worker.esm.min.js.map +1 -1
- package/dist/worker.js +66 -38
- package/dist/worker.min.cjs +1 -1
- package/dist/worker.min.cjs.map +1 -1
- package/dist/worker.min.js +1 -1
- package/dist/worker.min.js.map +1 -1
- package/dist/worker.module.js +69 -39
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +23 -23
package/dist/worker.cjs
CHANGED
|
@@ -38,6 +38,15 @@ var resize = require("@leafer-in/resize");
|
|
|
38
38
|
|
|
39
39
|
var bright = require("@leafer-in/bright");
|
|
40
40
|
|
|
41
|
+
exports.PathNodeHandleType = void 0;
|
|
42
|
+
|
|
43
|
+
(function(PathNodeHandleType) {
|
|
44
|
+
PathNodeHandleType[PathNodeHandleType["none"] = 1] = "none";
|
|
45
|
+
PathNodeHandleType[PathNodeHandleType["free"] = 2] = "free";
|
|
46
|
+
PathNodeHandleType[PathNodeHandleType["mirrorAngle"] = 3] = "mirrorAngle";
|
|
47
|
+
PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
|
|
48
|
+
})(exports.PathNodeHandleType || (exports.PathNodeHandleType = {}));
|
|
49
|
+
|
|
41
50
|
Object.keys(worker).forEach(function(k) {
|
|
42
51
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
43
52
|
enumerable: true,
|
package/dist/worker.esm.js
CHANGED
|
@@ -35,3 +35,14 @@ export * from "@leafer-in/color";
|
|
|
35
35
|
export * from "@leafer-in/resize";
|
|
36
36
|
|
|
37
37
|
export * from "@leafer-in/bright";
|
|
38
|
+
|
|
39
|
+
var PathNodeHandleType;
|
|
40
|
+
|
|
41
|
+
(function(PathNodeHandleType) {
|
|
42
|
+
PathNodeHandleType[PathNodeHandleType["none"] = 1] = "none";
|
|
43
|
+
PathNodeHandleType[PathNodeHandleType["free"] = 2] = "free";
|
|
44
|
+
PathNodeHandleType[PathNodeHandleType["mirrorAngle"] = 3] = "mirrorAngle";
|
|
45
|
+
PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
|
|
46
|
+
})(PathNodeHandleType || (PathNodeHandleType = {}));
|
|
47
|
+
|
|
48
|
+
export { PathNodeHandleType };
|
package/dist/worker.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"@leafer-ui/worker";export*from"@leafer-in/editor";export*from"@leafer-in/text-editor";export*from"@leafer-in/viewport";export*from"@leafer-in/view";export*from"@leafer-in/scroll";export*from"@leafer-in/html";export*from"@leafer-in/arrow";export*from"@leafer-in/flow";export*from"@leafer-in/animate";export*from"@leafer-in/motion-path";export*from"@leafer-in/state";export*from"@leafer-in/robot";export*from"@leafer-in/find";export*from"@leafer-in/export";export*from"@leafer-in/filter";export*from"@leafer-in/color";export*from"@leafer-in/resize";export*from"@leafer-in/bright";
|
|
1
|
+
export*from"@leafer-ui/worker";export*from"@leafer-in/editor";export*from"@leafer-in/text-editor";export*from"@leafer-in/viewport";export*from"@leafer-in/view";export*from"@leafer-in/scroll";export*from"@leafer-in/html";export*from"@leafer-in/arrow";export*from"@leafer-in/flow";export*from"@leafer-in/animate";export*from"@leafer-in/motion-path";export*from"@leafer-in/state";export*from"@leafer-in/robot";export*from"@leafer-in/find";export*from"@leafer-in/export";export*from"@leafer-in/filter";export*from"@leafer-in/color";export*from"@leafer-in/resize";export*from"@leafer-in/bright";var r;!function(r){r[r.none=1]="none",r[r.free=2]="free",r[r.mirrorAngle=3]="mirrorAngle",r[r.mirror=4]="mirror"}(r||(r={}));export{r as PathNodeHandleType};
|
|
2
2
|
//# sourceMappingURL=worker.esm.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.esm.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"worker.esm.min.js","sources":["../../../../../../../src/leafer/packages/interface/src/path/IPathCommand.ts"],"sourcesContent":["import { IPointData } from '../math/IMath'\n\ntype Command = number\ntype x = number\ntype y = number\ntype x1 = number\ntype y1 = number\ntype x2 = number\ntype y2 = number\ntype radiusX = number\ntype radiusY = number\ntype xAxisRotation = number\ntype largeArcFlag = number\ntype sweepFlag = number\n\n\nexport type MCommandData = [Command, x, y]\nexport type HCommandData = [Command, x]\nexport type VCommandData = [Command, y]\nexport type LCommandData = MCommandData\n\nexport type CCommandData = [Command, x1, y1, x2, y2, x, y]\nexport type SCommandData = [Command, x2, y2, x, y]\n\nexport type QCommandData = [Command, x1, y1, x, y]\nexport type TCommandData = [Command, x, y]\n\nexport type ZCommandData = [Command]\n\nexport type ACommandData = [Command, radiusX, radiusY, xAxisRotation, largeArcFlag, sweepFlag, x, y]\n\n\n// 非svg标准的canvas绘图命令\ntype width = number\ntype height = number\ntype rotation = number\ntype startAngle = number\ntype endAngle = number\ntype anticlockwise = boolean\ntype cornerRadius = number | number[]\ntype radius = number\n\nexport type RectCommandData = [Command, x, y, width, height]\nexport type RoundRectCommandData = [Command, x, y, width, height, cornerRadius]\nexport type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise]\nexport type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, anticlockwise]\nexport type ArcToCommandData = [Command, x1, y1, x2, y2, radius]\n\n\nexport type CanvasPathCommand = 1 | 2 | 5 | 7 | 11 // M | L | C | Q | Z canvas可以绘制的命令\n\nexport type IPathCommandData = number[] // ...(MCommandData | LCommandData | CCommandData | QCommandData | ZCommandData)\n\n\n// 路径命令对象\nexport interface MoveToCommandObject {\n name: 'M'\n x: number\n y: number\n}\nexport interface LineToCommandObject {\n name: 'L'\n x: number\n y: number\n}\n\nexport interface BezierCurveToCommandObject {\n name: 'C'\n x1: number\n y1: number\n x2: number\n y2: number\n x: number\n y: number\n}\n\nexport interface QuadraticCurveToCommandObject {\n name: 'Q'\n x1: number\n y1: number\n x: number\n y: number\n}\n\nexport interface ClosePathCommandObject {\n name: 'Z'\n}\n\nexport type IPathCommandObject = MoveToCommandObject | LineToCommandObject | BezierCurveToCommandObject | QuadraticCurveToCommandObject | ClosePathCommandObject // M | L | C | Q | Z canvas可以绘制的命令\n\n\n// 可视化路径节点\n\nexport interface IPathCommandNodeBase {\n name: 'M^' | 'L^' | 'C^' | 'Z^'\n x: number\n y: number\n a?: IPointData // 第一个手柄,连接上一个节点\n b?: IPointData // 第二个手柄,连接下一个节点\n ab?: PathNodeHandleType // 手柄类型\n}\n\nexport interface MoveToCommandNode extends IPathCommandNodeBase {\n name: 'M^'\n}\nexport interface LineToCommandNode extends IPathCommandNodeBase {\n name: 'L^'\n}\n\nexport interface BezierCurveToCommandNode extends IPathCommandNodeBase {\n name: 'C^'\n}\n\nexport interface ClosePathCommandNode {\n name: 'Z^'\n x?: number\n y?: number\n a?: IPointData\n b?: IPointData\n ab?: PathNodeHandleType\n}\n\nexport type IPathCommandNode = MoveToCommandNode | LineToCommandNode | BezierCurveToCommandNode | ClosePathCommandNode // M | L | C | Z 路径节点命令(适合可视化编辑)\n\nexport enum PathNodeHandleType { // 手柄类型\n none = 1, // 无手柄\n free = 2, // 每个手柄自由控制\n mirrorAngle = 3, // 仅镜像角度\n mirror = 4, // 镜像角度和长度\n}\n\nexport type PathNodeHandleName = 'a' | 'b' // 手柄名称\n\nexport interface IPathNodeBase {\n pathNode: IPathCommandNode\n}"],"names":["PathNodeHandleType"],"mappings":"klBA4HYA,GAAZ,SAAYA,GACRA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,YAAA,GAAA,cACAA,EAAAA,EAAA,OAAA,GAAA,QACH,CALD,CAAYA,IAAAA,EAAkB,CAAA"}
|
package/dist/worker.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
var LeaferUI = function(exports) {
|
|
2
2
|
"use strict";
|
|
3
|
+
exports.PathNodeHandleType = void 0;
|
|
4
|
+
(function(PathNodeHandleType) {
|
|
5
|
+
PathNodeHandleType[PathNodeHandleType["none"] = 1] = "none";
|
|
6
|
+
PathNodeHandleType[PathNodeHandleType["free"] = 2] = "free";
|
|
7
|
+
PathNodeHandleType[PathNodeHandleType["mirrorAngle"] = 3] = "mirrorAngle";
|
|
8
|
+
PathNodeHandleType[PathNodeHandleType["mirror"] = 4] = "mirror";
|
|
9
|
+
})(exports.PathNodeHandleType || (exports.PathNodeHandleType = {}));
|
|
3
10
|
exports.Answer = void 0;
|
|
4
11
|
(function(Answer) {
|
|
5
12
|
Answer[Answer["No"] = 0] = "No";
|
|
@@ -3811,16 +3818,27 @@ var LeaferUI = function(exports) {
|
|
|
3811
3818
|
recycle(image) {
|
|
3812
3819
|
image.use--;
|
|
3813
3820
|
setTimeout(() => {
|
|
3814
|
-
if (!image.use)
|
|
3821
|
+
if (!image.use) {
|
|
3822
|
+
if (Platform.image.isLarge(image)) {
|
|
3823
|
+
if (image.url) Resource.remove(image.url);
|
|
3824
|
+
} else {
|
|
3825
|
+
image.clearLevels();
|
|
3826
|
+
I$1.recycledList.push(image);
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3815
3829
|
});
|
|
3816
3830
|
},
|
|
3817
|
-
|
|
3831
|
+
recyclePaint(paint) {
|
|
3832
|
+
I$1.recycle(paint.image);
|
|
3833
|
+
},
|
|
3834
|
+
clearRecycled(force) {
|
|
3818
3835
|
const list = I$1.recycledList;
|
|
3819
|
-
if (list.length > I$1.maxRecycled) {
|
|
3820
|
-
list.forEach(image => !image.use && image.url && Resource.remove(image.url));
|
|
3836
|
+
if (list.length > I$1.maxRecycled || force) {
|
|
3837
|
+
list.forEach(image => (!image.use || force) && image.url && Resource.remove(image.url));
|
|
3821
3838
|
list.length = 0;
|
|
3822
3839
|
}
|
|
3823
3840
|
},
|
|
3841
|
+
clearLevels() {},
|
|
3824
3842
|
hasAlphaPixel(config) {
|
|
3825
3843
|
return FileHelper.alphaPixelTypes.some(item => I$1.isFormat(item, config));
|
|
3826
3844
|
},
|
|
@@ -3835,7 +3853,7 @@ var LeaferUI = function(exports) {
|
|
|
3835
3853
|
return false;
|
|
3836
3854
|
},
|
|
3837
3855
|
destroy() {
|
|
3838
|
-
|
|
3856
|
+
this.clearRecycled(true);
|
|
3839
3857
|
}
|
|
3840
3858
|
};
|
|
3841
3859
|
const I$1 = ImageManager;
|
|
@@ -3935,11 +3953,15 @@ var LeaferUI = function(exports) {
|
|
|
3935
3953
|
Platform.image.setPatternTransform(pattern, transform, paint);
|
|
3936
3954
|
return pattern;
|
|
3937
3955
|
}
|
|
3956
|
+
clearLevels(_checkUse) {}
|
|
3938
3957
|
destroy() {
|
|
3958
|
+
this.clearLevels();
|
|
3959
|
+
const {view: view} = this;
|
|
3960
|
+
if (view && view.close) view.close();
|
|
3939
3961
|
this.config = {
|
|
3940
3962
|
url: ""
|
|
3941
3963
|
};
|
|
3942
|
-
this.cache = null;
|
|
3964
|
+
this.cache = this.view = null;
|
|
3943
3965
|
this.waitComplete.length = 0;
|
|
3944
3966
|
}
|
|
3945
3967
|
}
|
|
@@ -5569,6 +5591,7 @@ var LeaferUI = function(exports) {
|
|
|
5569
5591
|
const LeafRender = {
|
|
5570
5592
|
__render(canvas, options) {
|
|
5571
5593
|
if (options.shape) return this.__renderShape(canvas, options);
|
|
5594
|
+
if (options.cellList && !options.cellList.has(this)) return;
|
|
5572
5595
|
if (this.__worldOpacity) {
|
|
5573
5596
|
const data = this.__;
|
|
5574
5597
|
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
@@ -6447,7 +6470,7 @@ var LeaferUI = function(exports) {
|
|
|
6447
6470
|
this.levelMap = null;
|
|
6448
6471
|
}
|
|
6449
6472
|
}
|
|
6450
|
-
const version = "1.
|
|
6473
|
+
const version = "1.12.0";
|
|
6451
6474
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6452
6475
|
get allowBackgroundColor() {
|
|
6453
6476
|
return true;
|
|
@@ -6549,7 +6572,7 @@ var LeaferUI = function(exports) {
|
|
|
6549
6572
|
return this.hasAdd || this.hasRemove || this.hasVisible;
|
|
6550
6573
|
}
|
|
6551
6574
|
get updatedList() {
|
|
6552
|
-
if (this.hasRemove) {
|
|
6575
|
+
if (this.hasRemove && this.config.usePartLayout) {
|
|
6553
6576
|
const updatedList = new LeafList;
|
|
6554
6577
|
this.__updatedList.list.forEach(item => {
|
|
6555
6578
|
if (item.leafer) updatedList.add(item);
|
|
@@ -6584,16 +6607,18 @@ var LeaferUI = function(exports) {
|
|
|
6584
6607
|
if (this.running) this.target.emit(RenderEvent.REQUEST);
|
|
6585
6608
|
}
|
|
6586
6609
|
__onAttrChange(event) {
|
|
6587
|
-
this.__updatedList.add(event.target);
|
|
6610
|
+
if (this.config.usePartLayout) this.__updatedList.add(event.target);
|
|
6588
6611
|
this.update();
|
|
6589
6612
|
}
|
|
6590
6613
|
__onChildEvent(event) {
|
|
6591
|
-
if (
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6614
|
+
if (this.config.usePartLayout) {
|
|
6615
|
+
if (event.type === ChildEvent.ADD) {
|
|
6616
|
+
this.hasAdd = true;
|
|
6617
|
+
this.__pushChild(event.child);
|
|
6618
|
+
} else {
|
|
6619
|
+
this.hasRemove = true;
|
|
6620
|
+
this.__updatedList.add(event.parent);
|
|
6621
|
+
}
|
|
6597
6622
|
}
|
|
6598
6623
|
this.update();
|
|
6599
6624
|
}
|
|
@@ -6700,7 +6725,9 @@ var LeaferUI = function(exports) {
|
|
|
6700
6725
|
class Layouter {
|
|
6701
6726
|
constructor(target, userConfig) {
|
|
6702
6727
|
this.totalTimes = 0;
|
|
6703
|
-
this.config = {
|
|
6728
|
+
this.config = {
|
|
6729
|
+
usePartLayout: true
|
|
6730
|
+
};
|
|
6704
6731
|
this.__levelList = new LeafLevelList;
|
|
6705
6732
|
this.target = target;
|
|
6706
6733
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -6745,7 +6772,7 @@ var LeaferUI = function(exports) {
|
|
|
6745
6772
|
this.totalTimes++;
|
|
6746
6773
|
this.layouting = true;
|
|
6747
6774
|
this.target.emit(WatchEvent.REQUEST);
|
|
6748
|
-
if (this.totalTimes > 1) {
|
|
6775
|
+
if (this.totalTimes > 1 && this.config.usePartLayout) {
|
|
6749
6776
|
this.partLayout();
|
|
6750
6777
|
} else {
|
|
6751
6778
|
this.fullLayout();
|
|
@@ -6860,7 +6887,7 @@ var LeaferUI = function(exports) {
|
|
|
6860
6887
|
}
|
|
6861
6888
|
update(change = true) {
|
|
6862
6889
|
if (!this.changed) this.changed = change;
|
|
6863
|
-
this.__requestRender();
|
|
6890
|
+
if (!this.requestTime) this.__requestRender();
|
|
6864
6891
|
}
|
|
6865
6892
|
requestLayout() {
|
|
6866
6893
|
this.target.emit(LayoutEvent.REQUEST);
|
|
@@ -6967,7 +6994,7 @@ var LeaferUI = function(exports) {
|
|
|
6967
6994
|
Run.end(t);
|
|
6968
6995
|
}
|
|
6969
6996
|
__render(bounds, realBounds) {
|
|
6970
|
-
const {canvas: canvas} = this, includes = bounds.includes(
|
|
6997
|
+
const {canvas: canvas, target: target} = this, includes = bounds.includes(target.__world), options = includes ? {
|
|
6971
6998
|
includes: includes
|
|
6972
6999
|
} : {
|
|
6973
7000
|
bounds: bounds,
|
|
@@ -6975,12 +7002,16 @@ var LeaferUI = function(exports) {
|
|
|
6975
7002
|
};
|
|
6976
7003
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
6977
7004
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
6978
|
-
|
|
7005
|
+
if (this.config.useCellRender) options.cellList = this.getCellList();
|
|
7006
|
+
Platform.render(target, canvas, options);
|
|
6979
7007
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
6980
7008
|
this.renderOptions = options;
|
|
6981
7009
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
6982
7010
|
canvas.updateRender(realBounds);
|
|
6983
7011
|
}
|
|
7012
|
+
getCellList() {
|
|
7013
|
+
return undefined;
|
|
7014
|
+
}
|
|
6984
7015
|
addBlock(block) {
|
|
6985
7016
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
6986
7017
|
this.updateBlocks.push(block);
|
|
@@ -7594,6 +7625,11 @@ var LeaferUI = function(exports) {
|
|
|
7594
7625
|
}
|
|
7595
7626
|
this._boxStyle = value;
|
|
7596
7627
|
}
|
|
7628
|
+
__getInputData(names, options) {
|
|
7629
|
+
const data = super.__getInputData(names, options);
|
|
7630
|
+
if (data.textEditing) delete data.textEditing;
|
|
7631
|
+
return data;
|
|
7632
|
+
}
|
|
7597
7633
|
}
|
|
7598
7634
|
class ImageData extends RectData {
|
|
7599
7635
|
setUrl(value) {
|
|
@@ -10582,6 +10618,7 @@ var LeaferUI = function(exports) {
|
|
|
10582
10618
|
const {boxBounds: boxBounds} = ui.__layout;
|
|
10583
10619
|
switch (paint.type) {
|
|
10584
10620
|
case "image":
|
|
10621
|
+
if (!paint.url) return undefined;
|
|
10585
10622
|
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
10586
10623
|
break;
|
|
10587
10624
|
|
|
@@ -10896,7 +10933,7 @@ var LeaferUI = function(exports) {
|
|
|
10896
10933
|
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
10897
10934
|
translate(transform, box.x + x, box.y + y);
|
|
10898
10935
|
}
|
|
10899
|
-
const {get: get$1, scale: scale$
|
|
10936
|
+
const {get: get$1, scale: scale$1, copy: copy$4} = MatrixHelper;
|
|
10900
10937
|
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$6} = Math;
|
|
10901
10938
|
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
10902
10939
|
if (!paint.patternTask) {
|
|
@@ -10925,7 +10962,7 @@ var LeaferUI = function(exports) {
|
|
|
10925
10962
|
scaleY *= getFloorScale(height + (yGap || 0));
|
|
10926
10963
|
imageMatrix = get$1();
|
|
10927
10964
|
if (transform) copy$4(imageMatrix, transform);
|
|
10928
|
-
scale$
|
|
10965
|
+
scale$1(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10929
10966
|
}
|
|
10930
10967
|
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
10931
10968
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
@@ -10955,7 +10992,7 @@ var LeaferUI = function(exports) {
|
|
|
10955
10992
|
if (data.repeat) {
|
|
10956
10993
|
drawImage = false;
|
|
10957
10994
|
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
10958
|
-
drawImage = Platform.image.isLarge(image, scaleX, scaleY);
|
|
10995
|
+
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
10959
10996
|
}
|
|
10960
10997
|
}
|
|
10961
10998
|
if (drawImage) {
|
|
@@ -11011,7 +11048,7 @@ var LeaferUI = function(exports) {
|
|
|
11011
11048
|
if (url) {
|
|
11012
11049
|
if (!recycleMap) recycleMap = {};
|
|
11013
11050
|
recycleMap[url] = true;
|
|
11014
|
-
ImageManager.
|
|
11051
|
+
ImageManager.recyclePaint(paint);
|
|
11015
11052
|
if (image.loading) {
|
|
11016
11053
|
if (!input) {
|
|
11017
11054
|
input = data.__input && data.__input[attrName] || [];
|
|
@@ -11918,7 +11955,7 @@ var LeaferUI = function(exports) {
|
|
|
11918
11955
|
};
|
|
11919
11956
|
}
|
|
11920
11957
|
const {abs: abs$4} = Math;
|
|
11921
|
-
const {copy: copy$2
|
|
11958
|
+
const {copy: copy$2} = MatrixHelper;
|
|
11922
11959
|
const {setListWithFn: setListWithFn} = BoundsHelper;
|
|
11923
11960
|
const {worldBounds: worldBounds} = LeafBoundsHelper;
|
|
11924
11961
|
const matrix$1 = getMatrixData();
|
|
@@ -11957,19 +11994,10 @@ var LeaferUI = function(exports) {
|
|
|
11957
11994
|
const aScaleX = abs$4(worldTransform.scaleX), aScaleY = abs$4(worldTransform.scaleY);
|
|
11958
11995
|
copy$2(matrix$1, worldTransform);
|
|
11959
11996
|
matrix$1.half = strokeWidth % 2;
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
data.strokeWidth = strokeWidth;
|
|
11965
|
-
const {x: x, y: y, width: width, height: height} = leaf.__layout.boxBounds;
|
|
11966
|
-
canvas.rect(x * aScaleX, y * aScaleY, width * aScaleX, height * aScaleY);
|
|
11967
|
-
} else {
|
|
11968
|
-
canvas.setWorld(matrix$1, options.matrix);
|
|
11969
|
-
canvas.beginPath();
|
|
11970
|
-
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
11971
|
-
data.strokeWidth = strokeWidth / abs$4(worldTransform.scaleX);
|
|
11972
|
-
}
|
|
11997
|
+
canvas.setWorld(matrix$1, options.matrix);
|
|
11998
|
+
canvas.beginPath();
|
|
11999
|
+
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
12000
|
+
data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
|
|
11973
12001
|
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
|
|
11974
12002
|
if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
|
|
11975
12003
|
}
|
package/dist/worker.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("@leafer-ui/worker"),t=require("@leafer-in/editor"),
|
|
1
|
+
"use strict";var e,r=require("@leafer-ui/worker"),t=require("@leafer-in/editor"),o=require("@leafer-in/text-editor"),n=require("@leafer-in/viewport"),c=require("@leafer-in/view"),a=require("@leafer-in/scroll"),p=require("@leafer-in/html"),f=require("@leafer-in/arrow"),u=require("@leafer-in/flow"),i=require("@leafer-in/animate"),l=require("@leafer-in/motion-path"),s=require("@leafer-in/state"),y=require("@leafer-in/robot"),b=require("@leafer-in/find"),O=require("@leafer-in/export"),j=require("@leafer-in/filter"),d=require("@leafer-in/color"),h=require("@leafer-in/resize"),x=require("@leafer-in/bright");exports.PathNodeHandleType=void 0,(e=exports.PathNodeHandleType||(exports.PathNodeHandleType={}))[e.none=1]="none",e[e.free=2]="free",e[e.mirrorAngle=3]="mirrorAngle",e[e.mirror=4]="mirror",Object.keys(r).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})}),Object.keys(t).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}),Object.keys(o).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return o[e]}})}),Object.keys(n).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return n[e]}})}),Object.keys(c).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return c[e]}})}),Object.keys(a).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return a[e]}})}),Object.keys(p).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return p[e]}})}),Object.keys(f).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return f[e]}})}),Object.keys(u).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return u[e]}})}),Object.keys(i).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return i[e]}})}),Object.keys(l).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return l[e]}})}),Object.keys(s).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return s[e]}})}),Object.keys(y).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return y[e]}})}),Object.keys(b).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return b[e]}})}),Object.keys(O).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return O[e]}})}),Object.keys(j).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return j[e]}})}),Object.keys(d).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return d[e]}})}),Object.keys(h).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return h[e]}})}),Object.keys(x).forEach(function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return x[e]}})});
|
|
2
2
|
//# sourceMappingURL=worker.min.cjs.map
|
package/dist/worker.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.min.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"worker.min.cjs","sources":["../../../../../../../src/leafer/packages/interface/src/path/IPathCommand.ts"],"sourcesContent":["import { IPointData } from '../math/IMath'\n\ntype Command = number\ntype x = number\ntype y = number\ntype x1 = number\ntype y1 = number\ntype x2 = number\ntype y2 = number\ntype radiusX = number\ntype radiusY = number\ntype xAxisRotation = number\ntype largeArcFlag = number\ntype sweepFlag = number\n\n\nexport type MCommandData = [Command, x, y]\nexport type HCommandData = [Command, x]\nexport type VCommandData = [Command, y]\nexport type LCommandData = MCommandData\n\nexport type CCommandData = [Command, x1, y1, x2, y2, x, y]\nexport type SCommandData = [Command, x2, y2, x, y]\n\nexport type QCommandData = [Command, x1, y1, x, y]\nexport type TCommandData = [Command, x, y]\n\nexport type ZCommandData = [Command]\n\nexport type ACommandData = [Command, radiusX, radiusY, xAxisRotation, largeArcFlag, sweepFlag, x, y]\n\n\n// 非svg标准的canvas绘图命令\ntype width = number\ntype height = number\ntype rotation = number\ntype startAngle = number\ntype endAngle = number\ntype anticlockwise = boolean\ntype cornerRadius = number | number[]\ntype radius = number\n\nexport type RectCommandData = [Command, x, y, width, height]\nexport type RoundRectCommandData = [Command, x, y, width, height, cornerRadius]\nexport type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise]\nexport type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, anticlockwise]\nexport type ArcToCommandData = [Command, x1, y1, x2, y2, radius]\n\n\nexport type CanvasPathCommand = 1 | 2 | 5 | 7 | 11 // M | L | C | Q | Z canvas可以绘制的命令\n\nexport type IPathCommandData = number[] // ...(MCommandData | LCommandData | CCommandData | QCommandData | ZCommandData)\n\n\n// 路径命令对象\nexport interface MoveToCommandObject {\n name: 'M'\n x: number\n y: number\n}\nexport interface LineToCommandObject {\n name: 'L'\n x: number\n y: number\n}\n\nexport interface BezierCurveToCommandObject {\n name: 'C'\n x1: number\n y1: number\n x2: number\n y2: number\n x: number\n y: number\n}\n\nexport interface QuadraticCurveToCommandObject {\n name: 'Q'\n x1: number\n y1: number\n x: number\n y: number\n}\n\nexport interface ClosePathCommandObject {\n name: 'Z'\n}\n\nexport type IPathCommandObject = MoveToCommandObject | LineToCommandObject | BezierCurveToCommandObject | QuadraticCurveToCommandObject | ClosePathCommandObject // M | L | C | Q | Z canvas可以绘制的命令\n\n\n// 可视化路径节点\n\nexport interface IPathCommandNodeBase {\n name: 'M^' | 'L^' | 'C^' | 'Z^'\n x: number\n y: number\n a?: IPointData // 第一个手柄,连接上一个节点\n b?: IPointData // 第二个手柄,连接下一个节点\n ab?: PathNodeHandleType // 手柄类型\n}\n\nexport interface MoveToCommandNode extends IPathCommandNodeBase {\n name: 'M^'\n}\nexport interface LineToCommandNode extends IPathCommandNodeBase {\n name: 'L^'\n}\n\nexport interface BezierCurveToCommandNode extends IPathCommandNodeBase {\n name: 'C^'\n}\n\nexport interface ClosePathCommandNode {\n name: 'Z^'\n x?: number\n y?: number\n a?: IPointData\n b?: IPointData\n ab?: PathNodeHandleType\n}\n\nexport type IPathCommandNode = MoveToCommandNode | LineToCommandNode | BezierCurveToCommandNode | ClosePathCommandNode // M | L | C | Z 路径节点命令(适合可视化编辑)\n\nexport enum PathNodeHandleType { // 手柄类型\n none = 1, // 无手柄\n free = 2, // 每个手柄自由控制\n mirrorAngle = 3, // 仅镜像角度\n mirror = 4, // 镜像角度和长度\n}\n\nexport type PathNodeHandleName = 'a' | 'b' // 手柄名称\n\nexport interface IPathNodeBase {\n pathNode: IPathCommandNode\n}"],"names":["PathNodeHandleType"],"mappings":"iBA4HYA,glBAAAA,QAAAA,wBAAAA,GAAAA,EAAAA,QAAAA,qBAAAA,2BAAkB,CAAA,IAC1BA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,KAAA,GAAA,OACAA,EAAAA,EAAA,YAAA,GAAA,cACAA,EAAAA,EAAA,OAAA,GAAA"}
|