@visactor/vrender-core 0.21.12-alpha.1 → 0.21.12-alpha.3

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.
Files changed (76) hide show
  1. package/cjs/animate/animate.js +1 -1
  2. package/cjs/animate/config.js +1 -1
  3. package/cjs/animate/custom-animate.js +1 -1
  4. package/cjs/animate/default-ticker.js +1 -1
  5. package/cjs/animate/easing.js +1 -1
  6. package/cjs/animate/group-fade.js +1 -1
  7. package/cjs/animate/index.js +1 -1
  8. package/cjs/animate/morphing.js +1 -2
  9. package/cjs/animate/timeline.js +1 -1
  10. package/cjs/canvas/empty-context.js +2 -1
  11. package/cjs/color-string/store.js +2 -1
  12. package/cjs/common/bounds-context.js +1 -2
  13. package/cjs/common/morphing-utils.js +1 -1
  14. package/cjs/common/path-svg.js +1 -1
  15. package/cjs/common/polygon.js +2 -1
  16. package/cjs/common/rect-utils.js +1 -1
  17. package/cjs/common/render-area.js +1 -1
  18. package/cjs/common/render-command-list.js +1 -1
  19. package/cjs/common/render-curve.js +1 -1
  20. package/cjs/common/render-utils.js +1 -1
  21. package/cjs/common/seg-context.js +1 -1
  22. package/cjs/common/simplify.js +1 -1
  23. package/cjs/common/sort.js +1 -1
  24. package/cjs/common/split-path.js +1 -1
  25. package/cjs/common/store.js +1 -1
  26. package/cjs/common/text.js +1 -1
  27. package/cjs/common/utils.js +1 -1
  28. package/cjs/core/application.js +1 -2
  29. package/cjs/core/index.js +1 -1
  30. package/cjs/core/layer-service.js +1 -1
  31. package/cjs/core/layer.js +1 -1
  32. package/cjs/core/light.js +1 -1
  33. package/cjs/core/stage.js +1 -1
  34. package/cjs/core/window.js +1 -1
  35. package/cjs/plugins/builtin-plugin/auto-refresh-plugin.d.ts +1 -0
  36. package/cjs/plugins/builtin-plugin/auto-refresh-plugin.js +9 -3
  37. package/cjs/plugins/builtin-plugin/auto-refresh-plugin.js.map +1 -1
  38. package/dist/index.es.js +13 -1
  39. package/es/animate/animate.js +1 -1
  40. package/es/animate/config.js +1 -1
  41. package/es/animate/custom-animate.js +1 -1
  42. package/es/animate/default-ticker.js +1 -1
  43. package/es/animate/easing.js +1 -1
  44. package/es/animate/group-fade.js +1 -1
  45. package/es/animate/index.js +1 -1
  46. package/es/animate/morphing.js +1 -2
  47. package/es/animate/timeline.js +1 -1
  48. package/es/canvas/empty-context.js +2 -1
  49. package/es/color-string/store.js +2 -1
  50. package/es/common/bounds-context.js +1 -2
  51. package/es/common/morphing-utils.js +1 -1
  52. package/es/common/path-svg.js +1 -1
  53. package/es/common/polygon.js +2 -1
  54. package/es/common/rect-utils.js +1 -1
  55. package/es/common/render-area.js +1 -1
  56. package/es/common/render-command-list.js +1 -1
  57. package/es/common/render-curve.js +1 -1
  58. package/es/common/render-utils.js +1 -1
  59. package/es/common/seg-context.js +1 -1
  60. package/es/common/simplify.js +1 -1
  61. package/es/common/sort.js +1 -1
  62. package/es/common/split-path.js +1 -1
  63. package/es/common/store.js +1 -1
  64. package/es/common/text.js +1 -1
  65. package/es/common/utils.js +1 -1
  66. package/es/core/application.js +1 -2
  67. package/es/core/index.js +1 -1
  68. package/es/core/layer-service.js +1 -1
  69. package/es/core/layer.js +1 -1
  70. package/es/core/light.js +1 -1
  71. package/es/core/stage.js +1 -1
  72. package/es/core/window.js +1 -1
  73. package/es/plugins/builtin-plugin/auto-refresh-plugin.d.ts +1 -0
  74. package/es/plugins/builtin-plugin/auto-refresh-plugin.js +9 -3
  75. package/es/plugins/builtin-plugin/auto-refresh-plugin.js.map +1 -1
  76. package/package.json +19 -19
@@ -400,4 +400,4 @@ class Step {
400
400
  return null;
401
401
  }
402
402
  }
403
- //# sourceMappingURL=animate.js.map
403
+ //# sourceMappingURL=animate.js.map
@@ -10,4 +10,4 @@ exports.DefaultStateAnimateConfig = {
10
10
  duration: 1e3,
11
11
  easing: "quadInOut"
12
12
  };
13
- //# sourceMappingURL=config.js.map
13
+ //# sourceMappingURL=config.js.map
@@ -730,4 +730,4 @@ class AnimateGroup1 extends animate_1.ACustomAnimate {
730
730
  }
731
731
 
732
732
  exports.AnimateGroup1 = AnimateGroup1;
733
- //# sourceMappingURL=custom-animate.js.map
733
+ //# sourceMappingURL=custom-animate.js.map
@@ -11,4 +11,4 @@ exports.defaultTicker = new default_ticker_1.DefaultTicker, exports.defaultTicke
11
11
  const TICKER_FPS = 60;
12
12
 
13
13
  exports.defaultTicker.setFPS(60);
14
- //# sourceMappingURL=default-ticker.js.map
14
+ //# sourceMappingURL=default-ticker.js.map
@@ -115,4 +115,4 @@ Easing.quintIn = Easing.getPowIn(5), Easing.quintOut = Easing.getPowOut(5), Easi
115
115
  Easing.backIn = Easing.getBackIn(1.7), Easing.backOut = Easing.getBackOut(1.7),
116
116
  Easing.backInOut = Easing.getBackInOut(1.7), Easing.elasticIn = Easing.getElasticIn(1, .3),
117
117
  Easing.elasticOut = Easing.getElasticOut(1, .3), Easing.elasticInOut = Easing.getElasticInOut(1, .3 * 1.5);
118
- //# sourceMappingURL=easing.js.map
118
+ //# sourceMappingURL=easing.js.map
@@ -63,4 +63,4 @@ class GroupFadeOut extends animate_1.ACustomAnimate {
63
63
  }
64
64
 
65
65
  exports.GroupFadeOut = GroupFadeOut;
66
- //# sourceMappingURL=group-fade.js.map
66
+ //# sourceMappingURL=group-fade.js.map
@@ -21,4 +21,4 @@ Object.defineProperty(exports, "__esModule", {
21
21
  __exportStar(require("./config"), exports), __exportStar(require("./custom-animate"), exports),
22
22
  __exportStar(require("./morphing"), exports), __exportStar(require("./timeline"), exports),
23
23
  __exportStar(require("./group-fade"), exports);
24
- //# sourceMappingURL=index.js.map
24
+ //# sourceMappingURL=index.js.map
@@ -288,5 +288,4 @@ const multiToOneMorph = (fromGraphics, toGraphic, animationConfig) => {
288
288
  }
289
289
  };
290
290
 
291
- exports.multiToOneMorph = multiToOneMorph;
292
- //# sourceMappingURL=morphing.js.map
291
+ exports.multiToOneMorph = multiToOneMorph;
@@ -43,4 +43,4 @@ class DefaultTimeline {
43
43
  }
44
44
 
45
45
  exports.DefaultTimeline = DefaultTimeline, exports.defaultTimeline = new DefaultTimeline;
46
- //# sourceMappingURL=timeline.js.map
46
+ //# sourceMappingURL=timeline.js.map
@@ -209,4 +209,5 @@ let EmptyContext2d = class {
209
209
  };
210
210
 
211
211
  EmptyContext2d = __decorate([ (0, inversify_lite_1.injectable)(), __metadata("design:paramtypes", [ Object, Number ]) ], EmptyContext2d),
212
- exports.EmptyContext2d = EmptyContext2d;
212
+ exports.EmptyContext2d = EmptyContext2d;
213
+ //# sourceMappingURL=empty-context.js.map
@@ -50,4 +50,5 @@ class ColorStore {
50
50
  }
51
51
  }
52
52
 
53
- exports.ColorStore = ColorStore, ColorStore.store255 = {}, ColorStore.store1 = {};
53
+ exports.ColorStore = ColorStore, ColorStore.store255 = {}, ColorStore.store1 = {};
54
+ //# sourceMappingURL=store.js.map
@@ -56,5 +56,4 @@ class BoundsContext {
56
56
  release(...params) {}
57
57
  }
58
58
 
59
- exports.BoundsContext = BoundsContext;
60
- //# sourceMappingURL=bounds-context.js.map
59
+ exports.BoundsContext = BoundsContext;
@@ -292,4 +292,4 @@ function bezierCurversToPath(bezierCurves) {
292
292
 
293
293
  exports.pathToBezierCurves = pathToBezierCurves, exports.applyTransformOnBezierCurves = applyTransformOnBezierCurves,
294
294
  exports.bezierCurversToPath = bezierCurversToPath;
295
- //# sourceMappingURL=morphing-utils.js.map
295
+ //# sourceMappingURL=morphing-utils.js.map
@@ -61,4 +61,4 @@ exports.enumCommandMap = {
61
61
  Q: 7,
62
62
  R: 8
63
63
  }, exports.parseSvgPath = parseSvgPath;
64
- //# sourceMappingURL=path-svg.js.map
64
+ //# sourceMappingURL=path-svg.js.map
@@ -42,4 +42,5 @@ function getProportionPoint(point, segment, length, dx, dy) {
42
42
  Object.defineProperty(exports, "__esModule", {
43
43
  value: !0
44
44
  }), exports.drawRoundedPolygon = exports.drawPolygon = void 0, exports.drawPolygon = drawPolygon,
45
- exports.drawRoundedPolygon = drawRoundedPolygon;
45
+ exports.drawRoundedPolygon = drawRoundedPolygon;
46
+ //# sourceMappingURL=polygon.js.map
@@ -24,4 +24,4 @@ const vutils_1 = require("@visactor/vutils"), normalizeRectAttributes = attribut
24
24
  };
25
25
 
26
26
  exports.normalizeRectAttributes = normalizeRectAttributes;
27
- //# sourceMappingURL=rect-utils.js.map
27
+ //# sourceMappingURL=rect-utils.js.map
@@ -61,5 +61,5 @@ function drawAreaBlock(path, topList, bottomList, params) {
61
61
  path.closePath();
62
62
  }
63
63
 
64
+ exports.drawAreaSegments = drawAreaSegments;
64
65
  //# sourceMappingURL=render-area.js.map
65
- exports.drawAreaSegments = drawAreaSegments;
@@ -14,4 +14,4 @@ function renderCommandList(commandList, context, x = 0, y = 0, sx = 1, sy = 1, z
14
14
  }
15
15
 
16
16
  exports.renderCommandList = renderCommandList;
17
- //# sourceMappingURL=render-command-list.js.map
17
+ //# sourceMappingURL=render-command-list.js.map
@@ -99,4 +99,4 @@ function drawIncrementalAreaSegments(path, lastSeg, segments, params) {
99
99
 
100
100
  exports.drawSegments = drawSegments, exports.drawIncrementalSegments = drawIncrementalSegments,
101
101
  exports.drawIncrementalAreaSegments = drawIncrementalAreaSegments;
102
- //# sourceMappingURL=render-curve.js.map
102
+ //# sourceMappingURL=render-curve.js.map
@@ -19,4 +19,4 @@ function drawSegItem(ctx, curve, endPercent, params) {
19
19
  }
20
20
 
21
21
  exports.drawSegItem = drawSegItem;
22
- //# sourceMappingURL=render-utils.js.map
22
+ //# sourceMappingURL=render-utils.js.map
@@ -95,4 +95,4 @@ class ReflectSegContext extends SegContext {
95
95
  }
96
96
 
97
97
  exports.ReflectSegContext = ReflectSegContext;
98
- //# sourceMappingURL=seg-context.js.map
98
+ //# sourceMappingURL=seg-context.js.map
@@ -36,4 +36,4 @@ function flatten_simplify(points, tolerance, highestQuality) {
36
36
  Object.defineProperty(exports, "__esModule", {
37
37
  value: !0
38
38
  }), exports.flatten_simplify = void 0, exports.flatten_simplify = flatten_simplify;
39
- //# sourceMappingURL=simplify.js.map
39
+ //# sourceMappingURL=simplify.js.map
@@ -101,4 +101,4 @@ Object.defineProperty(exports, "__esModule", {
101
101
  value: !0
102
102
  }), exports.findNextGraphic = exports.foreachAsync = exports.foreach = void 0, exports.foreach = foreach,
103
103
  exports.foreachAsync = foreachAsync, exports.findNextGraphic = findNextGraphic;
104
- //# sourceMappingURL=sort.js.map
104
+ //# sourceMappingURL=sort.js.map
@@ -269,4 +269,4 @@ const splitPath = (path, count) => {
269
269
  };
270
270
 
271
271
  exports.splitPath = splitPath;
272
- //# sourceMappingURL=split-path.js.map
272
+ //# sourceMappingURL=split-path.js.map
@@ -1,2 +1,2 @@
1
1
  class StageStore {}
2
- //# sourceMappingURL=store.js.map
2
+ //# sourceMappingURL=store.js.map
@@ -34,4 +34,4 @@ function textAttributesToStyle(attrs) {
34
34
 
35
35
  exports.textDrawOffsetY = textDrawOffsetY, exports.textDrawOffsetX = textDrawOffsetX,
36
36
  exports.textLayoutOffsetY = textLayoutOffsetY, exports.textAttributesToStyle = textAttributesToStyle;
37
- //# sourceMappingURL=text.js.map
37
+ //# sourceMappingURL=text.js.map
@@ -167,4 +167,4 @@ const calculateLineHeight = (lineHeight, fontSize) => {
167
167
  };
168
168
 
169
169
  exports.calculateLineHeight = calculateLineHeight;
170
- //# sourceMappingURL=utils.js.map
170
+ //# sourceMappingURL=utils.js.map
@@ -2,5 +2,4 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.ApplicationContribution = void 0, exports.ApplicationContribution = Symbol("ApplicationContribution");
6
- //# sourceMappingURL=application.js.map
5
+ }), exports.ApplicationContribution = void 0, exports.ApplicationContribution = Symbol("ApplicationContribution");
package/cjs/core/index.js CHANGED
@@ -22,4 +22,4 @@ __exportStar(require("./layer"), exports), __exportStar(require("./stage"), expo
22
22
  __exportStar(require("./graphic-utils"), exports), __exportStar(require("./contributions"), exports),
23
23
  __exportStar(require("./layer-service"), exports), __exportStar(require("./constants"), exports),
24
24
  __exportStar(require("../interface/core"), exports);
25
- //# sourceMappingURL=index.js.map
25
+ //# sourceMappingURL=index.js.map
@@ -80,4 +80,4 @@ let DefaultLayerService = DefaultLayerService_1 = class {
80
80
  DefaultLayerService.idprefix = "visactor_layer", DefaultLayerService.prefix_count = 0,
81
81
  DefaultLayerService = DefaultLayerService_1 = __decorate([ (0, inversify_lite_1.injectable)(), __metadata("design:paramtypes", []) ], DefaultLayerService),
82
82
  exports.DefaultLayerService = DefaultLayerService;
83
- //# sourceMappingURL=layer-service.js.map
83
+ //# sourceMappingURL=layer-service.js.map
package/cjs/core/layer.js CHANGED
@@ -116,4 +116,4 @@ class Layer extends group_1.Group {
116
116
  }
117
117
 
118
118
  exports.Layer = Layer;
119
- //# sourceMappingURL=layer.js.map
119
+ //# sourceMappingURL=layer.js.map
package/cjs/core/light.js CHANGED
@@ -29,4 +29,4 @@ const registerDirectionalLight = () => {
29
29
  };
30
30
 
31
31
  exports.registerDirectionalLight = registerDirectionalLight;
32
- //# sourceMappingURL=light.js.map
32
+ //# sourceMappingURL=light.js.map
package/cjs/core/stage.js CHANGED
@@ -516,4 +516,4 @@ class Stage extends group_1.Group {
516
516
  }
517
517
 
518
518
  exports.Stage = Stage;
519
- //# sourceMappingURL=stage.js.map
519
+ //# sourceMappingURL=stage.js.map
@@ -153,4 +153,4 @@ let DefaultWindow = class {
153
153
 
154
154
  DefaultWindow = __decorate([ (0, inversify_lite_1.injectable)(), __metadata("design:paramtypes", []) ], DefaultWindow),
155
155
  exports.DefaultWindow = DefaultWindow;
156
- //# sourceMappingURL=window.js.map
156
+ //# sourceMappingURL=window.js.map
@@ -7,6 +7,7 @@ export declare class AutoRefreshPlugin implements IPlugin {
7
7
  key: string;
8
8
  dpr: number;
9
9
  rafId: number;
10
+ autoRefreshCbs?: (() => void)[];
10
11
  handleChange: (graphic: IGraphic) => void;
11
12
  activate(context: IPluginService): void;
12
13
  refresh(): void;
@@ -31,16 +31,22 @@ class AutoRefreshPlugin {
31
31
  try {
32
32
  const mqString = `(resolution: ${window.devicePixelRatio}dppx)`, updatePixelRatio = () => {
33
33
  window.devicePixelRatio !== this.dpr && (this.dpr = window.devicePixelRatio, this.pluginService.stage.setDpr(this.dpr, !0));
34
- };
35
- matchMedia(mqString).addEventListener("change", updatePixelRatio);
34
+ }, dom = matchMedia(mqString);
35
+ dom && dom.addEventListener("change", updatePixelRatio), this.autoRefreshCbs || (this.autoRefreshCbs = []),
36
+ this.autoRefreshCbs.push((() => {
37
+ dom && dom.removeEventListener("change", updatePixelRatio);
38
+ }));
36
39
  } catch (err) {
37
40
  return !1;
38
41
  }
39
42
  return !0;
40
43
  }
41
44
  deactivate(context) {
45
+ var _a;
42
46
  const craf = application_1.application.global.getCancelAnimationFrame();
43
- craf && this.rafId && craf(this.rafId);
47
+ craf && this.rafId && craf(this.rafId), null === (_a = this.autoRefreshCbs) || void 0 === _a || _a.forEach((cb => {
48
+ cb();
49
+ })), this.autoRefreshCbs = void 0;
44
50
  }
45
51
  }
46
52
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/builtin-plugin/auto-refresh-plugin.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AACnD,mDAAgD;AAGhD,MAAa,iBAAiB;IAA9B;QACE,SAAI,GAAwB,mBAAmB,CAAC;QAChD,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,qBAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAIpC,iBAAY,GAAG,CAAC,OAAiB,EAAE,EAAE;YACnC,IAAI,OAAO,CAAC,SAAS,EAAE;gBACrB,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;aAC7B;YACD,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE;gBACvE,OAAO,CAAC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AAC,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;SACnE;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,UAAU,CAAC,OAAuB;QAChC,MAAM,IAAI,GAAG,yBAAW,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC;QAC1D,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CACF;AA5DD,8CA4DC","file":"auto-refresh-plugin.js","sourcesContent":["import { Generator } from '../../common/generator';\nimport { application } from '../../application';\nimport type { IGraphic, IPlugin, IPluginService } from '../../interface';\n\nexport class AutoRefreshPlugin implements IPlugin {\n name: 'AutoRefreshPlugin' = 'AutoRefreshPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n dpr: number;\n rafId: number;\n\n handleChange = (graphic: IGraphic) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (graphic.stage === this.pluginService.stage && graphic.stage != null) {\n graphic.stage.renderNextFrame();\n }\n };\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n this.dpr = application.global.devicePixelRatio;\n this.refresh();\n }\n\n refresh() {\n if (!this._refreshByMediaQuery()) {\n this._refreshByRaf();\n }\n }\n protected _refreshByRaf() {\n const raf = application.global.getRequestAnimationFrame();\n this.rafId = raf(() => {\n if (application.global.devicePixelRatio !== this.dpr) {\n this.dpr = application.global.devicePixelRatio;\n this.pluginService.stage.setDpr(this.dpr, true);\n }\n this.refresh();\n });\n }\n protected _refreshByMediaQuery() {\n try {\n const mqString = `(resolution: ${window.devicePixelRatio}dppx)`;\n\n const updatePixelRatio = () => {\n if (window.devicePixelRatio !== this.dpr) {\n this.dpr = window.devicePixelRatio;\n this.pluginService.stage.setDpr(this.dpr, true);\n }\n };\n\n matchMedia(mqString).addEventListener('change', updatePixelRatio);\n } catch (err) {\n return false;\n }\n return true;\n }\n deactivate(context: IPluginService): void {\n const craf = application.global.getCancelAnimationFrame();\n craf && this.rafId && craf(this.rafId);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/plugins/builtin-plugin/auto-refresh-plugin.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AACnD,mDAAgD;AAGhD,MAAa,iBAAiB;IAA9B;QACE,SAAI,GAAwB,mBAAmB,CAAC;QAChD,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,qBAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAKpC,iBAAY,GAAG,CAAC,OAAiB,EAAE,EAAE;YACnC,IAAI,OAAO,CAAC,SAAS,EAAE;gBACrB,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;aAC7B;YACD,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,IAAI,IAAI,EAAE;gBACvE,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;aACjC;QACH,CAAC,CAAC;IAsDJ,CAAC;IApDC,QAAQ,CAAC,OAAuB;QAC9B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC7B,IAAI,CAAC,GAAG,GAAG,yBAAW,CAAC,MAAM,CAAC,gBAAgB,CAAC;QAC/C,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE;YAChC,IAAI,CAAC,aAAa,EAAE,CAAC;SACtB;IACH,CAAC;IACS,aAAa;QACrB,MAAM,GAAG,GAAG,yBAAW,CAAC,MAAM,CAAC,wBAAwB,EAAE,CAAC;QAC1D,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,GAA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BAAW,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC;QAC1D,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvC,MAAA,IAAI,CAAC,cAAc,0CAAE,OAAO,CAAC,EAAE,CAAC,EAAE;YAChC,EAAE,EAAE,CAAC;QACP,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;IAClC,CAAC;CACF;AAvED,8CAuEC","file":"auto-refresh-plugin.js","sourcesContent":["import { Generator } from '../../common/generator';\nimport { application } from '../../application';\nimport type { IGraphic, IPlugin, IPluginService } from '../../interface';\n\nexport class AutoRefreshPlugin implements IPlugin {\n name: 'AutoRefreshPlugin' = 'AutoRefreshPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n dpr: number;\n rafId: number;\n autoRefreshCbs?: (() => void)[];\n\n handleChange = (graphic: IGraphic) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (graphic.stage === this.pluginService.stage && graphic.stage != null) {\n graphic.stage.renderNextFrame();\n }\n };\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n this.dpr = application.global.devicePixelRatio;\n this.refresh();\n }\n\n refresh() {\n if (!this._refreshByMediaQuery()) {\n this._refreshByRaf();\n }\n }\n protected _refreshByRaf() {\n const raf = application.global.getRequestAnimationFrame();\n this.rafId = raf(() => {\n if (application.global.devicePixelRatio !== this.dpr) {\n this.dpr = application.global.devicePixelRatio;\n this.pluginService.stage.setDpr(this.dpr, true);\n }\n this.refresh();\n });\n }\n protected _refreshByMediaQuery() {\n try {\n const mqString = `(resolution: ${window.devicePixelRatio}dppx)`;\n\n const updatePixelRatio = () => {\n if (window.devicePixelRatio !== this.dpr) {\n this.dpr = window.devicePixelRatio;\n this.pluginService.stage.setDpr(this.dpr, true);\n }\n };\n const dom = matchMedia(mqString);\n dom && dom.addEventListener('change', updatePixelRatio);\n if (!this.autoRefreshCbs) {\n this.autoRefreshCbs = [];\n }\n this.autoRefreshCbs.push(() => {\n dom && dom.removeEventListener('change', updatePixelRatio);\n });\n } catch (err) {\n return false;\n }\n return true;\n }\n deactivate(context: IPluginService): void {\n const craf = application.global.getCancelAnimationFrame();\n craf && this.rafId && craf(this.rafId);\n this.autoRefreshCbs?.forEach(cb => {\n cb();\n });\n this.autoRefreshCbs = undefined;\n }\n}\n"]}
package/dist/index.es.js CHANGED
@@ -24197,7 +24197,14 @@ class AutoRefreshPlugin {
24197
24197
  this.pluginService.stage.setDpr(this.dpr, true);
24198
24198
  }
24199
24199
  };
24200
- matchMedia(mqString).addEventListener('change', updatePixelRatio);
24200
+ const dom = matchMedia(mqString);
24201
+ dom && dom.addEventListener('change', updatePixelRatio);
24202
+ if (!this.autoRefreshCbs) {
24203
+ this.autoRefreshCbs = [];
24204
+ }
24205
+ this.autoRefreshCbs.push(() => {
24206
+ dom && dom.removeEventListener('change', updatePixelRatio);
24207
+ });
24201
24208
  }
24202
24209
  catch (err) {
24203
24210
  return false;
@@ -24205,8 +24212,13 @@ class AutoRefreshPlugin {
24205
24212
  return true;
24206
24213
  }
24207
24214
  deactivate(context) {
24215
+ var _a;
24208
24216
  const craf = application.global.getCancelAnimationFrame();
24209
24217
  craf && this.rafId && craf(this.rafId);
24218
+ (_a = this.autoRefreshCbs) === null || _a === void 0 ? void 0 : _a.forEach(cb => {
24219
+ cb();
24220
+ });
24221
+ this.autoRefreshCbs = undefined;
24210
24222
  }
24211
24223
  }
24212
24224
 
@@ -395,4 +395,4 @@ class Step {
395
395
  return null;
396
396
  }
397
397
  }
398
- //# sourceMappingURL=animate.js.map
398
+ //# sourceMappingURL=animate.js.map
@@ -7,4 +7,4 @@ export const DefaultMorphingAnimateConfig = {
7
7
  duration: 1e3,
8
8
  easing: "quadInOut"
9
9
  };
10
- //# sourceMappingURL=config.js.map
10
+ //# sourceMappingURL=config.js.map
@@ -707,4 +707,4 @@ export class AnimateGroup1 extends ACustomAnimate {
707
707
  })), this.updating = !1);
708
708
  }
709
709
  }
710
- //# sourceMappingURL=custom-animate.js.map
710
+ //# sourceMappingURL=custom-animate.js.map
@@ -9,4 +9,4 @@ defaultTicker.addTimeline(defaultTimeline);
9
9
  const TICKER_FPS = 60;
10
10
 
11
11
  defaultTicker.setFPS(60);
12
- //# sourceMappingURL=default-ticker.js.map
12
+ //# sourceMappingURL=default-ticker.js.map
@@ -108,4 +108,4 @@ Easing.quintIn = Easing.getPowIn(5), Easing.quintOut = Easing.getPowOut(5), Easi
108
108
  Easing.backIn = Easing.getBackIn(1.7), Easing.backOut = Easing.getBackOut(1.7),
109
109
  Easing.backInOut = Easing.getBackInOut(1.7), Easing.elasticIn = Easing.getElasticIn(1, .3),
110
110
  Easing.elasticOut = Easing.getElasticOut(1, .3), Easing.elasticInOut = Easing.getElasticInOut(1, .3 * 1.5);
111
- //# sourceMappingURL=easing.js.map
111
+ //# sourceMappingURL=easing.js.map
@@ -53,4 +53,4 @@ export class GroupFadeOut extends ACustomAnimate {
53
53
  });
54
54
  }
55
55
  }
56
- //# sourceMappingURL=group-fade.js.map
56
+ //# sourceMappingURL=group-fade.js.map
@@ -11,4 +11,4 @@ export * from "./morphing";
11
11
  export * from "./timeline";
12
12
 
13
13
  export * from "./group-fade";
14
- //# sourceMappingURL=index.js.map
14
+ //# sourceMappingURL=index.js.map
@@ -291,5 +291,4 @@ export const multiToOneMorph = (fromGraphics, toGraphic, animationConfig) => {
291
291
  otherAttrs: otherAttrs
292
292
  }, null !== (_b = null == animationConfig ? void 0 : animationConfig.duration) && void 0 !== _b ? _b : DefaultMorphingAnimateConfig.duration, null !== (_c = null == animationConfig ? void 0 : animationConfig.easing) && void 0 !== _c ? _c : DefaultMorphingAnimateConfig.easing));
293
293
  }
294
- };
295
- //# sourceMappingURL=morphing.js.map
294
+ };
@@ -39,4 +39,4 @@ export class DefaultTimeline {
39
39
  }
40
40
 
41
41
  export const defaultTimeline = new DefaultTimeline;
42
- //# sourceMappingURL=timeline.js.map
42
+ //# sourceMappingURL=timeline.js.map
@@ -215,4 +215,5 @@ let EmptyContext2d = class {
215
215
 
216
216
  EmptyContext2d = __decorate([ injectable(), __metadata("design:paramtypes", [ Object, Number ]) ], EmptyContext2d);
217
217
 
218
- export { EmptyContext2d };
218
+ export { EmptyContext2d };
219
+ //# sourceMappingURL=empty-context.js.map
@@ -44,4 +44,5 @@ export class ColorStore {
44
44
  }
45
45
  }
46
46
 
47
- ColorStore.store255 = {}, ColorStore.store1 = {};
47
+ ColorStore.store255 = {}, ColorStore.store1 = {};
48
+ //# sourceMappingURL=store.js.map
@@ -49,5 +49,4 @@ export class BoundsContext {
49
49
  this.bounds.clear();
50
50
  }
51
51
  release(...params) {}
52
- }
53
- //# sourceMappingURL=bounds-context.js.map
52
+ }
@@ -284,4 +284,4 @@ export function bezierCurversToPath(bezierCurves) {
284
284
  }
285
285
  return path;
286
286
  }
287
- //# sourceMappingURL=morphing-utils.js.map
287
+ //# sourceMappingURL=morphing-utils.js.map
@@ -55,4 +55,4 @@ export function parseSvgPath(str) {
55
55
  } else result.push(currCommandData);
56
56
  return result;
57
57
  }
58
- //# sourceMappingURL=path-svg.js.map
58
+ //# sourceMappingURL=path-svg.js.map
@@ -35,4 +35,5 @@ function getProportionPoint(point, segment, length, dx, dy) {
35
35
  x: point.x - dx * factor,
36
36
  y: point.y - dy * factor
37
37
  };
38
- }
38
+ }
39
+ //# sourceMappingURL=polygon.js.map
@@ -17,4 +17,4 @@ export const normalizeRectAttributes = attribute => {
17
17
  height: height
18
18
  };
19
19
  };
20
- //# sourceMappingURL=rect-utils.js.map
20
+ //# sourceMappingURL=rect-utils.js.map
@@ -61,4 +61,4 @@ function drawAreaBlock(path, topList, bottomList, params) {
61
61
  }
62
62
  path.closePath();
63
63
  }
64
- //# sourceMappingURL=render-area.js.map
64
+ //# sourceMappingURL=render-area.js.map
@@ -6,4 +6,4 @@ export function renderCommandList(commandList, context, x = 0, y = 0, sx = 1, sy
6
6
  commandFuncs[command[0]](command, context, x, y, sx, sy, z);
7
7
  }
8
8
  }
9
- //# sourceMappingURL=render-command-list.js.map
9
+ //# sourceMappingURL=render-command-list.js.map
@@ -93,4 +93,4 @@ export function drawIncrementalAreaSegments(path, lastSeg, segments, params) {
93
93
  path.closePath();
94
94
  }));
95
95
  }
96
- //# sourceMappingURL=render-curve.js.map
96
+ //# sourceMappingURL=render-curve.js.map
@@ -11,4 +11,4 @@ export function drawSegItem(ctx, curve, endPercent, params) {
11
11
  ctx.lineTo(offsetX + p.x, offsetY + p.y, offsetZ);
12
12
  }
13
13
  }
14
- //# sourceMappingURL=render-utils.js.map
14
+ //# sourceMappingURL=render-utils.js.map
@@ -91,4 +91,4 @@ export class ReflectSegContext extends SegContext {
91
91
  return super.clear();
92
92
  }
93
93
  }
94
- //# sourceMappingURL=seg-context.js.map
94
+ //# sourceMappingURL=seg-context.js.map
@@ -30,4 +30,4 @@ export function flatten_simplify(points, tolerance, highestQuality) {
30
30
  if (points.length <= 10) return points;
31
31
  return points = highestQuality ? points : simplifyRadialDist(points, void 0 !== tolerance ? tolerance * tolerance : 1);
32
32
  }
33
- //# sourceMappingURL=simplify.js.map
33
+ //# sourceMappingURL=simplify.js.map
package/es/common/sort.js CHANGED
@@ -94,4 +94,4 @@ export function findNextGraphic(graphic, id, defaultZIndex, reverse = !1) {
94
94
  !1)), reverse);
95
95
  return result;
96
96
  }
97
- //# sourceMappingURL=sort.js.map
97
+ //# sourceMappingURL=sort.js.map
@@ -248,4 +248,4 @@ export const splitPath = (path, count) => {
248
248
  }
249
249
  return res;
250
250
  };
251
- //# sourceMappingURL=split-path.js.map
251
+ //# sourceMappingURL=split-path.js.map
@@ -1,2 +1,2 @@
1
1
  class StageStore {}
2
- //# sourceMappingURL=store.js.map
2
+ //# sourceMappingURL=store.js.map
package/es/common/text.js CHANGED
@@ -24,4 +24,4 @@ export function textAttributesToStyle(attrs) {
24
24
  attrs.underline ? style["text-decoration"] = "underline" : attrs.lineThrough && (style["text-decoration"] = "line-through"),
25
25
  attrs.fill && isString(attrs.fill) && (style.color = attrs.fill), style;
26
26
  }
27
- //# sourceMappingURL=text.js.map
27
+ //# sourceMappingURL=text.js.map
@@ -152,4 +152,4 @@ export const calculateLineHeight = (lineHeight, fontSize) => {
152
152
  const _lh = _calculateLineHeight(lineHeight, fontSize);
153
153
  return isNaN(_lh) ? _lh : Math.max(fontSize, _lh);
154
154
  };
155
- //# sourceMappingURL=utils.js.map
155
+ //# sourceMappingURL=utils.js.map
@@ -1,2 +1 @@
1
- export const ApplicationContribution = Symbol("ApplicationContribution");
2
- //# sourceMappingURL=application.js.map
1
+ export const ApplicationContribution = Symbol("ApplicationContribution");
package/es/core/index.js CHANGED
@@ -15,4 +15,4 @@ export * from "./layer-service";
15
15
  export * from "./constants";
16
16
 
17
17
  export * from "../interface/core";
18
- //# sourceMappingURL=index.js.map
18
+ //# sourceMappingURL=index.js.map
@@ -83,4 +83,4 @@ DefaultLayerService.idprefix = "visactor_layer", DefaultLayerService.prefix_coun
83
83
  DefaultLayerService = DefaultLayerService_1 = __decorate([ injectable(), __metadata("design:paramtypes", []) ], DefaultLayerService);
84
84
 
85
85
  export { DefaultLayerService };
86
- //# sourceMappingURL=layer-service.js.map
86
+ //# sourceMappingURL=layer-service.js.map
package/es/core/layer.js CHANGED
@@ -112,4 +112,4 @@ export class Layer extends Group {
112
112
  }, params)), this.afterDrawCbs.forEach((c => c(this)));
113
113
  }
114
114
  }
115
- //# sourceMappingURL=layer.js.map
115
+ //# sourceMappingURL=layer.js.map
package/es/core/light.js CHANGED
@@ -23,4 +23,4 @@ export class DirectionalLight {
23
23
  export const registerDirectionalLight = () => {
24
24
  Factory.registerPlugin("DirectionalLight", DirectionalLight);
25
25
  };
26
- //# sourceMappingURL=light.js.map
26
+ //# sourceMappingURL=light.js.map
package/es/core/stage.js CHANGED
@@ -547,4 +547,4 @@ export class Stage extends Group {
547
547
  this.pickerService;
548
548
  }
549
549
  }
550
- //# sourceMappingURL=stage.js.map
550
+ //# sourceMappingURL=stage.js.map
package/es/core/window.js CHANGED
@@ -159,4 +159,4 @@ let DefaultWindow = class {
159
159
  DefaultWindow = __decorate([ injectable(), __metadata("design:paramtypes", []) ], DefaultWindow);
160
160
 
161
161
  export { DefaultWindow };
162
- //# sourceMappingURL=window.js.map
162
+ //# sourceMappingURL=window.js.map
@@ -7,6 +7,7 @@ export declare class AutoRefreshPlugin implements IPlugin {
7
7
  key: string;
8
8
  dpr: number;
9
9
  rafId: number;
10
+ autoRefreshCbs?: (() => void)[];
10
11
  handleChange: (graphic: IGraphic) => void;
11
12
  activate(context: IPluginService): void;
12
13
  refresh(): void;
@@ -26,16 +26,22 @@ export class AutoRefreshPlugin {
26
26
  try {
27
27
  const mqString = `(resolution: ${window.devicePixelRatio}dppx)`, updatePixelRatio = () => {
28
28
  window.devicePixelRatio !== this.dpr && (this.dpr = window.devicePixelRatio, this.pluginService.stage.setDpr(this.dpr, !0));
29
- };
30
- matchMedia(mqString).addEventListener("change", updatePixelRatio);
29
+ }, dom = matchMedia(mqString);
30
+ dom && dom.addEventListener("change", updatePixelRatio), this.autoRefreshCbs || (this.autoRefreshCbs = []),
31
+ this.autoRefreshCbs.push((() => {
32
+ dom && dom.removeEventListener("change", updatePixelRatio);
33
+ }));
31
34
  } catch (err) {
32
35
  return !1;
33
36
  }
34
37
  return !0;
35
38
  }
36
39
  deactivate(context) {
40
+ var _a;
37
41
  const craf = application.global.getCancelAnimationFrame();
38
- craf && this.rafId && craf(this.rafId);
42
+ craf && this.rafId && craf(this.rafId), null === (_a = this.autoRefreshCbs) || void 0 === _a || _a.forEach((cb => {
43
+ cb();
44
+ })), this.autoRefreshCbs = void 0;
39
45
  }
40
46
  }
41
47
  //# sourceMappingURL=auto-refresh-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/builtin-plugin/auto-refresh-plugin.ts"],"names":[],"mappings":"AAAA,O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AI,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;aACjD;YACD,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;IACS,oBAAoB;QAC5B,IAAI;YACF,MAAM,QAAQ,GAAG,gBAAgB,MAAM,CAAC,gBAAgB,OAAO,CAAC;YAEhE,MAAM,gBAAgB,GAAG,GAAG,EAAE;gBAC5B,IAAI,MAAM,CAAC,gBAAgB,KAAK,IAAI,CAAC,GAAG,EAAE;oBACxC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,gBAAgB,CAAC;oBACnC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;iBACjD;YACH,CAAC,CAAC;YAEF,UAAU,CAAC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;SACnE;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,UAAU,CAAC,OAAuB;QAChC,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC;QAC1D,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CACF","file":"auto-refresh-plugin.js","sourcesContent":["import { Generator } from '../../common/generator';\nimport { application } from '../../application';\nimport type { IGraphic, IPlugin, IPluginService } from '../../interface';\n\nexport class AutoRefreshPlugin implements IPlugin {\n name: 'AutoRefreshPlugin' = 'AutoRefreshPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n dpr: number;\n rafId: number;\n\n handleChange = (graphic: IGraphic) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (graphic.stage === this.pluginService.stage && graphic.stage != null) {\n graphic.stage.renderNextFrame();\n }\n };\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n this.dpr = application.global.devicePixelRatio;\n this.refresh();\n }\n\n refresh() {\n if (!this._refreshByMediaQuery()) {\n this._refreshByRaf();\n }\n }\n protected _refreshByRaf() {\n const raf = application.global.getRequestAnimationFrame();\n this.rafId = raf(() => {\n if (application.global.devicePixelRatio !== this.dpr) {\n this.dpr = application.global.devicePixelRatio;\n this.pluginService.stage.setDpr(this.dpr, true);\n }\n this.refresh();\n });\n }\n protected _refreshByMediaQuery() {\n try {\n const mqString = `(resolution: ${window.devicePixelRatio}dppx)`;\n\n const updatePixelRatio = () => {\n if (window.devicePixelRatio !== this.dpr) {\n this.dpr = window.devicePixelRatio;\n this.pluginService.stage.setDpr(this.dpr, true);\n }\n };\n\n matchMedia(mqString).addEventListener('change', updatePixelRatio);\n } catch (err) {\n return false;\n }\n return true;\n }\n deactivate(context: IPluginService): void {\n const craf = application.global.getCancelAnimationFrame();\n craf && this.rafId && craf(this.rafId);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/plugins/builtin-plugin/auto-refresh-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,MAAM,OAAO,iBAAiB;IAA9B;QACE,SAAI,GAAwB,mBAAmB,CAAC;QAChD,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,SAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAKpC,iBAAY,GAAG,CAAC,OAAiB,EAAE,EAAE;YACnC,IAAI,OAAO,CAAC,SAAS,EAAE;gBACrB,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;aAC7B;Y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,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;iBACjD;YACH,CAAC,CAAC;YACF,MAAM,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;YACjC,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;YACxD,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;gBACxB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;aAC1B;YACD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE;gBAC5B,GAAG,IAAI,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;YAC7D,CAAC,CAAC,CAAC;SACJ;QAAC,OAAO,GAAG,EAAE;YACZ,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,UAAU,CAAC,OAAuB;;QAChC,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC;QAC1D,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvC,MAAA,IAAI,CAAC,cAAc,0CAAE,OAAO,CAAC,EAAE,CAAC,EAAE;YAChC,EAAE,EAAE,CAAC;QACP,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;IAClC,CAAC;CACF","file":"auto-refresh-plugin.js","sourcesContent":["import { Generator } from '../../common/generator';\nimport { application } from '../../application';\nimport type { IGraphic, IPlugin, IPluginService } from '../../interface';\n\nexport class AutoRefreshPlugin implements IPlugin {\n name: 'AutoRefreshPlugin' = 'AutoRefreshPlugin';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n dpr: number;\n rafId: number;\n autoRefreshCbs?: (() => void)[];\n\n handleChange = (graphic: IGraphic) => {\n if (graphic.glyphHost) {\n graphic = graphic.glyphHost;\n }\n if (graphic.stage === this.pluginService.stage && graphic.stage != null) {\n graphic.stage.renderNextFrame();\n }\n };\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n this.dpr = application.global.devicePixelRatio;\n this.refresh();\n }\n\n refresh() {\n if (!this._refreshByMediaQuery()) {\n this._refreshByRaf();\n }\n }\n protected _refreshByRaf() {\n const raf = application.global.getRequestAnimationFrame();\n this.rafId = raf(() => {\n if (application.global.devicePixelRatio !== this.dpr) {\n this.dpr = application.global.devicePixelRatio;\n this.pluginService.stage.setDpr(this.dpr, true);\n }\n this.refresh();\n });\n }\n protected _refreshByMediaQuery() {\n try {\n const mqString = `(resolution: ${window.devicePixelRatio}dppx)`;\n\n const updatePixelRatio = () => {\n if (window.devicePixelRatio !== this.dpr) {\n this.dpr = window.devicePixelRatio;\n this.pluginService.stage.setDpr(this.dpr, true);\n }\n };\n const dom = matchMedia(mqString);\n dom && dom.addEventListener('change', updatePixelRatio);\n if (!this.autoRefreshCbs) {\n this.autoRefreshCbs = [];\n }\n this.autoRefreshCbs.push(() => {\n dom && dom.removeEventListener('change', updatePixelRatio);\n });\n } catch (err) {\n return false;\n }\n return true;\n }\n deactivate(context: IPluginService): void {\n const craf = application.global.getCancelAnimationFrame();\n craf && this.rafId && craf(this.rafId);\n this.autoRefreshCbs?.forEach(cb => {\n cb();\n });\n this.autoRefreshCbs = undefined;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender-core",
3
- "version": "0.21.12-alpha.1",
3
+ "version": "0.21.12-alpha.3",
4
4
  "description": "",
5
5
  "sideEffects": [
6
6
  "./src/modules.ts",
@@ -15,11 +15,27 @@
15
15
  "es",
16
16
  "dist"
17
17
  ],
18
+ "scripts": {
19
+ "compile": "tsc --noEmit",
20
+ "eslint": "eslint --debug --fix src/",
21
+ "build": "cross-env DEBUG='Bundler*' bundle --clean",
22
+ "build-umd": "cross-env DEBUG='Bundler*' bundle --clean -f umd",
23
+ "dev": "cross-env DEBUG='Bundler*' bundle --clean -f es -w",
24
+ "start": "vite ./__tests__/browser",
25
+ "test": "jest",
26
+ "test-live": "npm run test-watch __tests__/unit/theme/line.test.ts",
27
+ "test-watch": "cross-env DEBUG_MODE=1 jest --watch",
28
+ "test-cov": "jest -w 16 --coverage",
29
+ "build:spec-types": "rm -rf ./spec-types && tsc -p ./tsconfig.spec.json --declaration --emitDeclarationOnly --outDir ./spec-types"
30
+ },
18
31
  "dependencies": {
19
32
  "color-convert": "2.0.1",
20
33
  "@visactor/vutils": "~0.19.3"
21
34
  },
22
35
  "devDependencies": {
36
+ "@internal/bundler": "workspace:*",
37
+ "@internal/eslint-config": "workspace:*",
38
+ "@internal/ts-config": "workspace:*",
23
39
  "@rushstack/eslint-patch": "~1.1.4",
24
40
  "react": "^18.0.0",
25
41
  "react-dom": "^18.0.0",
@@ -34,10 +50,7 @@
34
50
  "eslint": "~8.18.0",
35
51
  "vite": "3.2.6",
36
52
  "typescript": "4.9.5",
37
- "cross-env": "^7.0.3",
38
- "@internal/bundler": "0.0.1",
39
- "@internal/ts-config": "0.0.1",
40
- "@internal/eslint-config": "0.0.1"
53
+ "cross-env": "^7.0.3"
41
54
  },
42
55
  "keywords": [
43
56
  "VisActor",
@@ -65,18 +78,5 @@
65
78
  },
66
79
  "publishConfig": {
67
80
  "access": "public"
68
- },
69
- "scripts": {
70
- "compile": "tsc --noEmit",
71
- "eslint": "eslint --debug --fix src/",
72
- "build": "cross-env DEBUG='Bundler*' bundle --clean",
73
- "build-umd": "cross-env DEBUG='Bundler*' bundle --clean -f umd",
74
- "dev": "cross-env DEBUG='Bundler*' bundle --clean -f es -w",
75
- "start": "vite ./__tests__/browser",
76
- "test": "jest",
77
- "test-live": "npm run test-watch __tests__/unit/theme/line.test.ts",
78
- "test-watch": "cross-env DEBUG_MODE=1 jest --watch",
79
- "test-cov": "jest -w 16 --coverage",
80
- "build:spec-types": "rm -rf ./spec-types && tsc -p ./tsconfig.spec.json --declaration --emitDeclarationOnly --outDir ./spec-types"
81
81
  }
82
- }
82
+ }