@antv/g 1.0.0-alpha.32 → 1.0.0-alpha.36

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.
@@ -7,6 +7,8 @@ export declare class Transform extends Component {
7
7
  static tag: string;
8
8
  dirtyFlag: boolean;
9
9
  localDirtyFlag: boolean;
10
+ frozen: boolean;
11
+ graphDepth: number;
10
12
  /**
11
13
  * local space RTS
12
14
  */
@@ -15,6 +15,8 @@ function (_super) {
15
15
 
16
16
  _this.dirtyFlag = false;
17
17
  _this.localDirtyFlag = false;
18
+ _this.frozen = false;
19
+ _this.graphDepth = 0;
18
20
  /**
19
21
  * local space RTS
20
22
  */
@@ -16,10 +16,7 @@ export interface CustomElement<CustomElementStyleProps> {
16
16
  * @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
17
17
  */
18
18
  export declare abstract class CustomElement<CustomElementStyleProps> extends DisplayObject<CustomElementStyleProps> {
19
- private shadowNodes;
20
19
  constructor(config: DisplayObjectConfig<CustomElementStyleProps>);
21
20
  private handleMounted;
22
- private handleChildInserted;
23
- private handleChildRemoved;
24
21
  private handleAttributeChanged;
25
22
  }
@@ -9,39 +9,35 @@ import { ElementEvent } from '../dom/interfaces';
9
9
  var CustomElement =
10
10
  /** @class */
11
11
  function (_super) {
12
- __extends(CustomElement, _super);
12
+ __extends(CustomElement, _super); // private shadowNodes: DisplayObject[] = [];
13
+
13
14
 
14
15
  function CustomElement(config) {
15
16
  var _this = _super.call(this, config) || this;
16
17
 
17
- _this.shadowNodes = [];
18
-
19
18
  _this.handleMounted = function () {
20
- _this.shadowNodes.forEach(function (node) {
21
- // every child and its children should turn into a shadow node
22
- // a shadow node doesn't mean to be unrenderable, it's just unsearchable in scenegraph
23
- node.shadow = true;
24
- });
25
-
19
+ // this.shadowNodes.forEach((node) => {
20
+ // // every child and its children should turn into a shadow node
21
+ // // a shadow node doesn't mean to be unrenderable, it's just unsearchable in scenegraph
22
+ // node.shadow = true;
23
+ // });
26
24
  if (_this.connectedCallback) {
27
25
  _this.connectedCallback();
28
26
  }
29
- };
27
+ }; // private handleChildInserted = (e: FederatedEvent) => {
28
+ // (e.target as DisplayObject).forEach((node) => {
29
+ // // append children like other shapes after mounted
30
+ // if (!this.isConnected) {
31
+ // this.shadowNodes.push(node as DisplayObject);
32
+ // }
33
+ // });
34
+ // };
35
+ // private handleChildRemoved = (e: FederatedEvent) => {
36
+ // (e.target as DisplayObject).forEach((node) => {
37
+ // node.shadow = false;
38
+ // });
39
+ // };
30
40
 
31
- _this.handleChildInserted = function (e) {
32
- e.target.forEach(function (node) {
33
- // append children like other shapes after mounted
34
- if (!_this.isConnected) {
35
- _this.shadowNodes.push(node);
36
- }
37
- });
38
- };
39
-
40
- _this.handleChildRemoved = function (e) {
41
- e.target.forEach(function (node) {
42
- node.shadow = false;
43
- });
44
- };
45
41
 
46
42
  _this.handleAttributeChanged = function (e) {
47
43
  // only listen itself
@@ -55,11 +51,9 @@ function (_super) {
55
51
  oldValue = _a.oldValue,
56
52
  newValue = _a.newValue;
57
53
  _this.attributeChangedCallback && _this.attributeChangedCallback(attributeName, oldValue, newValue);
58
- };
59
-
60
- _this.addEventListener(ElementEvent.CHILD_INSERTED, _this.handleChildInserted);
54
+ }; // this.addEventListener(ElementEvent.CHILD_INSERTED, this.handleChildInserted);
55
+ // this.addEventListener(ElementEvent.CHILD_REMOVED, this.handleChildRemoved);
61
56
 
62
- _this.addEventListener(ElementEvent.CHILD_REMOVED, _this.handleChildRemoved);
63
57
 
64
58
  if (_this.attributeChangedCallback) {
65
59
  _this.addEventListener(ElementEvent.ATTRIBUTE_CHANGED, _this.handleAttributeChanged);
@@ -7,6 +7,8 @@ export interface PolylineStyleProps extends BaseStyleProps {
7
7
  }
8
8
  export interface ParsedPolylineStyleProps {
9
9
  points: [number, number][];
10
+ defX: number;
11
+ defY: number;
10
12
  segments: [number, number][];
11
13
  totalLength: number;
12
14
  }
@@ -1,7 +1,7 @@
1
1
  import { __assign, __extends, __rest } from "tslib";
2
+ import { Line as LineUtil } from '@antv/g-math';
2
3
  import { SHAPE } from '../types';
3
4
  import { DisplayObject } from './DisplayObject';
4
- import { Line as LineUtil } from '@antv/g-math';
5
5
  import { Point } from '../shapes';
6
6
 
7
7
  var Polyline =
@@ -43,12 +43,15 @@ export var containerModule = Module(function (register) {
43
43
  register({
44
44
  token: GeometryUpdaterFactory,
45
45
  useFactory: function useFactory(context) {
46
+ var cache = {};
46
47
  return function (tagName) {
47
- if (context.container.isBoundNamed(GeometryAABBUpdater, tagName)) {
48
- return context.container.getNamed(GeometryAABBUpdater, tagName);
48
+ if (!cache[tagName]) {
49
+ if (context.container.isBoundNamed(GeometryAABBUpdater, tagName)) {
50
+ cache[tagName] = context.container.getNamed(GeometryAABBUpdater, tagName);
51
+ }
49
52
  }
50
53
 
51
- return null;
54
+ return cache[tagName];
52
55
  };
53
56
  }
54
57
  }); // bind style property handlers
@@ -56,36 +59,45 @@ export var containerModule = Module(function (register) {
56
59
  register({
57
60
  token: StylePropertyParserFactory,
58
61
  useFactory: function useFactory(context) {
62
+ var cache = {};
59
63
  return function (propertyName) {
60
- if (context.container.isBoundNamed(StylePropertyParser, propertyName)) {
61
- return context.container.getNamed(StylePropertyParser, propertyName);
64
+ if (!cache[propertyName]) {
65
+ if (context.container.isBoundNamed(StylePropertyParser, propertyName)) {
66
+ cache[propertyName] = context.container.getNamed(StylePropertyParser, propertyName);
67
+ }
62
68
  }
63
69
 
64
- return null;
70
+ return cache[propertyName];
65
71
  };
66
72
  }
67
73
  });
68
74
  register({
69
75
  token: StylePropertyUpdaterFactory,
70
76
  useFactory: function useFactory(context) {
77
+ var cache = {};
71
78
  return function (propertyName) {
72
- if (context.container.isBoundNamed(StylePropertyUpdater, propertyName)) {
73
- return context.container.getAllNamed(StylePropertyUpdater, propertyName);
79
+ if (!cache[propertyName]) {
80
+ if (context.container.isBoundNamed(StylePropertyUpdater, propertyName)) {
81
+ cache[propertyName] = context.container.getAllNamed(StylePropertyUpdater, propertyName);
82
+ }
74
83
  }
75
84
 
76
- return null;
85
+ return cache[propertyName];
77
86
  };
78
87
  }
79
88
  });
80
89
  register({
81
90
  token: StylePropertyMergerFactory,
82
91
  useFactory: function useFactory(context) {
92
+ var cache = {};
83
93
  return function (propertyName) {
84
- if (context.container.isBoundNamed(StylePropertyMerger, propertyName)) {
85
- return context.container.getNamed(StylePropertyMerger, propertyName);
94
+ if (!cache[propertyName]) {
95
+ if (context.container.isBoundNamed(StylePropertyMerger, propertyName)) {
96
+ cache[propertyName] = context.container.getNamed(StylePropertyMerger, propertyName);
97
+ }
86
98
  }
87
99
 
88
- return null;
100
+ return cache[propertyName];
89
101
  };
90
102
  }
91
103
  });
@@ -7,6 +7,7 @@ export interface LinearGradient {
7
7
  x1: number;
8
8
  y1: number;
9
9
  steps: string[][];
10
+ hash: string;
10
11
  }
11
12
  export interface RadialGradient {
12
13
  x0: number;
@@ -16,10 +17,12 @@ export interface RadialGradient {
16
17
  y1: number;
17
18
  r1: number;
18
19
  steps: string[][];
20
+ hash: string;
19
21
  }
20
22
  export interface Pattern {
21
23
  repetition: string;
22
24
  src: string;
25
+ hash: string;
23
26
  }
24
27
  export declare enum PARSED_COLOR_TYPE {
25
28
  Constant = 0,
@@ -134,7 +134,8 @@ function parsePattern(patternStr) {
134
134
 
135
135
  return {
136
136
  src: src,
137
- repetition: repetition
137
+ repetition: repetition,
138
+ hash: patternStr
138
139
  };
139
140
  }
140
141
 
@@ -210,7 +211,8 @@ function parseLineGradient(gradientStr) {
210
211
  y0: start.y,
211
212
  x1: x,
212
213
  y1: y,
213
- steps: steps
214
+ steps: steps,
215
+ hash: gradientStr
214
216
  };
215
217
  }
216
218
 
@@ -242,7 +244,8 @@ function parseRadialGradient(gradientStr) {
242
244
  x1: 0.5,
243
245
  y1: 0.5,
244
246
  r1: fr,
245
- steps: steps
247
+ steps: steps,
248
+ hash: gradientStr
246
249
  };
247
250
  }
248
251
 
@@ -616,11 +616,10 @@ function (_super) {
616
616
  }
617
617
 
618
618
  for (var i = 0; i < PROPAGATION_LIMIT && target !== this.rootTarget; i++) {
619
- if (Node.isNode(target) && !target.parentNode) {
620
- throw new Error('Cannot find propagation path to disconnected target');
621
- }
622
-
623
- if (Node.isNode(target)) {
619
+ // if (Node.isNode(target) && !target.parentNode) {
620
+ // throw new Error('Cannot find propagation path to disconnected target');
621
+ // }
622
+ if (Node.isNode(target) && target.parentNode) {
624
623
  // [target, parent, parent, root]
625
624
  propagationPath.push(target.parentNode);
626
625
  target = target.parentNode;
@@ -22,26 +22,27 @@ export interface PickingResult {
22
22
  export declare class RenderingService {
23
23
  private renderingPluginProvider;
24
24
  private renderingContext;
25
+ private sceneGraphService;
25
26
  private inited;
26
27
  hooks: {
27
- init: AsyncSeriesHook<[], import("tapable").UnsetAdditionalOptions>;
28
- prepare: SyncWaterfallHook<[DisplayObject<any, any>], import("tapable").UnsetAdditionalOptions>;
28
+ init: AsyncSeriesHook<any, any, any>;
29
+ prepare: SyncWaterfallHook<DisplayObject<any, any>, any, any>;
29
30
  /**
30
31
  * called at beginning of each frame, won't get called if nothing to re-render
31
32
  */
32
- beginFrame: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
33
- beforeRender: SyncHook<[DisplayObject<any, any>], void, import("tapable").UnsetAdditionalOptions>;
34
- render: SyncHook<[DisplayObject<any, any>], void, import("tapable").UnsetAdditionalOptions>;
35
- afterRender: SyncHook<[DisplayObject<any, any>], void, import("tapable").UnsetAdditionalOptions>;
36
- endFrame: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
37
- destroy: SyncHook<[], void, import("tapable").UnsetAdditionalOptions>;
38
- pick: AsyncSeriesWaterfallHook<[PickingResult], PickingResult>;
39
- pointerDown: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
40
- pointerUp: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
41
- pointerMove: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
42
- pointerOut: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
43
- pointerOver: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
44
- pointerWheel: SyncHook<[InteractivePointerEvent], void, import("tapable").UnsetAdditionalOptions>;
33
+ beginFrame: SyncHook<any, any, any>;
34
+ beforeRender: SyncHook<DisplayObject<any, any>, any, any>;
35
+ render: SyncHook<DisplayObject<any, any>, any, any>;
36
+ afterRender: SyncHook<DisplayObject<any, any>, any, any>;
37
+ endFrame: SyncHook<any, any, any>;
38
+ destroy: SyncHook<any, any, any>;
39
+ pick: AsyncSeriesWaterfallHook<PickingResult, PickingResult, any>;
40
+ pointerDown: SyncHook<InteractivePointerEvent, any, any>;
41
+ pointerUp: SyncHook<InteractivePointerEvent, any, any>;
42
+ pointerMove: SyncHook<InteractivePointerEvent, any, any>;
43
+ pointerOut: SyncHook<InteractivePointerEvent, any, any>;
44
+ pointerOver: SyncHook<InteractivePointerEvent, any, any>;
45
+ pointerWheel: SyncHook<InteractivePointerEvent, any, any>;
45
46
  };
46
47
  init(): Promise<void>;
47
48
  render(): void;
@@ -3,7 +3,7 @@ import { inject, singleton, contrib, Syringe, Contribution } from 'mana-syringe'
3
3
  import { SyncHook, SyncWaterfallHook, AsyncSeriesHook, AsyncSeriesWaterfallHook } from 'tapable';
4
4
  import { Renderable, Sortable } from '../components';
5
5
  import { RenderingContext, RENDER_REASON } from './RenderingContext';
6
- import { sortByZIndex } from './SceneGraphService';
6
+ import { SceneGraphService, sortByZIndex } from './SceneGraphService';
7
7
  export var RenderingPluginContribution = Syringe.defineToken('RenderingPluginContribution');
8
8
  /**
9
9
  * Use frame renderer implemented by `g-canvas/svg/webgl`, in every frame we do followings:
@@ -27,11 +27,11 @@ function () {
27
27
  /**
28
28
  * called at beginning of each frame, won't get called if nothing to re-render
29
29
  */
30
- beginFrame: new SyncHook([]),
30
+ beginFrame: new SyncHook(),
31
31
  beforeRender: new SyncHook(['objectToRender']),
32
32
  render: new SyncHook(['objectToRender']),
33
33
  afterRender: new SyncHook(['objectToRender']),
34
- endFrame: new SyncHook([]),
34
+ endFrame: new SyncHook(),
35
35
  destroy: new SyncHook(),
36
36
  pick: new AsyncSeriesWaterfallHook(['result']),
37
37
  pointerDown: new SyncHook(['event']),
@@ -73,6 +73,8 @@ function () {
73
73
  };
74
74
 
75
75
  RenderingService.prototype.render = function () {
76
+ this.sceneGraphService.syncHierarchy(this.renderingContext.root);
77
+
76
78
  if (this.renderingContext.renderReasons.size && this.inited) {
77
79
  this.renderDisplayObject(this.renderingContext.root);
78
80
 
@@ -138,6 +140,8 @@ function () {
138
140
 
139
141
  __decorate([inject(RenderingContext), __metadata("design:type", Object)], RenderingService.prototype, "renderingContext", void 0);
140
142
 
143
+ __decorate([inject(SceneGraphService), __metadata("design:type", Object)], RenderingService.prototype, "sceneGraphService", void 0);
144
+
141
145
  RenderingService = __decorate([singleton()], RenderingService);
142
146
  return RenderingService;
143
147
  }();
@@ -37,6 +37,7 @@ export interface SceneGraphService {
37
37
  getLocalBounds(element: INode, render?: boolean): AABB | null;
38
38
  getGeometryBounds(element: INode, render?: boolean): AABB | null;
39
39
  getBoundingClientRect(element: INode): Rectangle;
40
+ syncHierarchy(element: INode): void;
40
41
  }
41
42
  /**
42
43
  * update transform in scene graph
@@ -142,5 +143,8 @@ export declare class DefaultSceneGraphService implements SceneGraphService {
142
143
  getLocalBounds(element: INode): AABB | null;
143
144
  getBoundingClientRect(element: INode): Rectangle;
144
145
  private dirtifyWorldInternal;
145
- private updateTransform;
146
+ syncHierarchy(element: INode): void;
147
+ private sync;
148
+ private updateGraphDepth;
149
+ private unfreezeParentToRoot;
146
150
  }
@@ -369,11 +369,16 @@ function () {
369
369
  sortable.dirty = true;
370
370
  }
371
371
 
372
+ this.updateGraphDepth(child);
372
373
  var transform = entity.getComponent(Transform);
373
374
 
374
375
  if (transform) {
375
376
  this.dirtifyWorld(child, transform);
376
377
  }
378
+
379
+ if (transform.frozen) {
380
+ this.unfreezeParentToRoot(child);
381
+ }
377
382
  };
378
383
 
379
384
  DefaultSceneGraphService.prototype.detach = function (child) {
@@ -519,17 +524,14 @@ function () {
519
524
  if (!transform.dirtyFlag) {
520
525
  this.dirtifyWorld(element, transform);
521
526
  }
522
- } // model matrix changed
523
-
524
-
525
- element.emit(ElementEvent.ATTRIBUTE_CHANGED, {
526
- attributeName: 'modelMatrix',
527
- oldValue: null,
528
- newValue: null
529
- });
527
+ }
530
528
  };
531
529
 
532
530
  DefaultSceneGraphService.prototype.dirtifyWorld = function (element, transform) {
531
+ if (!transform.dirtyFlag) {
532
+ this.unfreezeParentToRoot(element);
533
+ }
534
+
533
535
  this.dirtifyWorldInternal(element, transform);
534
536
  };
535
537
 
@@ -553,10 +555,6 @@ function () {
553
555
  transform = element.entity.getComponent(Transform);
554
556
  }
555
557
 
556
- if (!transform) {
557
- return mat4.create();
558
- }
559
-
560
558
  if (!transform.localDirtyFlag && !transform.dirtyFlag) {
561
559
  return transform.worldTransform;
562
560
  }
@@ -565,7 +563,7 @@ function () {
565
563
  this.getWorldTransform(element.parentNode);
566
564
  }
567
565
 
568
- this.updateTransform(element, transform);
566
+ this.sync(element, transform);
569
567
  return transform.worldTransform;
570
568
  };
571
569
 
@@ -761,13 +759,20 @@ function () {
761
759
 
762
760
  if (!transform.dirtyFlag) {
763
761
  transform.dirtyFlag = true;
762
+ transform.frozen = false;
764
763
  element.childNodes.forEach(function (child) {
765
764
  var childTransform = child.entity.getComponent(Transform);
766
765
 
767
766
  if (!childTransform.dirtyFlag) {
768
767
  _this.dirtifyWorldInternal(child, childTransform);
769
768
  }
770
- }); // emit on leaf node
769
+ }); // model matrix changed
770
+
771
+ element.emit(ElementEvent.ATTRIBUTE_CHANGED, {
772
+ attributeName: 'modelMatrix',
773
+ oldValue: null,
774
+ newValue: null
775
+ }); // FIXME: emit on leaf node
771
776
 
772
777
  if (element.childNodes.length === 0) {
773
778
  dirtifyRenderable(element);
@@ -775,9 +780,30 @@ function () {
775
780
  }
776
781
  };
777
782
 
778
- DefaultSceneGraphService.prototype.updateTransform = function (element, transform) {
783
+ DefaultSceneGraphService.prototype.syncHierarchy = function (element) {
784
+ var transform = element.entity.getComponent(Transform);
785
+
786
+ if (transform.frozen) {
787
+ return;
788
+ }
789
+
790
+ transform.frozen = true;
791
+
792
+ if (transform.localDirtyFlag || transform.dirtyFlag) {
793
+ this.sync(element, transform);
794
+ }
795
+
796
+ var children = element.childNodes;
797
+
798
+ for (var i = 0; i < children.length; i++) {
799
+ this.syncHierarchy(children[i]);
800
+ }
801
+ };
802
+
803
+ DefaultSceneGraphService.prototype.sync = function (element, transform) {
779
804
  if (transform.localDirtyFlag) {
780
- this.getLocalTransform(element);
805
+ mat4.fromRotationTranslationScaleOrigin(transform.localTransform, transform.localRotation, transform.localPosition, transform.localScale, transform.origin);
806
+ transform.localDirtyFlag = false;
781
807
  }
782
808
 
783
809
  if (transform.dirtyFlag) {
@@ -796,6 +822,36 @@ function () {
796
822
  }
797
823
  };
798
824
 
825
+ DefaultSceneGraphService.prototype.updateGraphDepth = function (element) {
826
+ var transform = element.entity.getComponent(Transform);
827
+
828
+ if (element.parentNode) {
829
+ transform.graphDepth = element.parentNode.entity.getComponent(Transform).graphDepth + 1;
830
+ } else {
831
+ transform.graphDepth = 0;
832
+ }
833
+
834
+ var children = element.childNodes;
835
+
836
+ for (var i = 0; i < children.length; i++) {
837
+ this.updateGraphDepth(children[i]);
838
+ }
839
+ };
840
+
841
+ DefaultSceneGraphService.prototype.unfreezeParentToRoot = function (child) {
842
+ var p = child.parentNode;
843
+
844
+ while (p) {
845
+ var transform = p.entity.getComponent(Transform);
846
+
847
+ if (transform) {
848
+ transform.frozen = false;
849
+ }
850
+
851
+ p = p.parentNode;
852
+ }
853
+ };
854
+
799
855
  __decorate([inject(SceneGraphSelectorFactory), __metadata("design:type", Function)], DefaultSceneGraphService.prototype, "sceneGraphSelectorFactory", void 0);
800
856
 
801
857
  DefaultSceneGraphService = __decorate([singleton()], DefaultSceneGraphService);
@@ -7,6 +7,8 @@ export declare class Transform extends Component {
7
7
  static tag: string;
8
8
  dirtyFlag: boolean;
9
9
  localDirtyFlag: boolean;
10
+ frozen: boolean;
11
+ graphDepth: number;
10
12
  /**
11
13
  * local space RTS
12
14
  */
@@ -24,6 +24,8 @@ function (_super) {
24
24
 
25
25
  _this.dirtyFlag = false;
26
26
  _this.localDirtyFlag = false;
27
+ _this.frozen = false;
28
+ _this.graphDepth = 0;
27
29
  /**
28
30
  * local space RTS
29
31
  */
@@ -16,10 +16,7 @@ export interface CustomElement<CustomElementStyleProps> {
16
16
  * @see https://yuque.antfin-inc.com/antv/czqvg5/pgqipg
17
17
  */
18
18
  export declare abstract class CustomElement<CustomElementStyleProps> extends DisplayObject<CustomElementStyleProps> {
19
- private shadowNodes;
20
19
  constructor(config: DisplayObjectConfig<CustomElementStyleProps>);
21
20
  private handleMounted;
22
- private handleChildInserted;
23
- private handleChildRemoved;
24
21
  private handleAttributeChanged;
25
22
  }
@@ -18,39 +18,34 @@ var _interfaces = require("../dom/interfaces");
18
18
  var CustomElement =
19
19
  /** @class */
20
20
  function (_super) {
21
- (0, _tslib.__extends)(CustomElement, _super);
21
+ (0, _tslib.__extends)(CustomElement, _super); // private shadowNodes: DisplayObject[] = [];
22
22
 
23
23
  function CustomElement(config) {
24
24
  var _this = _super.call(this, config) || this;
25
25
 
26
- _this.shadowNodes = [];
27
-
28
26
  _this.handleMounted = function () {
29
- _this.shadowNodes.forEach(function (node) {
30
- // every child and its children should turn into a shadow node
31
- // a shadow node doesn't mean to be unrenderable, it's just unsearchable in scenegraph
32
- node.shadow = true;
33
- });
34
-
27
+ // this.shadowNodes.forEach((node) => {
28
+ // // every child and its children should turn into a shadow node
29
+ // // a shadow node doesn't mean to be unrenderable, it's just unsearchable in scenegraph
30
+ // node.shadow = true;
31
+ // });
35
32
  if (_this.connectedCallback) {
36
33
  _this.connectedCallback();
37
34
  }
38
- };
39
-
40
- _this.handleChildInserted = function (e) {
41
- e.target.forEach(function (node) {
42
- // append children like other shapes after mounted
43
- if (!_this.isConnected) {
44
- _this.shadowNodes.push(node);
45
- }
46
- });
47
- };
48
-
49
- _this.handleChildRemoved = function (e) {
50
- e.target.forEach(function (node) {
51
- node.shadow = false;
52
- });
53
- };
35
+ }; // private handleChildInserted = (e: FederatedEvent) => {
36
+ // (e.target as DisplayObject).forEach((node) => {
37
+ // // append children like other shapes after mounted
38
+ // if (!this.isConnected) {
39
+ // this.shadowNodes.push(node as DisplayObject);
40
+ // }
41
+ // });
42
+ // };
43
+ // private handleChildRemoved = (e: FederatedEvent) => {
44
+ // (e.target as DisplayObject).forEach((node) => {
45
+ // node.shadow = false;
46
+ // });
47
+ // };
48
+
54
49
 
55
50
  _this.handleAttributeChanged = function (e) {
56
51
  // only listen itself
@@ -64,11 +59,9 @@ function (_super) {
64
59
  oldValue = _a.oldValue,
65
60
  newValue = _a.newValue;
66
61
  _this.attributeChangedCallback && _this.attributeChangedCallback(attributeName, oldValue, newValue);
67
- };
68
-
69
- _this.addEventListener(_interfaces.ElementEvent.CHILD_INSERTED, _this.handleChildInserted);
62
+ }; // this.addEventListener(ElementEvent.CHILD_INSERTED, this.handleChildInserted);
63
+ // this.addEventListener(ElementEvent.CHILD_REMOVED, this.handleChildRemoved);
70
64
 
71
- _this.addEventListener(_interfaces.ElementEvent.CHILD_REMOVED, _this.handleChildRemoved);
72
65
 
73
66
  if (_this.attributeChangedCallback) {
74
67
  _this.addEventListener(_interfaces.ElementEvent.ATTRIBUTE_CHANGED, _this.handleAttributeChanged);
@@ -7,6 +7,8 @@ export interface PolylineStyleProps extends BaseStyleProps {
7
7
  }
8
8
  export interface ParsedPolylineStyleProps {
9
9
  points: [number, number][];
10
+ defX: number;
11
+ defY: number;
10
12
  segments: [number, number][];
11
13
  totalLength: number;
12
14
  }
@@ -7,12 +7,12 @@ exports.Polyline = void 0;
7
7
 
8
8
  var _tslib = require("tslib");
9
9
 
10
+ var _gMath = require("@antv/g-math");
11
+
10
12
  var _types = require("../types");
11
13
 
12
14
  var _DisplayObject = require("./DisplayObject");
13
15
 
14
- var _gMath = require("@antv/g-math");
15
-
16
16
  var _shapes = require("../shapes");
17
17
 
18
18
  var Polyline =