leafer-game 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/web.esm.min.js.map +1 -1
- package/dist/web.js +103 -30
- package/dist/web.min.cjs.map +1 -1
- package/dist/web.min.js +1 -1
- package/dist/web.min.js.map +1 -1
- package/dist/web.module.js +103 -30
- package/dist/web.module.min.js +1 -1
- package/dist/web.module.min.js.map +1 -1
- package/package.json +12 -12
package/dist/web.esm.min.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.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":"web.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":"wLA4HYA,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/web.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$3(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$1(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$3, scale: scale$1} = 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
|
const debug$5 = Debug.get("LeaferCanvas");
|
|
6459
6518
|
class LeaferCanvas extends LeaferCanvasBase {
|
|
6460
6519
|
set zIndex(zIndex) {
|
|
@@ -6762,7 +6821,7 @@ var LeaferUI = function(exports) {
|
|
|
6762
6821
|
return this.hasAdd || this.hasRemove || this.hasVisible;
|
|
6763
6822
|
}
|
|
6764
6823
|
get updatedList() {
|
|
6765
|
-
if (this.hasRemove) {
|
|
6824
|
+
if (this.hasRemove && this.config.usePartLayout) {
|
|
6766
6825
|
const updatedList = new LeafList;
|
|
6767
6826
|
this.__updatedList.list.forEach(item => {
|
|
6768
6827
|
if (item.leafer) updatedList.add(item);
|
|
@@ -6797,16 +6856,18 @@ var LeaferUI = function(exports) {
|
|
|
6797
6856
|
if (this.running) this.target.emit(RenderEvent.REQUEST);
|
|
6798
6857
|
}
|
|
6799
6858
|
__onAttrChange(event) {
|
|
6800
|
-
this.__updatedList.add(event.target);
|
|
6859
|
+
if (this.config.usePartLayout) this.__updatedList.add(event.target);
|
|
6801
6860
|
this.update();
|
|
6802
6861
|
}
|
|
6803
6862
|
__onChildEvent(event) {
|
|
6804
|
-
if (
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6863
|
+
if (this.config.usePartLayout) {
|
|
6864
|
+
if (event.type === ChildEvent.ADD) {
|
|
6865
|
+
this.hasAdd = true;
|
|
6866
|
+
this.__pushChild(event.child);
|
|
6867
|
+
} else {
|
|
6868
|
+
this.hasRemove = true;
|
|
6869
|
+
this.__updatedList.add(event.parent);
|
|
6870
|
+
}
|
|
6810
6871
|
}
|
|
6811
6872
|
this.update();
|
|
6812
6873
|
}
|
|
@@ -6913,7 +6974,9 @@ var LeaferUI = function(exports) {
|
|
|
6913
6974
|
class Layouter {
|
|
6914
6975
|
constructor(target, userConfig) {
|
|
6915
6976
|
this.totalTimes = 0;
|
|
6916
|
-
this.config = {
|
|
6977
|
+
this.config = {
|
|
6978
|
+
usePartLayout: true
|
|
6979
|
+
};
|
|
6917
6980
|
this.__levelList = new LeafLevelList;
|
|
6918
6981
|
this.target = target;
|
|
6919
6982
|
if (userConfig) this.config = DataHelper.default(userConfig, this.config);
|
|
@@ -6958,7 +7021,7 @@ var LeaferUI = function(exports) {
|
|
|
6958
7021
|
this.totalTimes++;
|
|
6959
7022
|
this.layouting = true;
|
|
6960
7023
|
this.target.emit(WatchEvent.REQUEST);
|
|
6961
|
-
if (this.totalTimes > 1) {
|
|
7024
|
+
if (this.totalTimes > 1 && this.config.usePartLayout) {
|
|
6962
7025
|
this.partLayout();
|
|
6963
7026
|
} else {
|
|
6964
7027
|
this.fullLayout();
|
|
@@ -7073,7 +7136,7 @@ var LeaferUI = function(exports) {
|
|
|
7073
7136
|
}
|
|
7074
7137
|
update(change = true) {
|
|
7075
7138
|
if (!this.changed) this.changed = change;
|
|
7076
|
-
this.__requestRender();
|
|
7139
|
+
if (!this.requestTime) this.__requestRender();
|
|
7077
7140
|
}
|
|
7078
7141
|
requestLayout() {
|
|
7079
7142
|
this.target.emit(LayoutEvent.REQUEST);
|
|
@@ -7180,7 +7243,7 @@ var LeaferUI = function(exports) {
|
|
|
7180
7243
|
Run.end(t);
|
|
7181
7244
|
}
|
|
7182
7245
|
__render(bounds, realBounds) {
|
|
7183
|
-
const {canvas: canvas} = this, includes = bounds.includes(
|
|
7246
|
+
const {canvas: canvas, target: target} = this, includes = bounds.includes(target.__world), options = includes ? {
|
|
7184
7247
|
includes: includes
|
|
7185
7248
|
} : {
|
|
7186
7249
|
bounds: bounds,
|
|
@@ -7188,12 +7251,16 @@ var LeaferUI = function(exports) {
|
|
|
7188
7251
|
};
|
|
7189
7252
|
if (this.needFill) canvas.fillWorld(bounds, this.config.fill);
|
|
7190
7253
|
if (Debug.showRepaint) Debug.drawRepaint(canvas, bounds);
|
|
7191
|
-
|
|
7254
|
+
if (this.config.useCellRender) options.cellList = this.getCellList();
|
|
7255
|
+
Platform.render(target, canvas, options);
|
|
7192
7256
|
this.renderBounds = realBounds = realBounds || bounds;
|
|
7193
7257
|
this.renderOptions = options;
|
|
7194
7258
|
this.totalBounds.isEmpty() ? this.totalBounds = realBounds : this.totalBounds.add(realBounds);
|
|
7195
7259
|
canvas.updateRender(realBounds);
|
|
7196
7260
|
}
|
|
7261
|
+
getCellList() {
|
|
7262
|
+
return undefined;
|
|
7263
|
+
}
|
|
7197
7264
|
addBlock(block) {
|
|
7198
7265
|
if (!this.updateBlocks) this.updateBlocks = [];
|
|
7199
7266
|
this.updateBlocks.push(block);
|
|
@@ -7405,7 +7472,7 @@ var LeaferUI = function(exports) {
|
|
|
7405
7472
|
hit = child.__.hitRadius ? true : hitRadiusPoint$1(child.__world, point);
|
|
7406
7473
|
if (child.isBranch) {
|
|
7407
7474
|
if (hit || child.__ignoreHitWorld) {
|
|
7408
|
-
if (child.isBranchLeaf && child.__.__clipAfterFill && !child.__hitWorld(point)) continue;
|
|
7475
|
+
if (child.isBranchLeaf && child.__.__clipAfterFill && !child.__hitWorld(point, true)) continue;
|
|
7409
7476
|
if (child.topChildren) this.eachFind(child.topChildren, false);
|
|
7410
7477
|
this.eachFind(child.children, child.__onlyHitMask);
|
|
7411
7478
|
if (child.isBranchLeaf) this.hitChild(child, point);
|
|
@@ -7807,6 +7874,11 @@ var LeaferUI = function(exports) {
|
|
|
7807
7874
|
}
|
|
7808
7875
|
this._boxStyle = value;
|
|
7809
7876
|
}
|
|
7877
|
+
__getInputData(names, options) {
|
|
7878
|
+
const data = super.__getInputData(names, options);
|
|
7879
|
+
if (data.textEditing) delete data.textEditing;
|
|
7880
|
+
return data;
|
|
7881
|
+
}
|
|
7810
7882
|
}
|
|
7811
7883
|
class ImageData extends RectData {
|
|
7812
7884
|
setUrl(value) {
|
|
@@ -10366,7 +10438,7 @@ var LeaferUI = function(exports) {
|
|
|
10366
10438
|
target: this
|
|
10367
10439
|
}) : this.__hitWorld(worldRadiusPoint);
|
|
10368
10440
|
};
|
|
10369
|
-
leaf.__hitWorld = function(point) {
|
|
10441
|
+
leaf.__hitWorld = function(point, forceHitFill) {
|
|
10370
10442
|
const data = this.__;
|
|
10371
10443
|
if (!data.hitSelf) return false;
|
|
10372
10444
|
const world = this.__world, layout = this.__layout;
|
|
@@ -10384,7 +10456,7 @@ var LeaferUI = function(exports) {
|
|
|
10384
10456
|
this.__updateHitCanvas();
|
|
10385
10457
|
if (!layout.boundsChanged) layout.hitCanvasChanged = false;
|
|
10386
10458
|
}
|
|
10387
|
-
return this.__hit(inner);
|
|
10459
|
+
return this.__hit(inner, forceHitFill);
|
|
10388
10460
|
};
|
|
10389
10461
|
leaf.__hitFill = function(inner) {
|
|
10390
10462
|
const h = this.__hitCanvas;
|
|
@@ -10443,12 +10515,12 @@ var LeaferUI = function(exports) {
|
|
|
10443
10515
|
this.__drawHitPath(h);
|
|
10444
10516
|
h.setStrokeOptions(data);
|
|
10445
10517
|
};
|
|
10446
|
-
ui$5.__hit = function(inner) {
|
|
10518
|
+
ui$5.__hit = function(inner, forceHitFill) {
|
|
10447
10519
|
if (this.__box && this.__box.__hit(inner)) return true;
|
|
10448
10520
|
const data = this.__;
|
|
10449
10521
|
if (data.__isHitPixel && this.__hitPixel(inner)) return true;
|
|
10450
10522
|
const {hitFill: hitFill} = data;
|
|
10451
|
-
const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all";
|
|
10523
|
+
const needHitFillPath = (data.fill || data.__isCanvas) && (hitFill === "path" || hitFill === "pixel" && !(data.__isAlphaPixelFill || data.__isCanvas)) || hitFill === "all" || forceHitFill;
|
|
10452
10524
|
if (needHitFillPath && this.__hitFill(inner)) return true;
|
|
10453
10525
|
const {hitStroke: hitStroke, __maxStrokeWidth: strokeWidth} = data;
|
|
10454
10526
|
const needHitStrokePath = data.stroke && (hitStroke === "path" || hitStroke === "pixel" && !data.__isAlphaPixelStroke) || hitStroke === "all";
|
|
@@ -11119,6 +11191,7 @@ var LeaferUI = function(exports) {
|
|
|
11119
11191
|
const {boxBounds: boxBounds} = ui.__layout;
|
|
11120
11192
|
switch (paint.type) {
|
|
11121
11193
|
case "image":
|
|
11194
|
+
if (!paint.url) return undefined;
|
|
11122
11195
|
leafPaint = PaintImage.image(ui, attrName, paint, boxBounds, !recycleMap || !recycleMap[paint.url]);
|
|
11123
11196
|
break;
|
|
11124
11197
|
|
|
@@ -11492,7 +11565,7 @@ var LeaferUI = function(exports) {
|
|
|
11492
11565
|
if (data.repeat) {
|
|
11493
11566
|
drawImage = false;
|
|
11494
11567
|
} else if (!(originPaint.changeful || Platform.name === "miniapp" && ResizeEvent.isResizing(ui) || exporting)) {
|
|
11495
|
-
drawImage = Platform.image.isLarge(image, scaleX, scaleY);
|
|
11568
|
+
drawImage = Platform.image.isLarge(image, scaleX, scaleY) || image.width * scaleX > 8096 || image.height * scaleY > 8096;
|
|
11496
11569
|
}
|
|
11497
11570
|
}
|
|
11498
11571
|
if (drawImage) {
|
|
@@ -11548,7 +11621,7 @@ var LeaferUI = function(exports) {
|
|
|
11548
11621
|
if (url) {
|
|
11549
11622
|
if (!recycleMap) recycleMap = {};
|
|
11550
11623
|
recycleMap[url] = true;
|
|
11551
|
-
ImageManager.
|
|
11624
|
+
ImageManager.recyclePaint(paint);
|
|
11552
11625
|
if (image.loading) {
|
|
11553
11626
|
if (!input) {
|
|
11554
11627
|
input = data.__input && data.__input[attrName] || [];
|
package/dist/web.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.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":"web.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,sLAAAA,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"}
|