ice-render 1.4.4 → 1.4.6
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/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/index.umd.js +2 -2
- package/dist/types/ICE.d.mts +19 -0
- package/dist/types/ICE.d.ts +19 -0
- package/dist/types/event/DOMEventDispatcher.d.mts +9 -2
- package/dist/types/event/DOMEventDispatcher.d.ts +9 -2
- package/dist/types/graphic/link/ICEPolyLine.d.mts +7 -0
- package/dist/types/graphic/link/ICEPolyLine.d.ts +7 -0
- package/package.json +1 -1
package/dist/types/ICE.d.mts
CHANGED
|
@@ -57,6 +57,8 @@ declare class ICE {
|
|
|
57
57
|
* backing store 尺寸也会被边框撑大。这里在刷新 rect 时一并读取 computedStyle 补偿。
|
|
58
58
|
*/
|
|
59
59
|
private __contentBox;
|
|
60
|
+
/** 上次用于「位移增量」的矩形快照(不持有 DOMRect 引用,见 __rememberInputRect)。 */
|
|
61
|
+
private __inputRectSnapshot;
|
|
60
62
|
selectionList: Array<any>;
|
|
61
63
|
/** 插件宿主:组件 / 渲染 / 交互工具三层注册点,见 `src/plugin/PluginHost.ts`。 */
|
|
62
64
|
plugins: PluginHost;
|
|
@@ -265,6 +267,23 @@ declare class ICE {
|
|
|
265
267
|
*/
|
|
266
268
|
private __applyDevicePixelRatio;
|
|
267
269
|
updateCanvasBoundingRect(): any;
|
|
270
|
+
/** 记下上次用于「位移增量」的矩形快照。
|
|
271
|
+
*
|
|
272
|
+
* 不能直接复用 `canvasBoundingClientRect` 做差:某些运行时(桩 / 小程序)返回的是
|
|
273
|
+
* **同一个可变对象**,此时 `rect === prev`,增量恒为 0,内容盒就再也不会跟着走。
|
|
274
|
+
*/
|
|
275
|
+
private __rememberInputRect;
|
|
276
|
+
/**
|
|
277
|
+
* 输入路径的**轻量**刷新:只重读一次 `getBoundingClientRect()`,尺寸没变时把已缓存的
|
|
278
|
+
* 内容盒按位移平移,跳过一次 `getComputedStyle`(border/padding 不会每帧变)。
|
|
279
|
+
*
|
|
280
|
+
* 为什么移动事件必须每帧重读:页面滚动、画布上方插入内容(提示条 / 错误信息 / 广告位)
|
|
281
|
+
* 都会让缓存整体过期,过期期间 `clientX - rect.left` 恒定偏移 —— 命中检测、悬停、
|
|
282
|
+
* 拖拽全部错位,而移动事件恰恰是唯一高频入口,不刷新就没人来纠正它。
|
|
283
|
+
*
|
|
284
|
+
* 尺寸变化(窗口缩放、布局改动导致画布变大变小)时退回完整刷新,保证 border/padding 补偿正确。
|
|
285
|
+
*/
|
|
286
|
+
refreshInputRect(): any;
|
|
268
287
|
/**
|
|
269
288
|
* 读取 canvas 内容盒:把 border-box 的 rect 补偿成「绘制区」的偏移与尺寸。
|
|
270
289
|
* 无 getComputedStyle 的运行时(如小程序)补偿为 0,退回 rect 原值。
|
package/dist/types/ICE.d.ts
CHANGED
|
@@ -57,6 +57,8 @@ declare class ICE {
|
|
|
57
57
|
* backing store 尺寸也会被边框撑大。这里在刷新 rect 时一并读取 computedStyle 补偿。
|
|
58
58
|
*/
|
|
59
59
|
private __contentBox;
|
|
60
|
+
/** 上次用于「位移增量」的矩形快照(不持有 DOMRect 引用,见 __rememberInputRect)。 */
|
|
61
|
+
private __inputRectSnapshot;
|
|
60
62
|
selectionList: Array<any>;
|
|
61
63
|
/** 插件宿主:组件 / 渲染 / 交互工具三层注册点,见 `src/plugin/PluginHost.ts`。 */
|
|
62
64
|
plugins: PluginHost;
|
|
@@ -265,6 +267,23 @@ declare class ICE {
|
|
|
265
267
|
*/
|
|
266
268
|
private __applyDevicePixelRatio;
|
|
267
269
|
updateCanvasBoundingRect(): any;
|
|
270
|
+
/** 记下上次用于「位移增量」的矩形快照。
|
|
271
|
+
*
|
|
272
|
+
* 不能直接复用 `canvasBoundingClientRect` 做差:某些运行时(桩 / 小程序)返回的是
|
|
273
|
+
* **同一个可变对象**,此时 `rect === prev`,增量恒为 0,内容盒就再也不会跟着走。
|
|
274
|
+
*/
|
|
275
|
+
private __rememberInputRect;
|
|
276
|
+
/**
|
|
277
|
+
* 输入路径的**轻量**刷新:只重读一次 `getBoundingClientRect()`,尺寸没变时把已缓存的
|
|
278
|
+
* 内容盒按位移平移,跳过一次 `getComputedStyle`(border/padding 不会每帧变)。
|
|
279
|
+
*
|
|
280
|
+
* 为什么移动事件必须每帧重读:页面滚动、画布上方插入内容(提示条 / 错误信息 / 广告位)
|
|
281
|
+
* 都会让缓存整体过期,过期期间 `clientX - rect.left` 恒定偏移 —— 命中检测、悬停、
|
|
282
|
+
* 拖拽全部错位,而移动事件恰恰是唯一高频入口,不刷新就没人来纠正它。
|
|
283
|
+
*
|
|
284
|
+
* 尺寸变化(窗口缩放、布局改动导致画布变大变小)时退回完整刷新,保证 border/padding 补偿正确。
|
|
285
|
+
*/
|
|
286
|
+
refreshInputRect(): any;
|
|
268
287
|
/**
|
|
269
288
|
* 读取 canvas 内容盒:把 border-box 的 rect 补偿成「绘制区」的偏移与尺寸。
|
|
270
289
|
* 无 getComputedStyle 的运行时(如小程序)补偿为 0,退回 rect 原值。
|
|
@@ -47,8 +47,15 @@ declare class DOMEventDispatcher {
|
|
|
47
47
|
private __dispatch;
|
|
48
48
|
/**
|
|
49
49
|
* 取 canvas 矩形用于坐标换算。
|
|
50
|
-
*
|
|
51
|
-
*
|
|
50
|
+
*
|
|
51
|
+
* **移动类事件也必须刷新**(走 `refreshInputRect` 轻量路径:只重读一次
|
|
52
|
+
* `getBoundingClientRect`,尺寸没变就平移已缓存的内容盒、不读 computedStyle),
|
|
53
|
+
* 其余事件走完整 `updateCanvasBoundingRect`。
|
|
54
|
+
*
|
|
55
|
+
* 为什么不做「一帧一次」的节流:布局变化(页面滚动、画布上方插入内容)可能就发生在
|
|
56
|
+
* 两次事件之间,节流会让第二次事件继续用过期矩形 —— 命中检测整体偏移、悬停直接落空。
|
|
57
|
+
* 实测一次 `getBoundingClientRect()` 在布局干净时约 0.22µs、强制重排的最坏情况约 2.8µs,
|
|
58
|
+
* 相对每帧渲染可忽略(见 AGENTS「性能相关铁律」)。
|
|
52
59
|
*/
|
|
53
60
|
private __resolveCanvasRect;
|
|
54
61
|
set stopped(flag: boolean);
|
|
@@ -47,8 +47,15 @@ declare class DOMEventDispatcher {
|
|
|
47
47
|
private __dispatch;
|
|
48
48
|
/**
|
|
49
49
|
* 取 canvas 矩形用于坐标换算。
|
|
50
|
-
*
|
|
51
|
-
*
|
|
50
|
+
*
|
|
51
|
+
* **移动类事件也必须刷新**(走 `refreshInputRect` 轻量路径:只重读一次
|
|
52
|
+
* `getBoundingClientRect`,尺寸没变就平移已缓存的内容盒、不读 computedStyle),
|
|
53
|
+
* 其余事件走完整 `updateCanvasBoundingRect`。
|
|
54
|
+
*
|
|
55
|
+
* 为什么不做「一帧一次」的节流:布局变化(页面滚动、画布上方插入内容)可能就发生在
|
|
56
|
+
* 两次事件之间,节流会让第二次事件继续用过期矩形 —— 命中检测整体偏移、悬停直接落空。
|
|
57
|
+
* 实测一次 `getBoundingClientRect()` 在布局干净时约 0.22µs、强制重排的最坏情况约 2.8µs,
|
|
58
|
+
* 相对每帧渲染可忽略(见 AGENTS「性能相关铁律」)。
|
|
52
59
|
*/
|
|
53
60
|
private __resolveCanvasRect;
|
|
54
61
|
set stopped(flag: boolean);
|
|
@@ -232,6 +232,13 @@ declare class ICEPolyLine extends ICEDotPath {
|
|
|
232
232
|
* 先绘制折线,再绘制连线标签(若 label 非空)。
|
|
233
233
|
*/
|
|
234
234
|
protected doRender(): void;
|
|
235
|
+
/**
|
|
236
|
+
* 用「线色」把端点箭头三角形填实(`arrowStyle: 'filled'`,默认)。
|
|
237
|
+
*
|
|
238
|
+
* 面顶点由 `getArrowFaces()` 提供 —— 与 SVG 导出共用同一份口径(导出器也读它),
|
|
239
|
+
* 避免「画布填了、导出没填」(实心箭头在导出里变空心)。
|
|
240
|
+
*/
|
|
241
|
+
getArrowFaces(): number[][][];
|
|
235
242
|
/**
|
|
236
243
|
* 用「线色」把端点箭头三角形填实(`arrowStyle: 'filled'`,默认)。
|
|
237
244
|
*
|
|
@@ -232,6 +232,13 @@ declare class ICEPolyLine extends ICEDotPath {
|
|
|
232
232
|
* 先绘制折线,再绘制连线标签(若 label 非空)。
|
|
233
233
|
*/
|
|
234
234
|
protected doRender(): void;
|
|
235
|
+
/**
|
|
236
|
+
* 用「线色」把端点箭头三角形填实(`arrowStyle: 'filled'`,默认)。
|
|
237
|
+
*
|
|
238
|
+
* 面顶点由 `getArrowFaces()` 提供 —— 与 SVG 导出共用同一份口径(导出器也读它),
|
|
239
|
+
* 避免「画布填了、导出没填」(实心箭头在导出里变空心)。
|
|
240
|
+
*/
|
|
241
|
+
getArrowFaces(): number[][][];
|
|
235
242
|
/**
|
|
236
243
|
* 用「线色」把端点箭头三角形填实(`arrowStyle: 'filled'`,默认)。
|
|
237
244
|
*
|