@antv/g 5.0.3 → 5.0.7

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 (58) hide show
  1. package/dist/index.umd.js +1 -1
  2. package/es/Canvas.d.ts +9 -0
  3. package/es/Canvas.js +16 -9
  4. package/es/camera/Camera.d.ts +2 -1
  5. package/es/camera/Camera.js +13 -5
  6. package/es/components/Sortable.d.ts +4 -0
  7. package/es/components/Sortable.js +5 -0
  8. package/es/display-objects/DisplayObject.d.ts +2 -5
  9. package/es/display-objects/DisplayObject.js +16 -9
  10. package/es/display-objects/Line.d.ts +6 -0
  11. package/es/display-objects/Line.js +7 -8
  12. package/es/display-objects/Path.js +3 -7
  13. package/es/display-objects/Polyline.js +3 -7
  14. package/es/display-objects/Text.js +3 -7
  15. package/es/dom/Element.d.ts +10 -10
  16. package/es/dom/Element.js +7 -4
  17. package/es/dom/Node.d.ts +7 -7
  18. package/es/dom/interfaces.d.ts +21 -17
  19. package/es/dom/interfaces.js +5 -0
  20. package/es/global-module.d.ts +4 -0
  21. package/es/global-module.js +58 -71
  22. package/es/plugins/FrustumCullingStrategy.js +3 -1
  23. package/es/property-handlers/localPosition.js +4 -2
  24. package/es/services/RenderingService.d.ts +6 -0
  25. package/es/services/RenderingService.js +29 -1
  26. package/es/services/SceneGraphService.js +4 -4
  27. package/es/types.d.ts +10 -3
  28. package/es/types.js +16 -0
  29. package/es/utils/interpolation.js +10 -7
  30. package/lib/Canvas.d.ts +9 -0
  31. package/lib/Canvas.js +16 -9
  32. package/lib/camera/Camera.d.ts +2 -1
  33. package/lib/camera/Camera.js +14 -5
  34. package/lib/components/Sortable.d.ts +4 -0
  35. package/lib/components/Sortable.js +5 -0
  36. package/lib/display-objects/DisplayObject.d.ts +2 -5
  37. package/lib/display-objects/DisplayObject.js +13 -8
  38. package/lib/display-objects/Line.d.ts +6 -0
  39. package/lib/display-objects/Line.js +6 -7
  40. package/lib/display-objects/Path.js +2 -6
  41. package/lib/display-objects/Polyline.js +2 -6
  42. package/lib/display-objects/Text.js +2 -6
  43. package/lib/dom/Element.d.ts +10 -10
  44. package/lib/dom/Element.js +7 -4
  45. package/lib/dom/Node.d.ts +7 -7
  46. package/lib/dom/interfaces.d.ts +21 -17
  47. package/lib/dom/interfaces.js +5 -0
  48. package/lib/global-module.d.ts +4 -0
  49. package/lib/global-module.js +58 -71
  50. package/lib/plugins/FrustumCullingStrategy.js +2 -0
  51. package/lib/property-handlers/localPosition.js +4 -2
  52. package/lib/services/RenderingService.d.ts +6 -0
  53. package/lib/services/RenderingService.js +30 -1
  54. package/lib/services/SceneGraphService.js +4 -4
  55. package/lib/types.d.ts +10 -3
  56. package/lib/types.js +19 -1
  57. package/lib/utils/interpolation.js +7 -9
  58. package/package.json +3 -3
@@ -2,9 +2,8 @@ import type { mat3, vec2 } from 'gl-matrix';
2
2
  import { mat4, quat, vec3 } from 'gl-matrix';
3
3
  import type { Animation } from '../dom/Animation';
4
4
  import { Element } from '../dom/Element';
5
- import type { DisplayObjectConfig, INode } from '../dom/interfaces';
5
+ import type { DisplayObjectConfig, IChildNode } from '../dom/interfaces';
6
6
  import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
7
- import type { StylePropertyParser, StylePropertyUpdater } from '../property-handlers';
8
7
  /**
9
8
  * prototype chains: DisplayObject -> Element -> Node -> EventTarget
10
9
  *
@@ -32,8 +31,6 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
32
31
  * push to active animations after calling `animate()`
33
32
  */
34
33
  private activeAnimations;
35
- stylePropertyUpdaterFactory: <Key extends keyof StyleProps>(stylePropertyName: Key) => StylePropertyUpdater<any>[];
36
- stylePropertyParserFactory: <Key extends keyof ParsedStyleProps>(stylePropertyName: Key) => StylePropertyParser<any, any>;
37
34
  constructor(config: DisplayObjectConfig<StyleProps>);
38
35
  destroy(): void;
39
36
  cloneNode(deep?: boolean): this;
@@ -193,7 +190,7 @@ export declare class DisplayObject<StyleProps extends BaseStyleProps = any, Pars
193
190
  * compatible with G 3.0
194
191
  * @deprecated
195
192
  */
196
- add<T extends INode>(child: T, index?: number): T;
193
+ add<T extends IChildNode>(child: T, index?: number): T;
197
194
  /**
198
195
  * @alias style.clipPath
199
196
  * @deprecated
@@ -23,12 +23,12 @@ var _types = require("../types");
23
23
 
24
24
  var _utils = require("../utils");
25
25
 
26
- var _propertyHandlers = require("../property-handlers");
27
-
28
26
  var _globalModule = require("../global-module");
29
27
 
30
28
  var _services = require("../services");
31
29
 
30
+ // import type { StylePropertyParser, StylePropertyUpdater } from '../property-handlers';
31
+ // import { StylePropertyParserFactory, StylePropertyUpdaterFactory } from '../property-handlers';
32
32
  var DEFAULT_STYLE_PROPS = {
33
33
  anchor: [0, 0, 0],
34
34
  origin: [0, 0, 0],
@@ -58,7 +58,12 @@ var DEFAULT_STYLE_PROPS = {
58
58
  var DisplayObject =
59
59
  /** @class */
60
60
  function (_super) {
61
- (0, _tslib.__extends)(DisplayObject, _super);
61
+ (0, _tslib.__extends)(DisplayObject, _super); // stylePropertyUpdaterFactory = globalContainer.get<
62
+ // <Key extends keyof StyleProps>(stylePropertyName: Key) => StylePropertyUpdater<any>[]
63
+ // >(StylePropertyUpdaterFactory);
64
+ // stylePropertyParserFactory = globalContainer.get<
65
+ // <Key extends keyof ParsedStyleProps>(stylePropertyName: Key) => StylePropertyParser<any, any>
66
+ // >(StylePropertyParserFactory);
62
67
 
63
68
  function DisplayObject(config) {
64
69
  var _a, _b, _c;
@@ -69,9 +74,7 @@ function (_super) {
69
74
  */
70
75
 
71
76
 
72
- _this.activeAnimations = [];
73
- _this.stylePropertyUpdaterFactory = _globalModule.globalContainer.get(_propertyHandlers.StylePropertyUpdaterFactory);
74
- _this.stylePropertyParserFactory = _globalModule.globalContainer.get(_propertyHandlers.StylePropertyParserFactory); // assign name, id to config
77
+ _this.activeAnimations = []; // assign name, id to config
75
78
  // eg. group.get('name')
76
79
 
77
80
  _this.config = config; // compatible with G 3.0
@@ -199,7 +202,8 @@ function (_super) {
199
202
 
200
203
 
201
204
  DisplayObject.prototype.parseStyleProperty = function (name, value) {
202
- var stylePropertyParser = this.stylePropertyParserFactory(name);
205
+ // const stylePropertyParser = this.stylePropertyParserFactory(name);
206
+ var stylePropertyParser = _globalModule.stylePropertyParserFactory[name];
203
207
 
204
208
  if (stylePropertyParser) {
205
209
  // @ts-ignore
@@ -212,9 +216,10 @@ function (_super) {
212
216
  DisplayObject.prototype.updateStyleProperty = function (name, oldParsedValue, newParsedValue) {
213
217
  var _this = this; // update property, which may cause AABB re-calc
214
218
  // @ts-ignore
219
+ // const stylePropertyUpdaters = this.stylePropertyUpdaterFactory(name);
215
220
 
216
221
 
217
- var stylePropertyUpdaters = this.stylePropertyUpdaterFactory(name);
222
+ var stylePropertyUpdaters = _globalModule.stylePropertyUpdaterFactory[name];
218
223
 
219
224
  if (stylePropertyUpdaters) {
220
225
  stylePropertyUpdaters.forEach(function (updater) {
@@ -7,14 +7,20 @@ export interface LineStyleProps extends BaseStyleProps {
7
7
  y1: number;
8
8
  x2: number;
9
9
  y2: number;
10
+ z1?: number;
11
+ z2?: number;
12
+ isBillboard?: boolean;
10
13
  }
11
14
  export interface ParsedLineStyleProps extends ParsedBaseStyleProps {
12
15
  x1: number;
13
16
  y1: number;
14
17
  x2: number;
15
18
  y2: number;
19
+ z1?: number;
20
+ z2?: number;
16
21
  defX: number;
17
22
  defY: number;
23
+ isBillboard?: boolean;
18
24
  }
19
25
  export declare class Line extends DisplayObject<LineStyleProps, ParsedLineStyleProps> {
20
26
  constructor({ style, ...rest }: DisplayObjectConfig<LineStyleProps>);
@@ -30,13 +30,12 @@ function (_super) {
30
30
  y1: 0,
31
31
  x2: 0,
32
32
  y2: 0,
33
- lineJoin: "miter"
34
- /* Miter */
35
- ,
36
- lineCap: "butt"
37
- /* Butt */
38
- ,
39
- lineWidth: 1
33
+ z1: 0,
34
+ z2: 0,
35
+ lineJoin: _types.LINE_JOIN.Miter,
36
+ lineCap: _types.LINE_CAP.Butt,
37
+ lineWidth: 1,
38
+ isBillboard: false
40
39
  }, style)
41
40
  }, rest)) || this;
42
41
  }
@@ -29,12 +29,8 @@ function (_super) {
29
29
  type: _types.SHAPE.Path,
30
30
  style: (0, _tslib.__assign)({
31
31
  path: '',
32
- lineJoin: "miter"
33
- /* Miter */
34
- ,
35
- lineCap: "butt"
36
- /* Butt */
37
- ,
32
+ lineJoin: _types.LINE_JOIN.Miter,
33
+ lineCap: _types.LINE_CAP.Butt,
38
34
  lineWidth: 1
39
35
  }, style)
40
36
  }, rest)) || this;
@@ -27,12 +27,8 @@ function (_super) {
27
27
  type: _types.SHAPE.Polyline,
28
28
  style: (0, _tslib.__assign)({
29
29
  points: [],
30
- lineJoin: "miter"
31
- /* Miter */
32
- ,
33
- lineCap: "butt"
34
- /* Butt */
35
- ,
30
+ lineJoin: _types.LINE_JOIN.Miter,
31
+ lineCap: _types.LINE_CAP.Butt,
36
32
  lineWidth: 1
37
33
  }, style)
38
34
  }, rest)) || this;
@@ -39,12 +39,8 @@ function (_super) {
39
39
  fill: '#000',
40
40
  letterSpacing: 0,
41
41
  lineHeight: 0,
42
- lineJoin: "miter"
43
- /* Miter */
44
- ,
45
- lineCap: "butt"
46
- /* Butt */
47
- ,
42
+ lineJoin: _types.LINE_JOIN.Miter,
43
+ lineCap: _types.LINE_CAP.Butt,
48
44
  lineWidth: 0,
49
45
  miterLimit: 10,
50
46
  padding: 0,
@@ -3,7 +3,7 @@ import { Cullable, Geometry, Renderable, Transform, Sortable } from '../componen
3
3
  import type { BaseStyleProps, ParsedBaseStyleProps } from '../types';
4
4
  import { Node } from './Node';
5
5
  import type { AABB, Rectangle } from '../shapes';
6
- import type { IEventTarget, IChildNode, IElement, INode } from './interfaces';
6
+ import type { IEventTarget, IElement, INode } from './interfaces';
7
7
  /**
8
8
  * Has following capabilities:
9
9
  * * Node insert/remove, eg. appendChild, removeChild, remove...
@@ -51,9 +51,9 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
51
51
  get previousSibling(): IElement | null;
52
52
  cloneNode(deep?: boolean): this;
53
53
  appendChild<T extends INode>(child: T, index?: number): T;
54
- insertBefore<T extends IChildNode, R extends IChildNode>(newChild: T, refChild: R | null): T;
55
- replaceChild<N extends IChildNode, T extends IChildNode>(newChild: N, oldChild: T, destroy?: boolean): T;
56
- removeChild<T extends IChildNode>(child: T, destroy?: boolean): T;
54
+ insertBefore<T extends INode>(newChild: T, refChild: INode | null): T;
55
+ replaceChild<T extends INode>(newChild: INode, oldChild: T, destroy?: boolean): T;
56
+ removeChild<T extends INode>(child: T, destroy?: boolean): T;
57
57
  removeChildren(destroy?: boolean): void;
58
58
  /**
59
59
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
@@ -73,27 +73,27 @@ export declare class Element<StyleProps extends BaseStyleProps = any, ParsedStyl
73
73
  /**
74
74
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/after
75
75
  */
76
- after(...nodes: IChildNode[]): void;
76
+ after(...nodes: INode[]): void;
77
77
  /**
78
78
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/before
79
79
  */
80
- before(...nodes: IChildNode[]): void;
80
+ before(...nodes: INode[]): void;
81
81
  /**
82
82
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/replaceWith
83
83
  */
84
- replaceWith(...nodes: IChildNode[]): void;
84
+ replaceWith(...nodes: INode[]): void;
85
85
  /**
86
86
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/append
87
87
  */
88
- append(...nodes: IChildNode[]): void;
88
+ append(...nodes: INode[]): void;
89
89
  /**
90
90
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/prepend
91
91
  */
92
- prepend(...nodes: IChildNode[]): void;
92
+ prepend(...nodes: INode[]): void;
93
93
  /**
94
94
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/replaceChildren
95
95
  */
96
- replaceChildren(...nodes: IChildNode[]): void;
96
+ replaceChildren(...nodes: INode[]): void;
97
97
  /**
98
98
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Element/remove
99
99
  */
@@ -312,6 +312,8 @@ function (_super) {
312
312
 
313
313
 
314
314
  Element.prototype.before = function () {
315
+ var _a;
316
+
315
317
  var nodes = [];
316
318
 
317
319
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -321,12 +323,13 @@ function (_super) {
321
323
  if (this.parentNode) {
322
324
  var index = this.parentNode.childNodes.indexOf(this);
323
325
 
324
- var _a = (0, _tslib.__read)(nodes),
325
- first = _a[0],
326
- rest = _a.slice(1);
326
+ var _b = (0, _tslib.__read)(nodes),
327
+ first = _b[0],
328
+ rest = _b.slice(1);
327
329
 
328
330
  this.parentNode.appendChild(first, index);
329
- first.after.apply(first, (0, _tslib.__spreadArray)([], (0, _tslib.__read)(rest), false));
331
+
332
+ (_a = first).after.apply(_a, (0, _tslib.__spreadArray)([], (0, _tslib.__read)(rest), false));
330
333
  }
331
334
  };
332
335
  /**
package/lib/dom/Node.d.ts CHANGED
@@ -28,7 +28,7 @@ export declare abstract class Node extends EventTarget implements INode {
28
28
  * Returns the children.
29
29
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes
30
30
  */
31
- childNodes: (IChildNode & INode)[];
31
+ childNodes: IChildNode[];
32
32
  /**
33
33
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeType
34
34
  */
@@ -81,26 +81,26 @@ export declare abstract class Node extends EventTarget implements INode {
81
81
  /**
82
82
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild
83
83
  */
84
- abstract appendChild<T extends IChildNode>(newChild: T, index?: number): T;
84
+ abstract appendChild<T extends INode>(newChild: T, index?: number): T;
85
85
  /**
86
86
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore
87
87
  */
88
- abstract insertBefore<T extends IChildNode, R extends IChildNode>(newChild: T, refChild: R | null): T;
88
+ abstract insertBefore<T extends INode>(newChild: T, refChild: INode | null): T;
89
89
  /**
90
90
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild
91
91
  */
92
- abstract removeChild<T extends IChildNode>(child: T, destroy?: boolean): T;
92
+ abstract removeChild<T extends INode>(child: T, destroy?: boolean): T;
93
93
  /**
94
94
  * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/replaceChild
95
95
  */
96
- abstract replaceChild<N extends IChildNode, T extends IChildNode>(newChild: N, oldChild: T, destroy?: boolean): T;
96
+ abstract replaceChild<T extends INode>(newChild: INode, oldChild: T, destroy?: boolean): T;
97
97
  abstract destroy(): void;
98
98
  /**
99
99
  * @deprecated
100
100
  * @alias contains
101
101
  */
102
- contain<T extends IChildNode>(other: T | null): boolean;
103
- contains<T extends IChildNode>(other: T | null): boolean;
102
+ contain<T extends INode>(other: T | null): boolean;
103
+ contains<T extends INode>(other: T | null): boolean;
104
104
  getAncestor(n: number): INode | null;
105
105
  forEach(callback: (o: INode) => void | boolean): void;
106
106
  }
@@ -1,6 +1,6 @@
1
1
  import type EventEmitter from 'eventemitter3';
2
2
  import type { AnimationTimeline } from './AnimationTimeline';
3
- import type { BaseStyleProps, ParsedBaseStyleProps, SHAPE } from '../types';
3
+ import type { BaseStyleProps, SHAPE } from '../types';
4
4
  import type { FederatedEvent } from './FederatedEvent';
5
5
  import type { CustomElementRegistry } from './CustomElementRegistry';
6
6
  import type { DisplayObject } from '..';
@@ -31,7 +31,11 @@ export declare enum ElementEvent {
31
31
  CHILD_REMOVED = "child-removed",
32
32
  MOUNTED = "mounted",
33
33
  UNMOUNTED = "unmounted",
34
- BOUNDS_CHANGED = "bounds-changed"
34
+ BOUNDS_CHANGED = "bounds-changed",
35
+ /**
36
+ * trigger when z-index changed
37
+ */
38
+ RENDER_ORDER_CHANGED = "render-order-changed"
35
39
  }
36
40
  export interface IEventTarget {
37
41
  emitter: EventEmitter;
@@ -52,11 +56,11 @@ export interface INode extends IEventTarget {
52
56
  /**
53
57
  * Returns the children.
54
58
  */
55
- readonly childNodes: (IChildNode & INode)[];
59
+ readonly childNodes: IChildNode[];
56
60
  /**
57
61
  * Returns the first child.
58
62
  */
59
- readonly firstChild: (IChildNode & INode) | null;
63
+ readonly firstChild: IChildNode | null;
60
64
  /**
61
65
  * Returns true if node is connected and false otherwise.
62
66
  */
@@ -64,11 +68,11 @@ export interface INode extends IEventTarget {
64
68
  /**
65
69
  * Returns the last child.
66
70
  */
67
- readonly lastChild: (IChildNode & INode) | null;
71
+ readonly lastChild: IChildNode | null;
68
72
  /**
69
73
  * Returns the next sibling.
70
74
  */
71
- readonly nextSibling: (IChildNode & INode) | null;
75
+ readonly nextSibling: IChildNode | null;
72
76
  /**
73
77
  * Returns a string appropriate for the type of node.
74
78
  */
@@ -93,13 +97,13 @@ export interface INode extends IEventTarget {
93
97
  /**
94
98
  * Returns the previous sibling.
95
99
  */
96
- readonly previousSibling: (IChildNode & INode) | null;
100
+ readonly previousSibling: IChildNode | null;
97
101
  textContent: string | null;
98
- appendChild: <T extends IChildNode>(newChild: T, index?: number) => T;
102
+ appendChild: <T extends INode>(newChild: T, index?: number) => T;
99
103
  /**
100
104
  * Returns a copy of node. If deep is true, the copy also includes the node's descendants.
101
105
  */
102
- cloneNode: (deep?: boolean) => this;
106
+ cloneNode: (deep?: boolean) => INode;
103
107
  /**
104
108
  * Returns a bitmask indicating the position of other relative to node.
105
109
  */
@@ -107,7 +111,7 @@ export interface INode extends IEventTarget {
107
111
  /**
108
112
  * Returns true if other is an inclusive descendant of node, and false otherwise.
109
113
  */
110
- contains: <T extends IChildNode>(other: T | null) => boolean;
114
+ contains: (other: INode | null) => boolean;
111
115
  /**
112
116
  * Returns node's root.
113
117
  */
@@ -124,7 +128,7 @@ export interface INode extends IEventTarget {
124
128
  * Returns whether node has children.
125
129
  */
126
130
  hasChildNodes: () => boolean;
127
- insertBefore: <T extends IChildNode, R extends IChildNode>(newChild: T, refChild: R | null) => T;
131
+ insertBefore: <T extends INode>(newChild: T, refChild: INode | null) => T;
128
132
  isDefaultNamespace: (namespace: string | null) => boolean;
129
133
  /**
130
134
  * Returns whether node and otherNode have the same properties.
@@ -137,8 +141,8 @@ export interface INode extends IEventTarget {
137
141
  * Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes.
138
142
  */
139
143
  normalize: () => void;
140
- removeChild: <T extends IChildNode>(oldChild: T, destroy?: boolean) => T;
141
- replaceChild: <T extends IChildNode, R extends IChildNode>(newChild: R, oldChild: T, destroy?: boolean) => T;
144
+ removeChild: <T extends INode>(oldChild: T, destroy?: boolean) => T;
145
+ replaceChild: <T extends INode>(newChild: INode, oldChild: T, destroy?: boolean) => T;
142
146
  /**
143
147
  * Destroy itself.
144
148
  */
@@ -193,13 +197,13 @@ export interface IChildNode extends INode {
193
197
  *
194
198
  * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
195
199
  */
196
- after: (...nodes: IChildNode[]) => void;
200
+ after: (...nodes: INode[]) => void;
197
201
  /**
198
202
  * Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes.
199
203
  *
200
204
  * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
201
205
  */
202
- before: (...nodes: IChildNode[]) => void;
206
+ before: (...nodes: INode[]) => void;
203
207
  /**
204
208
  * Removes node.
205
209
  */
@@ -209,7 +213,7 @@ export interface IChildNode extends INode {
209
213
  *
210
214
  * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated.
211
215
  */
212
- replaceWith: (...nodes: IChildNode[]) => void;
216
+ replaceWith: (...nodes: INode[]) => void;
213
217
  }
214
218
  export interface DisplayObjectConfig<StyleProps> {
215
219
  /**
@@ -250,7 +254,7 @@ export interface DisplayObjectConfig<StyleProps> {
250
254
  */
251
255
  interactive?: boolean;
252
256
  }
253
- export interface IElement<StyleProps extends BaseStyleProps = any, ParsedStyleProps extends ParsedBaseStyleProps = any> extends INode, IChildNode, IParentNode {
257
+ export interface IElement<StyleProps = any, ParsedStyleProps = any> extends INode, IChildNode, IParentNode {
254
258
  /**
255
259
  * Returns the value of element's id content attribute. Can be set to change it.
256
260
  */
@@ -37,4 +37,9 @@ exports.ElementEvent = ElementEvent;
37
37
  ElementEvent["MOUNTED"] = "mounted";
38
38
  ElementEvent["UNMOUNTED"] = "unmounted";
39
39
  ElementEvent["BOUNDS_CHANGED"] = "bounds-changed";
40
+ /**
41
+ * trigger when z-index changed
42
+ */
43
+
44
+ ElementEvent["RENDER_ORDER_CHANGED"] = "render-order-changed";
40
45
  })(ElementEvent || (exports.ElementEvent = ElementEvent = {}));
@@ -1,2 +1,6 @@
1
+ import type { StylePropertyParser, StylePropertyMerger, StylePropertyUpdater } from './property-handlers';
1
2
  export declare const globalContainer: import("mana-syringe").Container;
3
+ export declare const stylePropertyParserFactory: Record<string, StylePropertyParser<any, any>>;
4
+ export declare const stylePropertyUpdaterFactory: Record<string, StylePropertyUpdater<any>[]>;
5
+ export declare const stylePropertyMergerFactory: Record<string, StylePropertyMerger<any, any>>;
2
6
  export declare const containerModule: import("mana-syringe").SyringeModule;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.globalContainer = exports.containerModule = void 0;
6
+ exports.stylePropertyUpdaterFactory = exports.stylePropertyParserFactory = exports.stylePropertyMergerFactory = exports.globalContainer = exports.containerModule = void 0;
7
7
 
8
8
  var _manaSyringe = require("mana-syringe");
9
9
 
@@ -27,6 +27,12 @@ var _propertyHandlers = require("./property-handlers");
27
27
 
28
28
  var globalContainer = _manaSyringe.GlobalContainer;
29
29
  exports.globalContainer = globalContainer;
30
+ var stylePropertyParserFactory = {};
31
+ exports.stylePropertyParserFactory = stylePropertyParserFactory;
32
+ var stylePropertyUpdaterFactory = {};
33
+ exports.stylePropertyUpdaterFactory = stylePropertyUpdaterFactory;
34
+ var stylePropertyMergerFactory = {};
35
+ exports.stylePropertyMergerFactory = stylePropertyMergerFactory;
30
36
  var containerModule = (0, _manaSyringe.Module)(function (register) {
31
37
  (0, _manaSyringe.decorate)((0, _manaSyringe.injectable)(), _eventemitter.EventEmitter); // bind DisplayObject pool
32
38
 
@@ -74,83 +80,65 @@ var containerModule = (0, _manaSyringe.Module)(function (register) {
74
80
  return cache[tagName];
75
81
  };
76
82
  }
77
- }); // bind style property handlers
78
-
79
- register({
80
- token: _propertyHandlers.StylePropertyParserFactory,
81
- useFactory: function useFactory(context) {
82
- var cache = {};
83
- return function (propertyName) {
84
- if (!cache[propertyName]) {
85
- if (context.container.isBoundNamed(_propertyHandlers.StylePropertyParser, propertyName)) {
86
- cache[propertyName] = context.container.getNamed(_propertyHandlers.StylePropertyParser, propertyName);
87
- }
88
- }
89
-
90
- return cache[propertyName];
91
- };
92
- }
93
- });
94
- register({
95
- token: _propertyHandlers.StylePropertyUpdaterFactory,
96
- useFactory: function useFactory(context) {
97
- var cache = {};
98
- return function (propertyName) {
99
- if (!cache[propertyName]) {
100
- if (context.container.isBoundNamed(_propertyHandlers.StylePropertyUpdater, propertyName)) {
101
- cache[propertyName] = context.container.getAllNamed(_propertyHandlers.StylePropertyUpdater, propertyName);
102
- }
103
- }
104
-
105
- return cache[propertyName];
106
- };
107
- }
108
- });
109
- register({
110
- token: _propertyHandlers.StylePropertyMergerFactory,
111
- useFactory: function useFactory(context) {
112
- var cache = {};
113
- return function (propertyName) {
114
- if (!cache[propertyName]) {
115
- if (context.container.isBoundNamed(_propertyHandlers.StylePropertyMerger, propertyName)) {
116
- cache[propertyName] = context.container.getNamed(_propertyHandlers.StylePropertyMerger, propertyName);
117
- }
118
- }
119
-
120
- return cache[propertyName];
121
- };
122
- }
123
- });
83
+ }); // // bind style property handlers
84
+ // register({
85
+ // token: StylePropertyParserFactory,
86
+ // useFactory: (context) => {
87
+ // const cache = {};
88
+ // return (propertyName: string) => {
89
+ // if (!cache[propertyName]) {
90
+ // if (context.container.isBoundNamed(StylePropertyParser, propertyName)) {
91
+ // cache[propertyName] = context.container.getNamed(StylePropertyParser, propertyName);
92
+ // }
93
+ // }
94
+ // return cache[propertyName];
95
+ // };
96
+ // },
97
+ // });
98
+ // register({
99
+ // token: StylePropertyUpdaterFactory,
100
+ // useFactory: (context) => {
101
+ // const cache = {};
102
+ // return (propertyName: string) => {
103
+ // if (!cache[propertyName]) {
104
+ // if (context.container.isBoundNamed(StylePropertyUpdater, propertyName)) {
105
+ // cache[propertyName] = context.container.getAllNamed(StylePropertyUpdater, propertyName);
106
+ // }
107
+ // }
108
+ // return cache[propertyName];
109
+ // };
110
+ // },
111
+ // });
112
+ // register({
113
+ // token: StylePropertyMergerFactory,
114
+ // useFactory: (context) => {
115
+ // const cache = {};
116
+ // return (propertyName: string) => {
117
+ // if (!cache[propertyName]) {
118
+ // if (context.container.isBoundNamed(StylePropertyMerger, propertyName)) {
119
+ // cache[propertyName] = context.container.getNamed(StylePropertyMerger, propertyName);
120
+ // }
121
+ // }
122
+ // return cache[propertyName];
123
+ // };
124
+ // },
125
+ // });
124
126
 
125
127
  function addPropertyHandler(property, parser, merger, updater) {
126
128
  if (parser) {
127
- register({
128
- token: {
129
- token: _propertyHandlers.StylePropertyParser,
130
- named: property
131
- },
132
- useValue: parser
133
- });
129
+ stylePropertyParserFactory[property] = parser; // register({ token: { token: StylePropertyParser, named: property }, useValue: parser });
134
130
  }
135
131
 
136
132
  if (merger) {
137
- register({
138
- token: {
139
- token: _propertyHandlers.StylePropertyMerger,
140
- named: property
141
- },
142
- useValue: merger
143
- });
133
+ stylePropertyMergerFactory[property] = merger; // register({ token: { token: StylePropertyMerger, named: property }, useValue: merger });
144
134
  }
145
135
 
146
136
  if (updater) {
147
- register({
148
- token: {
149
- token: _propertyHandlers.StylePropertyUpdater,
150
- named: property
151
- },
152
- useValue: updater
153
- });
137
+ if (!stylePropertyUpdaterFactory[property]) {
138
+ stylePropertyUpdaterFactory[property] = [];
139
+ }
140
+
141
+ stylePropertyUpdaterFactory[property].push(updater); // register({ token: { token: StylePropertyUpdater, named: property }, useValue: updater });
154
142
  }
155
143
  }
156
144
 
@@ -184,8 +172,7 @@ var containerModule = (0, _manaSyringe.Module)(function (register) {
184
172
 
185
173
  addPropertyHandler('points', _propertyHandlers.parsePoints, undefined, undefined); // update local position
186
174
 
187
- addPropertiesHandler(['x', 'y', 'points', 'path', 'x1', 'x2', 'y1', 'y2'], // ['x', 'y'],
188
- undefined, undefined, _propertyHandlers.updateLocalPosition);
175
+ addPropertiesHandler(['x', 'y', 'z', 'points', 'path', 'x1', 'x2', 'y1', 'y2', 'z1', 'z2'], undefined, undefined, _propertyHandlers.updateLocalPosition);
189
176
  addPropertyHandler('filter', _propertyHandlers.parseFilter, undefined, undefined);
190
177
  addPropertyHandler('anchor', undefined, undefined, _propertyHandlers.updateAnchor);
191
178
  });
@@ -15,6 +15,8 @@ var _CullingPlugin = require("./CullingPlugin");
15
15
 
16
16
  var _shapes = require("../shapes");
17
17
 
18
+ // import { vec3, mat4 } from 'gl-matrix';
19
+ // import { inject, singleton } from 'mana-syringe';
18
20
  // import type { Element } from '../dom';
19
21
  var FrustumCullingStrategy =
20
22
  /** @class */
@@ -10,7 +10,9 @@ function updateLocalPosition(oldValue, newValue, object) {
10
10
  _b = _a.x,
11
11
  x = _b === void 0 ? 0 : _b,
12
12
  _c = _a.y,
13
- y = _c === void 0 ? 0 : _c; // update local position when x/y changed
13
+ y = _c === void 0 ? 0 : _c,
14
+ _d = _a.z,
15
+ z = _d === void 0 ? 0 : _d; // update local position when x/y changed
14
16
 
15
- object.setLocalPosition(x, y);
17
+ object.setLocalPosition(x, y, z);
16
18
  }