@antv/g 5.0.23-alpha.7 → 5.0.23

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 (82) hide show
  1. package/dist/index.umd.min.js +3 -3
  2. package/es/components/Geometry.d.ts +4 -0
  3. package/es/css/CSS.js +1 -1
  4. package/es/css/CSSProperty.d.ts +1 -1
  5. package/es/css/StyleValueRegistry.d.ts +2 -1
  6. package/es/css/StyleValueRegistry.js +43 -21
  7. package/es/css/cssom/CSSNumericValue.js +1 -1
  8. package/es/css/index.d.ts +1 -0
  9. package/es/css/index.js +1 -0
  10. package/es/css/interfaces.d.ts +6 -0
  11. package/es/css/interfaces.js +2 -0
  12. package/es/css/parser/numeric.d.ts +1 -1
  13. package/es/css/parser/numeric.js +1 -1
  14. package/es/css/parser/transform-origin.d.ts +1 -1
  15. package/es/css/parser/transform-origin.js +1 -1
  16. package/es/css/parser/transform.d.ts +1 -1
  17. package/es/css/parser/transform.js +7 -5
  18. package/es/css/properties/CSSPropertyColor.d.ts +1 -1
  19. package/es/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
  20. package/es/display-objects/DisplayObject.d.ts +1 -2
  21. package/es/display-objects/DisplayObject.js +2 -1
  22. package/es/dom/Document.js +2 -2
  23. package/es/global-module.js +4 -7
  24. package/es/plugins/CullingPlugin.d.ts +1 -0
  25. package/es/plugins/CullingPlugin.js +8 -3
  26. package/es/plugins/DirtyCheckPlugin.d.ts +1 -0
  27. package/es/plugins/DirtyCheckPlugin.js +7 -2
  28. package/es/plugins/EventPlugin.d.ts +1 -0
  29. package/es/plugins/EventPlugin.js +14 -9
  30. package/es/plugins/PrepareRendererPlugin.d.ts +1 -0
  31. package/es/plugins/PrepareRendererPlugin.js +10 -5
  32. package/es/services/EventService.js +4 -8
  33. package/es/services/RenderingService.d.ts +17 -17
  34. package/es/services/RenderingService.js +25 -22
  35. package/es/services/SceneGraphService.js +3 -1
  36. package/es/types.d.ts +6 -1
  37. package/es/utils/index.d.ts +0 -1
  38. package/es/utils/index.js +1 -2
  39. package/es/utils/interpolation.js +1 -1
  40. package/lib/components/Geometry.d.ts +4 -0
  41. package/lib/css/CSS.js +2 -2
  42. package/lib/css/CSSProperty.d.ts +1 -1
  43. package/lib/css/StyleValueRegistry.d.ts +2 -1
  44. package/lib/css/StyleValueRegistry.js +50 -24
  45. package/lib/css/cssom/CSSNumericValue.js +17 -17
  46. package/lib/css/index.d.ts +1 -0
  47. package/lib/css/index.js +13 -0
  48. package/lib/css/interfaces.d.ts +6 -0
  49. package/lib/css/interfaces.js +12 -0
  50. package/lib/css/parser/numeric.d.ts +1 -1
  51. package/lib/css/parser/numeric.js +4 -4
  52. package/lib/css/parser/transform-origin.d.ts +1 -1
  53. package/lib/css/parser/transform-origin.js +2 -2
  54. package/lib/css/parser/transform.d.ts +1 -1
  55. package/lib/css/parser/transform.js +19 -15
  56. package/lib/css/properties/CSSPropertyColor.d.ts +1 -1
  57. package/lib/css/properties/CSSPropertyLengthOrPercentage.d.ts +1 -1
  58. package/lib/display-objects/DisplayObject.d.ts +1 -2
  59. package/lib/display-objects/DisplayObject.js +3 -2
  60. package/lib/dom/Document.js +2 -2
  61. package/lib/global-module.js +2 -5
  62. package/lib/plugins/CullingPlugin.d.ts +1 -0
  63. package/lib/plugins/CullingPlugin.js +7 -3
  64. package/lib/plugins/DirtyCheckPlugin.d.ts +1 -0
  65. package/lib/plugins/DirtyCheckPlugin.js +6 -2
  66. package/lib/plugins/EventPlugin.d.ts +1 -0
  67. package/lib/plugins/EventPlugin.js +13 -9
  68. package/lib/plugins/PrepareRendererPlugin.d.ts +1 -0
  69. package/lib/plugins/PrepareRendererPlugin.js +9 -5
  70. package/lib/services/EventService.js +4 -8
  71. package/lib/services/RenderingService.d.ts +17 -17
  72. package/lib/services/RenderingService.js +25 -22
  73. package/lib/services/SceneGraphService.js +3 -1
  74. package/lib/types.d.ts +6 -1
  75. package/lib/utils/index.d.ts +0 -1
  76. package/lib/utils/index.js +0 -13
  77. package/lib/utils/interpolation.js +2 -2
  78. package/package.json +4 -3
  79. package/es/utils/hooks.d.ts +0 -280
  80. package/es/utils/hooks.js +0 -753
  81. package/lib/utils/hooks.d.ts +0 -280
  82. package/lib/utils/hooks.js +0 -759
@@ -1,6 +1,6 @@
1
1
  import { __awaiter, __decorate, __generator, __metadata } from "tslib";
2
2
  import { inject, singleton } from 'mana-syringe';
3
- import { StyleValueRegistry } from '../css';
3
+ import { StyleValueRegistry } from '../css/interfaces';
4
4
  import { ElementEvent } from '../dom';
5
5
  import { RenderingContext, RenderingPluginContribution, dirtifyToRoot } from '../services';
6
6
 
@@ -9,6 +9,8 @@ var PrepareRendererPlugin =
9
9
  function () {
10
10
  function PrepareRendererPlugin() {}
11
11
 
12
+ PrepareRendererPlugin_1 = PrepareRendererPlugin;
13
+
12
14
  PrepareRendererPlugin.prototype.apply = function (renderingService) {
13
15
  var _this = this;
14
16
 
@@ -37,7 +39,7 @@ function () {
37
39
  renderingService.dirtify();
38
40
  };
39
41
 
40
- renderingService.hooks.init.tapPromise(function () {
42
+ renderingService.hooks.init.tapPromise(PrepareRendererPlugin_1.tag, function () {
41
43
  return __awaiter(_this, void 0, void 0, function () {
42
44
  return __generator(this, function (_a) {
43
45
  this.renderingContext.root.addEventListener(ElementEvent.MOUNTED, handleMounted);
@@ -50,7 +52,7 @@ function () {
50
52
  });
51
53
  });
52
54
  });
53
- renderingService.hooks.destroy.tap(function () {
55
+ renderingService.hooks.destroy.tap(PrepareRendererPlugin_1.tag, function () {
54
56
  _this.renderingContext.root.removeEventListener(ElementEvent.MOUNTED, handleMounted);
55
57
 
56
58
  _this.renderingContext.root.removeEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
@@ -61,11 +63,14 @@ function () {
61
63
  });
62
64
  };
63
65
 
66
+ var PrepareRendererPlugin_1;
67
+ PrepareRendererPlugin.tag = 'Prepare';
68
+
64
69
  __decorate([inject(RenderingContext), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "renderingContext", void 0);
65
70
 
66
- __decorate([inject(StyleValueRegistry), __metadata("design:type", StyleValueRegistry)], PrepareRendererPlugin.prototype, "styleValueRegistry", void 0);
71
+ __decorate([inject(StyleValueRegistry), __metadata("design:type", Object)], PrepareRendererPlugin.prototype, "styleValueRegistry", void 0);
67
72
 
68
- PrepareRendererPlugin = __decorate([singleton({
73
+ PrepareRendererPlugin = PrepareRendererPlugin_1 = __decorate([singleton({
69
74
  contrib: RenderingPluginContribution
70
75
  })], PrepareRendererPlugin);
71
76
  return PrepareRendererPlugin;
@@ -191,8 +191,7 @@ function (_super) {
191
191
  e = _a.sent();
192
192
  this.dispatchEvent(e, 'pointerdown');
193
193
 
194
- if (e.pointerType === 'touch') {
195
- this.dispatchEvent(e, 'touchstart');
194
+ if (e.pointerType === 'touch') {// this.dispatchEvent(e, 'touchstart');
196
195
  } else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
197
196
  isRightButton = e.button === 2;
198
197
  this.dispatchEvent(e, isRightButton ? 'rightdown' : 'mousedown');
@@ -230,8 +229,7 @@ function (_super) {
230
229
  e = _a.sent();
231
230
  this.dispatchEvent(e, 'pointerup');
232
231
 
233
- if (e.pointerType === 'touch') {
234
- this.dispatchEvent(e, 'touchend');
232
+ if (e.pointerType === 'touch') {// this.dispatchEvent(e, 'touchend');
235
233
  } else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
236
234
  isRightButton = e.button === 2;
237
235
  this.dispatchEvent(e, isRightButton ? 'rightup' : 'mouseup');
@@ -408,8 +406,7 @@ function (_super) {
408
406
  } // Then pointermove
409
407
 
410
408
 
411
- this.dispatchEvent(e, 'pointermove');
412
- if (e.pointerType === 'touch') this.dispatchEvent(e, 'touchmove');
409
+ this.dispatchEvent(e, 'pointermove'); // if (e.pointerType === 'touch') this.dispatchEvent(e, 'touchmove');
413
410
 
414
411
  if (isMouse) {
415
412
  this.dispatchEvent(e, 'mousemove');
@@ -565,8 +562,7 @@ function (_super) {
565
562
  e.currentTarget = currentTarget;
566
563
  this.notifyTarget(e, 'pointerupoutside');
567
564
 
568
- if (e.pointerType === 'touch') {
569
- this.notifyTarget(e, 'touchendoutside');
565
+ if (e.pointerType === 'touch') {// this.notifyTarget(e, 'touchendoutside');
570
566
  } else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
571
567
  this.notifyTarget(e, e.button === 2 ? 'rightupoutside' : 'mouseupoutside');
572
568
  }
@@ -1,5 +1,5 @@
1
1
  import { Syringe } from 'mana-syringe';
2
- import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from '../utils';
2
+ import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from 'tapable';
3
3
  import type { DisplayObject } from '../display-objects';
4
4
  import type { CanvasConfig, EventPosition, InteractivePointerEvent } from '../types';
5
5
  export interface RenderingPlugin {
@@ -38,33 +38,33 @@ export declare class RenderingService {
38
38
  /**
39
39
  * called before any frame rendered
40
40
  */
41
- init: AsyncParallelHook<[], void>;
41
+ init: AsyncParallelHook<[], import("tapable").UnsetAdditionalOptions>;
42
42
  /**
43
43
  * only dirty object which has sth changed will be rendered
44
44
  */
45
- dirtycheck: SyncWaterfallHook<[DisplayObject<any, any>], DisplayObject<any, any>>;
45
+ dirtycheck: SyncWaterfallHook<[DisplayObject<any, any>], import("tapable").UnsetAdditionalOptions>;
46
46
  /**
47
47
  * do culling
48
48
  */
49
- cull: SyncWaterfallHook<[DisplayObject<any, any>], DisplayObject<any, any>>;
49
+ cull: SyncWaterfallHook<[DisplayObject<any, any>], import("tapable").UnsetAdditionalOptions>;
50
50
  /**
51
51
  * called at beginning of each frame, won't get called if nothing to re-render
52
52
  */
53
- beginFrame: SyncHook<[], void>;
53
+ beginFrame: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
54
54
  /**
55
55
  * called before every dirty object get rendered
56
56
  */
57
- beforeRender: SyncHook<[DisplayObject<any, any>], void>;
57
+ beforeRender: SyncHook<[DisplayObject<any, any>], void, import("tapable").UnsetAdditionalOptions>;
58
58
  /**
59
59
  * called when every dirty object rendering even it's culled
60
60
  */
61
- render: SyncHook<[DisplayObject<any, any>], void>;
61
+ render: SyncHook<[DisplayObject<any, any>], void, import("tapable").UnsetAdditionalOptions>;
62
62
  /**
63
63
  * called after every dirty object get rendered
64
64
  */
65
- afterRender: SyncHook<[DisplayObject<any, any>], void>;
66
- endFrame: SyncHook<[], void>;
67
- destroy: SyncHook<[], void>;
65
+ afterRender: SyncHook<[DisplayObject<any, any>], void, import("tapable").UnsetAdditionalOptions>;
66
+ endFrame: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
67
+ destroy: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
68
68
  /**
69
69
  * use async but faster method such as GPU-based picking in `g-plugin-webgl-renderer`
70
70
  */
@@ -72,13 +72,13 @@ export declare class RenderingService {
72
72
  /**
73
73
  * used in event system
74
74
  */
75
- pointerDown: SyncHook<[InteractivePointerEvent], void>;
76
- pointerUp: SyncHook<[InteractivePointerEvent], void>;
77
- pointerMove: SyncHook<[InteractivePointerEvent], void>;
78
- pointerOut: SyncHook<[InteractivePointerEvent], void>;
79
- pointerOver: SyncHook<[InteractivePointerEvent], void>;
80
- pointerCancel: SyncHook<[InteractivePointerEvent], void>;
81
- pointerWheel: SyncHook<[InteractivePointerEvent], void>;
75
+ pointerDown: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
76
+ pointerUp: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
77
+ pointerMove: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
78
+ pointerOut: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
79
+ pointerOver: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
80
+ pointerWheel: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
81
+ pointerCancel: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
82
82
  };
83
83
  init(): Promise<void>;
84
84
  getStats(): {
@@ -1,7 +1,8 @@
1
1
  import { __awaiter, __decorate, __generator, __metadata } from "tslib";
2
- import { inject, singleton, contrib, Syringe, Contribution } from 'mana-syringe';
3
- import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from '../utils';
4
- import { StyleValueRegistry } from '../css';
2
+ import { inject, singleton, contrib, Syringe, Contribution } from 'mana-syringe'; // import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from '../utils';
3
+
4
+ import { SyncHook, SyncWaterfallHook, AsyncParallelHook, AsyncSeriesWaterfallHook } from 'tapable';
5
+ import { StyleValueRegistry } from '../css/interfaces';
5
6
  import { ElementEvent } from '../dom';
6
7
  import { RenderingContext, RenderReason } from './RenderingContext';
7
8
  import { SceneGraphService, sortByZIndex } from './SceneGraphService';
@@ -47,50 +48,50 @@ function () {
47
48
  /**
48
49
  * only dirty object which has sth changed will be rendered
49
50
  */
50
- dirtycheck: new SyncWaterfallHook(),
51
+ dirtycheck: new SyncWaterfallHook(['object']),
51
52
 
52
53
  /**
53
54
  * do culling
54
55
  */
55
- cull: new SyncWaterfallHook(),
56
+ cull: new SyncWaterfallHook(['object']),
56
57
 
57
58
  /**
58
59
  * called at beginning of each frame, won't get called if nothing to re-render
59
60
  */
60
- beginFrame: new SyncHook(),
61
+ beginFrame: new SyncHook([]),
61
62
 
62
63
  /**
63
64
  * called before every dirty object get rendered
64
65
  */
65
- beforeRender: new SyncHook(),
66
+ beforeRender: new SyncHook(['objectToRender']),
66
67
 
67
68
  /**
68
69
  * called when every dirty object rendering even it's culled
69
70
  */
70
- render: new SyncHook(),
71
+ render: new SyncHook(['objectToRender']),
71
72
 
72
73
  /**
73
74
  * called after every dirty object get rendered
74
75
  */
75
- afterRender: new SyncHook(),
76
- endFrame: new SyncHook(),
77
- destroy: new SyncHook(),
76
+ afterRender: new SyncHook(['objectToRender']),
77
+ endFrame: new SyncHook([]),
78
+ destroy: new SyncHook([]),
78
79
 
79
80
  /**
80
81
  * use async but faster method such as GPU-based picking in `g-plugin-webgl-renderer`
81
82
  */
82
- pick: new AsyncSeriesWaterfallHook(),
83
+ pick: new AsyncSeriesWaterfallHook(['result']),
83
84
 
84
85
  /**
85
86
  * used in event system
86
87
  */
87
- pointerDown: new SyncHook(),
88
- pointerUp: new SyncHook(),
89
- pointerMove: new SyncHook(),
90
- pointerOut: new SyncHook(),
91
- pointerOver: new SyncHook(),
92
- pointerCancel: new SyncHook(),
93
- pointerWheel: new SyncHook()
88
+ pointerDown: new SyncHook(['event']),
89
+ pointerUp: new SyncHook(['event']),
90
+ pointerMove: new SyncHook(['event']),
91
+ pointerOut: new SyncHook(['event']),
92
+ pointerOver: new SyncHook(['event']),
93
+ pointerWheel: new SyncHook(['event']),
94
+ pointerCancel: new SyncHook(['event'])
94
95
  };
95
96
  }
96
97
 
@@ -106,12 +107,14 @@ function () {
106
107
  cache: false
107
108
  }).forEach(function (plugin) {
108
109
  plugin.apply(_this);
109
- });
110
+ }); // await this.hooks.init.callPromise();
111
+
110
112
  return [4
111
113
  /*yield*/
112
- , this.hooks.init.callPromise()];
114
+ , this.hooks.init.promise()];
113
115
 
114
116
  case 1:
117
+ // await this.hooks.init.callPromise();
115
118
  _a.sent();
116
119
 
117
120
  this.inited = true;
@@ -219,7 +222,7 @@ function () {
219
222
 
220
223
  __decorate([inject(SceneGraphService), __metadata("design:type", Object)], RenderingService.prototype, "sceneGraphService", void 0);
221
224
 
222
- __decorate([inject(StyleValueRegistry), __metadata("design:type", StyleValueRegistry)], RenderingService.prototype, "styleValueRegistry", void 0);
225
+ __decorate([inject(StyleValueRegistry), __metadata("design:type", Object)], RenderingService.prototype, "styleValueRegistry", void 0);
223
226
 
224
227
  RenderingService = __decorate([singleton()], RenderingService);
225
228
  return RenderingService;
@@ -801,7 +801,9 @@ function () {
801
801
 
802
802
  __decorate([inject(SceneGraphSelectorFactory), __metadata("design:type", Function)], DefaultSceneGraphService.prototype, "sceneGraphSelectorFactory", void 0);
803
803
 
804
- DefaultSceneGraphService = __decorate([singleton()], DefaultSceneGraphService);
804
+ DefaultSceneGraphService = __decorate([singleton({
805
+ token: SceneGraphService
806
+ })], DefaultSceneGraphService);
805
807
  return DefaultSceneGraphService;
806
808
  }();
807
809
 
package/es/types.d.ts CHANGED
@@ -120,6 +120,10 @@ export interface BaseStyleProps {
120
120
  opacity?: number;
121
121
  /** 线宽 */
122
122
  lineWidth?: string | number;
123
+ /**
124
+ * increased line width when hitting test
125
+ */
126
+ increasedLineWidthForHitTesting?: string | number;
123
127
  /**
124
128
  * 交互区域
125
129
  */
@@ -158,7 +162,7 @@ export interface BaseStyleProps {
158
162
  */
159
163
  miterLimit?: number;
160
164
  }
161
- export interface ParsedBaseStyleProps extends Omit<BaseStyleProps, 'anchor' | 'x' | 'y' | 'z' | 'opacity' | 'strokeOpacity' | 'fillOpacity' | 'fill' | 'stroke' | 'lineWidth' | 'lineJoin' | 'lineCap' | 'lineDash' | 'lineDashOffset' | 'path' | 'points' | 'shadowColor' | 'shadowBlur' | 'shadowOffsetX' | 'shadowOffsetY' | 'visibility' | 'pointerEvents' | 'zIndex' | 'transformOrigin' | 'textTransform'> {
165
+ export interface ParsedBaseStyleProps extends Omit<BaseStyleProps, 'anchor' | 'x' | 'y' | 'z' | 'opacity' | 'strokeOpacity' | 'fillOpacity' | 'fill' | 'stroke' | 'lineWidth' | 'increasedLineWidthForHitTesting' | 'lineJoin' | 'lineCap' | 'lineDash' | 'lineDashOffset' | 'path' | 'points' | 'shadowColor' | 'shadowBlur' | 'shadowOffsetX' | 'shadowOffsetY' | 'visibility' | 'pointerEvents' | 'zIndex' | 'transformOrigin' | 'textTransform'> {
162
166
  zIndex?: CSSUnitValue;
163
167
  visibility?: CSSKeywordValue;
164
168
  pointerEvents?: CSSKeywordValue;
@@ -179,6 +183,7 @@ export interface ParsedBaseStyleProps extends Omit<BaseStyleProps, 'anchor' | 'x
179
183
  width?: CSSUnitValue;
180
184
  height?: CSSUnitValue;
181
185
  lineWidth?: CSSUnitValue;
186
+ increasedLineWidthForHitTesting?: CSSUnitValue;
182
187
  /**
183
188
  * x according to definition, eg. Line's x1/x2, Polyline's points
184
189
  */
@@ -6,4 +6,3 @@ export * from './text';
6
6
  export * from './string';
7
7
  export * from './event';
8
8
  export * from './canvas';
9
- export * from './hooks';
package/es/utils/index.js CHANGED
@@ -5,5 +5,4 @@ export * from './path';
5
5
  export * from './text';
6
6
  export * from './string';
7
7
  export * from './event';
8
- export * from './canvas';
9
- export * from './hooks';
8
+ export * from './canvas';
@@ -1,6 +1,6 @@
1
1
  import { __read, __spreadArray } from "tslib";
2
2
  import { GlobalContainer } from 'mana-syringe';
3
- import { StyleValueRegistry } from '../css';
3
+ import { StyleValueRegistry } from '../css/interfaces';
4
4
  import { parseEasingFunction } from './animation';
5
5
  import { camelCase } from './string';
6
6
  export function convertEffectInput(keyframes, timing, target) {
@@ -9,4 +9,8 @@ export declare class Geometry {
9
9
  * including extra rendering effects, eg. shadowBlur filters(drop-shadow, blur)
10
10
  */
11
11
  renderBounds: AABB | undefined;
12
+ /**
13
+ * account for `hitArea` & `increasedLineWidthForHitTesting`
14
+ */
15
+ hitAreaBounds: AABB | undefined;
12
16
  }
package/lib/css/CSS.js CHANGED
@@ -9,7 +9,7 @@ var _manaSyringe = require("mana-syringe");
9
9
 
10
10
  var _cssom = require("./cssom");
11
11
 
12
- var _StyleValueRegistry = require("./StyleValueRegistry");
12
+ var _interfaces = require("./interfaces");
13
13
 
14
14
  /**
15
15
  * holds useful CSS-related methods.
@@ -104,7 +104,7 @@ var CSS = {
104
104
  inherits = definition.inherits,
105
105
  initialValue = definition.initialValue;
106
106
 
107
- var registry = _manaSyringe.GlobalContainer.get(_StyleValueRegistry.StyleValueRegistry);
107
+ var registry = _manaSyringe.GlobalContainer.get(_interfaces.StyleValueRegistry);
108
108
 
109
109
  registry.registerMetadata({
110
110
  name: name,
@@ -1,5 +1,5 @@
1
1
  import type { IElement } from '../dom';
2
- import type { StyleValueRegistry } from './StyleValueRegistry';
2
+ import type { StyleValueRegistry } from './interfaces';
3
3
  export declare type Interpolatable = number | boolean | number[] | boolean[];
4
4
  declare type CSSPropertyMixer<Parsed = any, T extends Interpolatable = any> = (left: Parsed, right: Parsed, displayObject: IElement | null) => [T, T, (i: T) => string | any] | undefined;
5
5
  declare type CSSPropertyParser<Parsed> = (value: string | any) => Parsed;
@@ -1,6 +1,7 @@
1
1
  import type { DisplayObject } from '../display-objects';
2
2
  import type { BaseStyleProps } from '../types';
3
3
  import { CSSStyleValue } from './cssom';
4
+ import { StyleValueRegistry } from './interfaces';
4
5
  export declare type CSSGlobalKeywords = 'unset' | 'initial' | 'inherit' | '';
5
6
  export interface PropertyParseOptions {
6
7
  skipUpdateAttribute: boolean;
@@ -65,7 +66,7 @@ export interface PropertyMetadata {
65
66
  * Blink used them in code generation(css_properties.json5)
66
67
  */
67
68
  export declare const BUILT_IN_PROPERTIES: PropertyMetadata[];
68
- export declare class StyleValueRegistry {
69
+ export declare class DefaultStyleValueRegistry implements StyleValueRegistry {
69
70
  /**
70
71
  * need recalc later
71
72
  */
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyleValueRegistry = exports.PropertySyntax = exports.BUILT_IN_PROPERTIES = void 0;
6
+ exports.PropertySyntax = exports.DefaultStyleValueRegistry = exports.BUILT_IN_PROPERTIES = void 0;
7
7
 
8
8
  var _tslib = require("tslib");
9
9
 
@@ -11,7 +11,9 @@ var _manaSyringe = require("mana-syringe");
11
11
 
12
12
  var _glMatrix = require("gl-matrix");
13
13
 
14
- var _services = require("../services");
14
+ var _interfaces = require("../services/aabb/interfaces");
15
+
16
+ var _SceneGraphService = require("../services/SceneGraphService");
15
17
 
16
18
  var _dom = require("../dom");
17
19
 
@@ -27,6 +29,8 @@ var _utils = require("../utils");
27
29
 
28
30
  var _shapes = require("../shapes");
29
31
 
32
+ var _interfaces2 = require("./interfaces");
33
+
30
34
  var PropertySyntax = {
31
35
  COLOR: '<color>',
32
36
  PAINT: '<paint>',
@@ -154,6 +158,14 @@ var BUILT_IN_PROPERTIES = [{
154
158
  alias: ['strokeWidth'],
155
159
  syntax: PropertySyntax.LENGTH_PERCENTAGE,
156
160
  handler: _properties.CSSPropertyLengthOrPercentage
161
+ }, {
162
+ name: 'increasedLineWidthForHitTesting',
163
+ inherited: true,
164
+ defaultValue: '0',
165
+ layoutDependent: true,
166
+ alias: ['lineAppendWidth'],
167
+ syntax: PropertySyntax.LENGTH_PERCENTAGE,
168
+ handler: _properties.CSSPropertyLengthOrPercentage
157
169
  }, {
158
170
  name: 'lineJoin',
159
171
  inherited: true,
@@ -431,10 +443,10 @@ var BUILT_IN_PROPERTIES = [{
431
443
  }];
432
444
  exports.BUILT_IN_PROPERTIES = BUILT_IN_PROPERTIES;
433
445
 
434
- var StyleValueRegistry =
446
+ var DefaultStyleValueRegistry =
435
447
  /** @class */
436
448
  function () {
437
- function StyleValueRegistry() {
449
+ function DefaultStyleValueRegistry() {
438
450
  /**
439
451
  * need recalc later
440
452
  */
@@ -470,7 +482,7 @@ function () {
470
482
  // > = {};
471
483
 
472
484
 
473
- StyleValueRegistry.prototype.init = function () {
485
+ DefaultStyleValueRegistry.prototype.init = function () {
474
486
  var _this = this;
475
487
 
476
488
  BUILT_IN_PROPERTIES.forEach(function (property) {
@@ -478,7 +490,7 @@ function () {
478
490
  });
479
491
  };
480
492
 
481
- StyleValueRegistry.prototype.registerMetadata = function (metadata) {
493
+ DefaultStyleValueRegistry.prototype.registerMetadata = function (metadata) {
482
494
  var _this = this;
483
495
 
484
496
  (0, _tslib.__spreadArray)([metadata.name], (0, _tslib.__read)(metadata.alias || []), false).forEach(function (name) {
@@ -486,7 +498,7 @@ function () {
486
498
  });
487
499
  };
488
500
 
489
- StyleValueRegistry.prototype.getMetadata = function (name) {
501
+ DefaultStyleValueRegistry.prototype.getMetadata = function (name) {
490
502
  return this.cache[name];
491
503
  };
492
504
  /**
@@ -500,7 +512,7 @@ function () {
500
512
  */
501
513
 
502
514
 
503
- StyleValueRegistry.prototype.processProperties = function (object, attributes, options) {
515
+ DefaultStyleValueRegistry.prototype.processProperties = function (object, attributes, options) {
504
516
  var _this = this;
505
517
 
506
518
  if (options === void 0) {
@@ -581,7 +593,7 @@ function () {
581
593
  */
582
594
 
583
595
 
584
- StyleValueRegistry.prototype.parseProperty = function (name, value) {
596
+ DefaultStyleValueRegistry.prototype.parseProperty = function (name, value) {
585
597
  var metadata = this.getMetadata(name);
586
598
  var computed = value;
587
599
 
@@ -617,7 +629,7 @@ function () {
617
629
  */
618
630
 
619
631
 
620
- StyleValueRegistry.prototype.computeProperty = function (name, computed, object) {
632
+ DefaultStyleValueRegistry.prototype.computeProperty = function (name, computed, object) {
621
633
  var metadata = this.getMetadata(name);
622
634
  var isDocumentElement = object.id === 'g-root';
623
635
  var used = computed instanceof _cssom.CSSStyleValue ? computed.clone() : computed;
@@ -682,7 +694,7 @@ function () {
682
694
  return false;
683
695
  };
684
696
 
685
- StyleValueRegistry.prototype.postProcessProperty = function (name, object) {
697
+ DefaultStyleValueRegistry.prototype.postProcessProperty = function (name, object) {
686
698
  var metadata = this.getMetadata(name);
687
699
 
688
700
  if (metadata && metadata.handler) {
@@ -694,7 +706,7 @@ function () {
694
706
  }
695
707
  };
696
708
 
697
- StyleValueRegistry.prototype.isPropertyResolved = function (object, name) {
709
+ DefaultStyleValueRegistry.prototype.isPropertyResolved = function (object, name) {
698
710
  if (!this.unresolvedProperties[object.entity] || this.unresolvedProperties[object.entity].length === 0) {
699
711
  return true;
700
712
  }
@@ -706,7 +718,7 @@ function () {
706
718
  */
707
719
 
708
720
 
709
- StyleValueRegistry.prototype.addUnresolveProperty = function (object, name) {
721
+ DefaultStyleValueRegistry.prototype.addUnresolveProperty = function (object, name) {
710
722
  if (!this.unresolvedProperties[object.entity]) {
711
723
  this.unresolvedProperties[object.entity] = [];
712
724
  }
@@ -716,7 +728,7 @@ function () {
716
728
  }
717
729
  };
718
730
 
719
- StyleValueRegistry.prototype.tryToResolveProperty = function (object, name, options) {
731
+ DefaultStyleValueRegistry.prototype.tryToResolveProperty = function (object, name, options) {
720
732
  if (options === void 0) {
721
733
  options = {};
722
734
  }
@@ -740,7 +752,7 @@ function () {
740
752
  return false;
741
753
  };
742
754
 
743
- StyleValueRegistry.prototype.recalc = function (object) {
755
+ DefaultStyleValueRegistry.prototype.recalc = function (object) {
744
756
  var properties = this.unresolvedProperties[object.entity];
745
757
 
746
758
  if (properties && properties.length) {
@@ -758,10 +770,10 @@ function () {
758
770
  */
759
771
 
760
772
 
761
- StyleValueRegistry.prototype.updateGeometry = function (object) {
773
+ DefaultStyleValueRegistry.prototype.updateGeometry = function (object) {
762
774
  var _a;
763
775
 
764
- var geometryUpdaterFactory = _manaSyringe.GlobalContainer.get(_services.GeometryUpdaterFactory);
776
+ var geometryUpdaterFactory = _manaSyringe.GlobalContainer.get(_interfaces.GeometryUpdaterFactory);
765
777
 
766
778
  var geometryUpdater = geometryUpdaterFactory(object.nodeName);
767
779
 
@@ -776,6 +788,10 @@ function () {
776
788
  geometry_1.renderBounds = new _shapes.AABB();
777
789
  }
778
790
 
791
+ if (!geometry_1.hitAreaBounds) {
792
+ geometry_1.hitAreaBounds = new _shapes.AABB();
793
+ }
794
+
779
795
  var parsedStyle = object.parsedStyle;
780
796
 
781
797
  var _b = geometryUpdater.update(parsedStyle, object),
@@ -814,6 +830,7 @@ function () {
814
830
 
815
831
  var _j = parsedStyle,
816
832
  lineWidth = _j.lineWidth,
833
+ increasedLineWidthForHitTesting = _j.increasedLineWidthForHitTesting,
817
834
  shadowColor = _j.shadowColor,
818
835
  _k = _j.filter,
819
836
  filter = _k === void 0 ? [] : _k,
@@ -832,9 +849,16 @@ function () {
832
849
  if (lineWidth) {
833
850
  // append border
834
851
  _glMatrix.vec3.add(halfExtents, halfExtents, _glMatrix.vec3.fromValues(lineWidth.value / 2, lineWidth.value / 2, 0));
852
+
853
+ geometry_1.renderBounds.update(center, halfExtents);
835
854
  }
836
855
 
837
- geometry_1.renderBounds.update(center, halfExtents); // account for shadow, only support constant value now
856
+ if (increasedLineWidthForHitTesting) {
857
+ _glMatrix.vec3.add(halfExtents, halfExtents, _glMatrix.vec3.fromValues(increasedLineWidthForHitTesting.value / 2, increasedLineWidthForHitTesting.value / 2, 0));
858
+
859
+ geometry_1.hitAreaBounds.update(center, halfExtents);
860
+ } // account for shadow, only support constant value now
861
+
838
862
 
839
863
  if (shadowColor) {
840
864
  var _l = geometry_1.renderBounds,
@@ -892,11 +916,11 @@ function () {
892
916
  usedOriginYValue -= (anchor && anchor[1].value || 0) * geometry_1.contentBounds.halfExtents[1] * 2;
893
917
  object.setOrigin(usedOriginXValue, usedOriginYValue);
894
918
  object.emit(_dom.ElementEvent.GEOMETRY_BOUNDS_CHANGED, {});
895
- (0, _services.dirtifyToRoot)(object);
919
+ (0, _SceneGraphService.dirtifyToRoot)(object);
896
920
  }
897
921
  };
898
922
 
899
- StyleValueRegistry.prototype.isPropertyInheritable = function (name) {
923
+ DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
900
924
  var metadata = this.getMetadata(name);
901
925
 
902
926
  if (!metadata) {
@@ -906,9 +930,11 @@ function () {
906
930
  return metadata.inherited;
907
931
  };
908
932
 
909
- (0, _tslib.__decorate)([(0, _manaSyringe.postConstruct)(), (0, _tslib.__metadata)("design:type", Function), (0, _tslib.__metadata)("design:paramtypes", []), (0, _tslib.__metadata)("design:returntype", void 0)], StyleValueRegistry.prototype, "init", null);
910
- StyleValueRegistry = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)()], StyleValueRegistry);
911
- return StyleValueRegistry;
933
+ (0, _tslib.__decorate)([(0, _manaSyringe.postConstruct)(), (0, _tslib.__metadata)("design:type", Function), (0, _tslib.__metadata)("design:paramtypes", []), (0, _tslib.__metadata)("design:returntype", void 0)], DefaultStyleValueRegistry.prototype, "init", null);
934
+ DefaultStyleValueRegistry = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
935
+ token: _interfaces2.StyleValueRegistry
936
+ })], DefaultStyleValueRegistry);
937
+ return DefaultStyleValueRegistry;
912
938
  }();
913
939
 
914
- exports.StyleValueRegistry = StyleValueRegistry;
940
+ exports.DefaultStyleValueRegistry = DefaultStyleValueRegistry;