@leafer/worker 1.11.2 → 1.12.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.esm.min.js.map +1 -1
- package/dist/worker.js +110 -46
- 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 +110 -46
- package/dist/worker.module.min.js +1 -1
- package/dist/worker.module.min.js.map +1 -1
- package/package.json +23 -23
|
@@ -1 +1 @@
|
|
|
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
|
|
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
|
@@ -3818,16 +3818,27 @@ var LeaferUI = function(exports) {
|
|
|
3818
3818
|
recycle(image) {
|
|
3819
3819
|
image.use--;
|
|
3820
3820
|
setTimeout(() => {
|
|
3821
|
-
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
|
+
}
|
|
3822
3829
|
});
|
|
3823
3830
|
},
|
|
3824
|
-
|
|
3831
|
+
recyclePaint(paint) {
|
|
3832
|
+
I$1.recycle(paint.image);
|
|
3833
|
+
},
|
|
3834
|
+
clearRecycled(force) {
|
|
3825
3835
|
const list = I$1.recycledList;
|
|
3826
|
-
if (list.length > I$1.maxRecycled) {
|
|
3827
|
-
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));
|
|
3828
3838
|
list.length = 0;
|
|
3829
3839
|
}
|
|
3830
3840
|
},
|
|
3841
|
+
clearLevels() {},
|
|
3831
3842
|
hasAlphaPixel(config) {
|
|
3832
3843
|
return FileHelper.alphaPixelTypes.some(item => I$1.isFormat(item, config));
|
|
3833
3844
|
},
|
|
@@ -3842,7 +3853,7 @@ var LeaferUI = function(exports) {
|
|
|
3842
3853
|
return false;
|
|
3843
3854
|
},
|
|
3844
3855
|
destroy() {
|
|
3845
|
-
|
|
3856
|
+
this.clearRecycled(true);
|
|
3846
3857
|
}
|
|
3847
3858
|
};
|
|
3848
3859
|
const I$1 = ImageManager;
|
|
@@ -3942,11 +3953,15 @@ var LeaferUI = function(exports) {
|
|
|
3942
3953
|
Platform.image.setPatternTransform(pattern, transform, paint);
|
|
3943
3954
|
return pattern;
|
|
3944
3955
|
}
|
|
3956
|
+
clearLevels(_checkUse) {}
|
|
3945
3957
|
destroy() {
|
|
3958
|
+
this.clearLevels();
|
|
3959
|
+
const {view: view} = this;
|
|
3960
|
+
if (view && view.close) view.close();
|
|
3946
3961
|
this.config = {
|
|
3947
3962
|
url: ""
|
|
3948
3963
|
};
|
|
3949
|
-
this.cache = null;
|
|
3964
|
+
this.cache = this.view = null;
|
|
3950
3965
|
this.waitComplete.length = 0;
|
|
3951
3966
|
}
|
|
3952
3967
|
}
|
|
@@ -4637,9 +4652,52 @@ var LeaferUI = function(exports) {
|
|
|
4637
4652
|
if (exclude && exclude === branch) continue;
|
|
4638
4653
|
updateBounds$4(branch);
|
|
4639
4654
|
}
|
|
4655
|
+
},
|
|
4656
|
+
move(branch, x, y) {
|
|
4657
|
+
let w;
|
|
4658
|
+
const {children: children} = branch;
|
|
4659
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
4660
|
+
branch = children[i];
|
|
4661
|
+
w = branch.__world;
|
|
4662
|
+
w.e += x;
|
|
4663
|
+
w.f += y;
|
|
4664
|
+
w.x += x;
|
|
4665
|
+
w.y += y;
|
|
4666
|
+
if (branch.isBranch) move$9(branch, x, y);
|
|
4667
|
+
}
|
|
4668
|
+
},
|
|
4669
|
+
scale(branch, x, y, scaleX, scaleY, a, b) {
|
|
4670
|
+
let w;
|
|
4671
|
+
const {children: children} = branch;
|
|
4672
|
+
const changeScaleX = scaleX - 1;
|
|
4673
|
+
const changeScaleY = scaleY - 1;
|
|
4674
|
+
for (let i = 0, len = children.length; i < len; i++) {
|
|
4675
|
+
branch = children[i];
|
|
4676
|
+
w = branch.__world;
|
|
4677
|
+
w.a *= scaleX;
|
|
4678
|
+
w.d *= scaleY;
|
|
4679
|
+
if (w.b || w.c) {
|
|
4680
|
+
w.b *= scaleX;
|
|
4681
|
+
w.c *= scaleY;
|
|
4682
|
+
}
|
|
4683
|
+
if (w.e === w.x && w.f === w.y) {
|
|
4684
|
+
w.x = w.e += (w.e - a) * changeScaleX + x;
|
|
4685
|
+
w.y = w.f += (w.f - b) * changeScaleY + y;
|
|
4686
|
+
} else {
|
|
4687
|
+
w.e += (w.e - a) * changeScaleX + x;
|
|
4688
|
+
w.f += (w.f - b) * changeScaleY + y;
|
|
4689
|
+
w.x += (w.x - a) * changeScaleX + x;
|
|
4690
|
+
w.y += (w.y - b) * changeScaleY + y;
|
|
4691
|
+
}
|
|
4692
|
+
w.width *= scaleX;
|
|
4693
|
+
w.height *= scaleY;
|
|
4694
|
+
w.scaleX *= scaleX;
|
|
4695
|
+
w.scaleY *= scaleY;
|
|
4696
|
+
if (branch.isBranch) scale$2(branch, x, y, scaleX, scaleY, a, b);
|
|
4697
|
+
}
|
|
4640
4698
|
}
|
|
4641
4699
|
};
|
|
4642
|
-
const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack} = BranchHelper;
|
|
4700
|
+
const {pushAllChildBranch: pushAllChildBranch$1, pushAllBranchStack: pushAllBranchStack, updateBoundsByBranchStack: updateBoundsByBranchStack, move: move$9, scale: scale$2} = BranchHelper;
|
|
4643
4701
|
const WaitHelper = {
|
|
4644
4702
|
run(wait) {
|
|
4645
4703
|
if (wait && wait.length) {
|
|
@@ -5576,6 +5634,7 @@ var LeaferUI = function(exports) {
|
|
|
5576
5634
|
const LeafRender = {
|
|
5577
5635
|
__render(canvas, options) {
|
|
5578
5636
|
if (options.shape) return this.__renderShape(canvas, options);
|
|
5637
|
+
if (options.cellList && !options.cellList.has(this)) return;
|
|
5579
5638
|
if (this.__worldOpacity) {
|
|
5580
5639
|
const data = this.__;
|
|
5581
5640
|
if (data.bright && !options.topRendering) return options.topList.add(this);
|
|
@@ -6102,10 +6161,10 @@ var LeaferUI = function(exports) {
|
|
|
6102
6161
|
hit(_world, _hitRadius) {
|
|
6103
6162
|
return true;
|
|
6104
6163
|
}
|
|
6105
|
-
__hitWorld(_point) {
|
|
6164
|
+
__hitWorld(_point, _forceHitFill) {
|
|
6106
6165
|
return true;
|
|
6107
6166
|
}
|
|
6108
|
-
__hit(_local) {
|
|
6167
|
+
__hit(_local, _forceHitFill) {
|
|
6109
6168
|
return true;
|
|
6110
6169
|
}
|
|
6111
6170
|
__hitFill(_inner) {
|
|
@@ -6454,7 +6513,7 @@ var LeaferUI = function(exports) {
|
|
|
6454
6513
|
this.levelMap = null;
|
|
6455
6514
|
}
|
|
6456
6515
|
}
|
|
6457
|
-
const version = "1.
|
|
6516
|
+
const version = "1.12.1";
|
|
6458
6517
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6459
6518
|
get allowBackgroundColor() {
|
|
6460
6519
|
return true;
|
|
@@ -6556,7 +6615,7 @@ var LeaferUI = function(exports) {
|
|
|
6556
6615
|
return this.hasAdd || this.hasRemove || this.hasVisible;
|
|
6557
6616
|
}
|
|
6558
6617
|
get updatedList() {
|
|
6559
|
-
if (this.hasRemove) {
|
|
6618
|
+
if (this.hasRemove && this.config.usePartLayout) {
|
|
6560
6619
|
const updatedList = new LeafList;
|
|
6561
6620
|
this.__updatedList.list.forEach(item => {
|
|
6562
6621
|
if (item.leafer) updatedList.add(item);
|
|
@@ -6591,16 +6650,18 @@ var LeaferUI = function(exports) {
|
|
|
6591
6650
|
if (this.running) this.target.emit(RenderEvent.REQUEST);
|
|
6592
6651
|
}
|
|
6593
6652
|
__onAttrChange(event) {
|
|
6594
|
-
this.__updatedList.add(event.target);
|
|
6653
|
+
if (this.config.usePartLayout) this.__updatedList.add(event.target);
|
|
6595
6654
|
this.update();
|
|
6596
6655
|
}
|
|
6597
6656
|
__onChildEvent(event) {
|
|
6598
|
-
if (
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6657
|
+
if (this.config.usePartLayout) {
|
|
6658
|
+
if (event.type === ChildEvent.ADD) {
|
|
6659
|
+
this.hasAdd = true;
|
|
6660
|
+
this.__pushChild(event.child);
|
|
6661
|
+
} else {
|
|
6662
|
+
this.hasRemove = true;
|
|
6663
|
+
this.__updatedList.add(event.parent);
|
|
6664
|
+
}
|
|
6604
6665
|
}
|
|
6605
6666
|
this.update();
|
|
6606
6667
|
}
|
|
@@ -6707,7 +6768,9 @@ var LeaferUI = function(exports) {
|
|
|
6707
6768
|
class Layouter {
|
|
6708
6769
|
constructor(target, userConfig) {
|
|
6709
6770
|
this.totalTimes = 0;
|
|
6710
|
-
this.config = {
|
|
6771
|
+
this.config = {
|
|
6772
|
+
usePartLayout: true
|
|
6773
|
+
};
|
|
6711
6774
|
this.__levelList = new LeafLevelList;
|
|
6712
6775
|
this.target = target;
|
|
6713
6776
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -6752,7 +6815,7 @@ var LeaferUI = function(exports) {
|
|
|
6752
6815
|
this.totalTimes++;
|
|
6753
6816
|
this.layouting = true;
|
|
6754
6817
|
this.target.emit(WatchEvent.REQUEST);
|
|
6755
|
-
if (this.totalTimes > 1) {
|
|
6818
|
+
if (this.totalTimes > 1 && this.config.usePartLayout) {
|
|
6756
6819
|
this.partLayout();
|
|
6757
6820
|
} else {
|
|
6758
6821
|
this.fullLayout();
|
|
@@ -6867,7 +6930,7 @@ var LeaferUI = function(exports) {
|
|
|
6867
6930
|
}
|
|
6868
6931
|
update(change = true) {
|
|
6869
6932
|
if (!this.changed) this.changed = change;
|
|
6870
|
-
this.__requestRender();
|
|
6933
|
+
if (!this.requestTime) this.__requestRender();
|
|
6871
6934
|
}
|
|
6872
6935
|
requestLayout() {
|
|
6873
6936
|
this.target.emit(LayoutEvent.REQUEST);
|
|
@@ -6974,7 +7037,7 @@ var LeaferUI = function(exports) {
|
|
|
6974
7037
|
Run.end(t);
|
|
6975
7038
|
}
|
|
6976
7039
|
__render(bounds, realBounds) {
|
|
6977
|
-
const {canvas: canvas} = this, includes = bounds.includes(
|
|
7040
|
+
const {canvas: canvas, target: target} = this, includes = bounds.includes(target.__world), options = includes ? {
|
|
6978
7041
|
includes: includes
|
|
6979
7042
|
} : {
|
|
6980
7043
|
bounds: bounds,
|
|
@@ -6982,12 +7045,16 @@ var LeaferUI = function(exports) {
|
|
|
6982
7045
|
};
|
|
6983
7046
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
6984
7047
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
6985
|
-
|
|
7048
|
+
if (this.config.useCellRender) options.cellList = this.getCellList();
|
|
7049
|
+
Platform.render(target, canvas, options);
|
|
6986
7050
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
6987
7051
|
this.renderOptions = options;
|
|
6988
7052
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
6989
7053
|
canvas.updateRender(realBounds);
|
|
6990
7054
|
}
|
|
7055
|
+
getCellList() {
|
|
7056
|
+
return undefined;
|
|
7057
|
+
}
|
|
6991
7058
|
addBlock(block) {
|
|
6992
7059
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
6993
7060
|
this.updateBlocks.push(block);
|
|
@@ -7199,7 +7266,7 @@ var LeaferUI = function(exports) {
|
|
|
7199
7266
|
hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
|
|
7200
7267
|
if (child.isBranch) {
|
|
7201
7268
|
if (hit || child.__ignoreHitWorld) {
|
|
7202
|
-
if (child.isBranchLeaf && child.__.__clipAfterFill && !child.__hitWorld(point)) continue;
|
|
7269
|
+
if (child.isBranchLeaf && child.__.__clipAfterFill && !child.__hitWorld(point, true)) continue;
|
|
7203
7270
|
if (child.topChildren) this.eachFind(child.topChildren, false);
|
|
7204
7271
|
this.eachFind(child.children, child.__onlyHitMask);
|
|
7205
7272
|
if (child.isBranchLeaf) this.hitChild(child, point);
|
|
@@ -7601,6 +7668,11 @@ var LeaferUI = function(exports) {
|
|
|
7601
7668
|
}
|
|
7602
7669
|
this._boxStyle = value;
|
|
7603
7670
|
}
|
|
7671
|
+
__getInputData(names, options) {
|
|
7672
|
+
const data = super.__getInputData(names, options);
|
|
7673
|
+
if (data.textEditing) delete data.textEditing;
|
|
7674
|
+
return data;
|
|
7675
|
+
}
|
|
7604
7676
|
}
|
|
7605
7677
|
class ImageData extends RectData {
|
|
7606
7678
|
setUrl(value) {
|
|
@@ -10160,7 +10232,7 @@ var LeaferUI = function(exports) {
|
|
|
10160
10232
|
target: this
|
|
10161
10233
|
}) : this.__hitWorld(worldRadiusPoint);
|
|
10162
10234
|
};
|
|
10163
|
-
leaf$1.__hitWorld = function(point) {
|
|
10235
|
+
leaf$1.__hitWorld = function(point, forceHitFill) {
|
|
10164
10236
|
const data = this.__;
|
|
10165
10237
|
if (!data.hitSelf) return false;
|
|
10166
10238
|
const world = this.__world, layout = this.__layout;
|
|
@@ -10178,7 +10250,7 @@ var LeaferUI = function(exports) {
|
|
|
10178
10250
|
this.__updateHitCanvas();
|
|
10179
10251
|
if (!layout.boundsChanged) layout.hitCanvasChanged = false;
|
|
10180
10252
|
}
|
|
10181
|
-
return this.__hit(inner);
|
|
10253
|
+
return this.__hit(inner, forceHitFill);
|
|
10182
10254
|
};
|
|
10183
10255
|
leaf$1.__hitFill = function(inner) {
|
|
10184
10256
|
const h = this.__hitCanvas;
|
|
@@ -10237,12 +10309,12 @@ var LeaferUI = function(exports) {
|
|
|
10237
10309
|
this.__drawHitPath(h);
|
|
10238
10310
|
h.setStrokeOptions(data);
|
|
10239
10311
|
};
|
|
10240
|
-
ui$5.__hit = function(inner) {
|
|
10312
|
+
ui$5.__hit = function(inner, forceHitFill) {
|
|
10241
10313
|
if (this.__box && this.__box.__hit(inner)) return true;
|
|
10242
10314
|
const data = this.__;
|
|
10243
10315
|
if (data.__isHitPixel && this.__hitPixel(inner)) return true;
|
|
10244
10316
|
const {hitFill: hitFill} = data;
|
|
10245
|
-
const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all";
|
|
10317
|
+
const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
|
|
10246
10318
|
if (needHitFillPath && this.__hitFill(inner)) return true;
|
|
10247
10319
|
const {hitStroke: hitStroke, __maxStrokeWidth: strokeWidth} = data;
|
|
10248
10320
|
const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
|
|
@@ -10589,6 +10661,7 @@ var LeaferUI = function(exports) {
|
|
|
10589
10661
|
const {boxBounds: boxBounds} = ui.__layout;
|
|
10590
10662
|
switch (paint.type) {
|
|
10591
10663
|
case "image":
|
|
10664
|
+
if (!paint.url) return undefined;
|
|
10592
10665
|
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
10593
10666
|
break;
|
|
10594
10667
|
|
|
@@ -10903,7 +10976,7 @@ var LeaferUI = function(exports) {
|
|
|
10903
10976
|
if (scaleX) scaleHelper(transform, scaleX, scaleY);
|
|
10904
10977
|
translate(transform, box.x + x, box.y + y);
|
|
10905
10978
|
}
|
|
10906
|
-
const {get: get$1, scale: scale$
|
|
10979
|
+
const {get: get$1, scale: scale$1, copy: copy$4} = MatrixHelper;
|
|
10907
10980
|
const {getFloorScale: getFloorScale} = MathHelper, {abs: abs$6} = Math;
|
|
10908
10981
|
function createPatternTask(paint, ui, canvas, renderOptions) {
|
|
10909
10982
|
if (!paint.patternTask) {
|
|
@@ -10932,7 +11005,7 @@ var LeaferUI = function(exports) {
|
|
|
10932
11005
|
scaleY *= getFloorScale(height + (yGap || 0));
|
|
10933
11006
|
imageMatrix = get$1();
|
|
10934
11007
|
if (transform) copy$4(imageMatrix, transform);
|
|
10935
|
-
scale$
|
|
11008
|
+
scale$1(imageMatrix, 1 / scaleX, 1 / scaleY);
|
|
10936
11009
|
}
|
|
10937
11010
|
const imageCanvas = image.getCanvas(width, height, data.opacity, data.filters, xGap, yGap, ui.leafer && ui.leafer.config.smooth);
|
|
10938
11011
|
const pattern = image.getPattern(imageCanvas, data.repeat || (Platform.origin.noRepeat || "no-repeat"), imageMatrix, paint);
|
|
@@ -10962,7 +11035,7 @@ var LeaferUI = function(exports) {
|
|
|
10962
11035
|
if (data.repeat) {
|
|
10963
11036
|
drawImage = false;
|
|
10964
11037
|
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
10965
|
-
drawImage = Platform.image.isLarge(image, scaleX, scaleY);
|
|
11038
|
+
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
10966
11039
|
}
|
|
10967
11040
|
}
|
|
10968
11041
|
if (drawImage) {
|
|
@@ -11018,7 +11091,7 @@ var LeaferUI = function(exports) {
|
|
|
11018
11091
|
if (url) {
|
|
11019
11092
|
if (!recycleMap) recycleMap = {};
|
|
11020
11093
|
recycleMap[url] = true;
|
|
11021
|
-
ImageManager.
|
|
11094
|
+
ImageManager.recyclePaint(paint);
|
|
11022
11095
|
if (image.loading) {
|
|
11023
11096
|
if (!input) {
|
|
11024
11097
|
input = data.__input && data.__input[attrName] || [];
|
|
@@ -11925,7 +11998,7 @@ var LeaferUI = function(exports) {
|
|
|
11925
11998
|
};
|
|
11926
11999
|
}
|
|
11927
12000
|
const {abs: abs$4} = Math;
|
|
11928
|
-
const {copy: copy$2
|
|
12001
|
+
const {copy: copy$2} = MatrixHelper;
|
|
11929
12002
|
const {setListWithFn: setListWithFn} = BoundsHelper;
|
|
11930
12003
|
const {worldBounds: worldBounds} = LeafBoundsHelper;
|
|
11931
12004
|
const matrix$1 = getMatrixData();
|
|
@@ -11964,19 +12037,10 @@ var LeaferUI = function(exports) {
|
|
|
11964
12037
|
const aScaleX = abs$4(worldTransform.scaleX), aScaleY = abs$4(worldTransform.scaleY);
|
|
11965
12038
|
copy$2(matrix$1, worldTransform);
|
|
11966
12039
|
matrix$1.half = strokeWidth % 2;
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
|
|
11970
|
-
|
|
11971
|
-
data.strokeWidth = strokeWidth;
|
|
11972
|
-
const {x: x, y: y, width: width, height: height} = leaf.__layout.boxBounds;
|
|
11973
|
-
canvas.rect(x * aScaleX, y * aScaleY, width * aScaleX, height * aScaleY);
|
|
11974
|
-
} else {
|
|
11975
|
-
canvas.setWorld(matrix$1, options.matrix);
|
|
11976
|
-
canvas.beginPath();
|
|
11977
|
-
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
11978
|
-
data.strokeWidth = strokeWidth / abs$4(worldTransform.scaleX);
|
|
11979
|
-
}
|
|
12040
|
+
canvas.setWorld(matrix$1, options.matrix);
|
|
12041
|
+
canvas.beginPath();
|
|
12042
|
+
if (leaf.__.__useArrow) leaf.__drawPath(canvas); else leaf.__.__pathForRender ? leaf.__drawRenderPath(canvas) : leaf.__drawPathByBox(canvas);
|
|
12043
|
+
data.strokeWidth = strokeWidth / Math.max(aScaleX, aScaleY);
|
|
11980
12044
|
if (stroke) isString(stroke) ? Paint.stroke(stroke, this, canvas, options) : Paint.strokes(stroke, this, canvas, options);
|
|
11981
12045
|
if (fill) isString(fill) ? Paint.fill(fill, this, canvas, options) : Paint.fills(fill, this, canvas, options);
|
|
11982
12046
|
}
|
package/dist/worker.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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"}
|