@antv/g 5.0.6 → 5.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/Canvas.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Cursor } from './types';
1
2
  import { CanvasConfig } from './types';
2
3
  import { DisplayObject } from './display-objects/DisplayObject';
3
4
  import { ContextService } from './services';
@@ -5,7 +6,7 @@ import { RenderingService } from './services/RenderingService';
5
6
  import { RenderingContext } from './services/RenderingContext';
6
7
  import { EventService } from './services/EventService';
7
8
  import { Camera } from './camera';
8
- import type { AbstractRenderer } from './AbstractRenderer';
9
+ import type { IRenderer } from './AbstractRenderer';
9
10
  import type { PointLike } from './shapes';
10
11
  import type { IChildNode } from './dom';
11
12
  import { Document, EventTarget } from './dom';
@@ -47,6 +48,9 @@ export declare class Canvas extends EventTarget implements ICanvas {
47
48
  */
48
49
  private eventService;
49
50
  private renderingService;
51
+ private inited;
52
+ private readyPromise;
53
+ private resolveReadyPromise;
50
54
  constructor(config: CanvasConfig);
51
55
  private initRenderingContext;
52
56
  private initDefaultCamera;
@@ -70,6 +74,7 @@ export declare class Canvas extends EventTarget implements ICanvas {
70
74
  rendered: number;
71
75
  };
72
76
  getComputedStyle(node: DisplayObject): any;
77
+ get ready(): Promise<any>;
73
78
  destroy(destroyScenegraph?: boolean): void;
74
79
  /**
75
80
  * compatible with G 3.0
@@ -87,7 +92,8 @@ export declare class Canvas extends EventTarget implements ICanvas {
87
92
  private initRenderer;
88
93
  private loadCommonContainerModule;
89
94
  private loadRendererContainerModule;
90
- setRenderer(renderer: AbstractRenderer): void;
95
+ setRenderer(renderer: IRenderer): void;
96
+ setCursor(cursor: Cursor): void;
91
97
  private unmountChildren;
92
98
  private mountChildren;
93
99
  client2Viewport(client: PointLike): PointLike;
package/es/Canvas.js CHANGED
@@ -42,7 +42,8 @@ function (_super) {
42
42
 
43
43
 
44
44
  _this.container = globalContainer.createChild();
45
- _this.Element = DisplayObject; // create document
45
+ _this.Element = DisplayObject;
46
+ _this.inited = false; // create document
46
47
 
47
48
  _this.document = new Document();
48
49
  _this.document.defaultView = _this; // create registry of custom elements
@@ -53,8 +54,7 @@ function (_super) {
53
54
  var mergedConfig = __assign({
54
55
  width: 300,
55
56
  height: 150,
56
- cursor: 'default',
57
- background: 'white'
57
+ cursor: 'default'
58
58
  }, config);
59
59
 
60
60
  _this.initRenderingContext(mergedConfig);
@@ -163,6 +163,28 @@ function (_super) {
163
163
  return node.parsedStyle;
164
164
  };
165
165
 
166
+ Object.defineProperty(Canvas.prototype, "ready", {
167
+ get: function get() {
168
+ var _this = this;
169
+
170
+ if (!this.readyPromise) {
171
+ this.readyPromise = new Promise(function (resolve) {
172
+ _this.resolveReadyPromise = function () {
173
+ resolve(_this);
174
+ };
175
+ });
176
+
177
+ if (this.inited) {
178
+ this.resolveReadyPromise();
179
+ }
180
+ }
181
+
182
+ return this.readyPromise;
183
+ },
184
+ enumerable: false,
185
+ configurable: true
186
+ });
187
+
166
188
  Canvas.prototype.destroy = function (destroyScenegraph) {
167
189
  if (destroyScenegraph === void 0) {
168
190
  destroyScenegraph = true;
@@ -276,8 +298,11 @@ function (_super) {
276
298
 
277
299
  if (!renderer) {
278
300
  throw new Error('Renderer is required.');
279
- }
301
+ } // reset
280
302
 
303
+
304
+ this.inited = false;
305
+ this.readyPromise = undefined;
281
306
  this.loadCommonContainerModule();
282
307
  this.loadRendererContainerModule(renderer); // init context
283
308
 
@@ -287,6 +312,12 @@ function (_super) {
287
312
  contextService.init();
288
313
  this.renderingService.init().then(function () {
289
314
  _this.emit(CanvasEvent.READY, {});
315
+
316
+ if (_this.readyPromise) {
317
+ _this.resolveReadyPromise();
318
+ }
319
+
320
+ _this.inited = true;
290
321
  });
291
322
 
292
323
  if (renderer.getConfig().enableAutoRendering) {
@@ -341,6 +372,10 @@ function (_super) {
341
372
  this.initRenderer(renderer);
342
373
  };
343
374
 
375
+ Canvas.prototype.setCursor = function (cursor) {
376
+ this.getContextService().applyCursorStyle(cursor);
377
+ };
378
+
344
379
  Canvas.prototype.unmountChildren = function (parent) {
345
380
  var path = [];
346
381
  parent.forEach(function (child) {
@@ -9,6 +9,7 @@ export interface LineStyleProps extends BaseStyleProps {
9
9
  y2: number;
10
10
  z1?: number;
11
11
  z2?: number;
12
+ isBillboard?: boolean;
12
13
  }
13
14
  export interface ParsedLineStyleProps extends ParsedBaseStyleProps {
14
15
  x1: number;
@@ -19,6 +20,7 @@ export interface ParsedLineStyleProps extends ParsedBaseStyleProps {
19
20
  z2?: number;
20
21
  defX: number;
21
22
  defY: number;
23
+ isBillboard?: boolean;
22
24
  }
23
25
  export declare class Line extends DisplayObject<LineStyleProps, ParsedLineStyleProps> {
24
26
  constructor({ style, ...rest }: DisplayObjectConfig<LineStyleProps>);
@@ -1,6 +1,6 @@
1
1
  import { __assign, __extends, __rest } from "tslib";
2
2
  import { Line as LineUtil } from '@antv/g-math';
3
- import { SHAPE } from '../types';
3
+ import { SHAPE, LINE_CAP, LINE_JOIN } from '../types';
4
4
  import { DisplayObject } from './DisplayObject';
5
5
  import { Point } from '../shapes';
6
6
 
@@ -22,13 +22,10 @@ function (_super) {
22
22
  y2: 0,
23
23
  z1: 0,
24
24
  z2: 0,
25
- lineJoin: "miter"
26
- /* Miter */
27
- ,
28
- lineCap: "butt"
29
- /* Butt */
30
- ,
31
- lineWidth: 1
25
+ lineJoin: LINE_JOIN.Miter,
26
+ lineCap: LINE_CAP.Butt,
27
+ lineWidth: 1,
28
+ isBillboard: false
32
29
  }, style)
33
30
  }, rest)) || this;
34
31
  }
@@ -1,5 +1,5 @@
1
1
  import { __assign, __extends, __rest } from "tslib";
2
- import { SHAPE } from '../types';
2
+ import { SHAPE, LINE_CAP, LINE_JOIN } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
4
  import { Point } from '../shapes';
5
5
  import { Cubic as CubicUtil } from '@antv/g-math';
@@ -18,12 +18,8 @@ function (_super) {
18
18
  type: SHAPE.Path,
19
19
  style: __assign({
20
20
  path: '',
21
- lineJoin: "miter"
22
- /* Miter */
23
- ,
24
- lineCap: "butt"
25
- /* Butt */
26
- ,
21
+ lineJoin: LINE_JOIN.Miter,
22
+ lineCap: LINE_CAP.Butt,
27
23
  lineWidth: 1
28
24
  }, style)
29
25
  }, rest)) || this;
@@ -1,6 +1,6 @@
1
1
  import { __assign, __extends, __rest } from "tslib";
2
2
  import { Line as LineUtil } from '@antv/g-math';
3
- import { SHAPE } from '../types';
3
+ import { SHAPE, LINE_CAP, LINE_JOIN } from '../types';
4
4
  import { DisplayObject } from './DisplayObject';
5
5
  import { Point } from '../shapes';
6
6
 
@@ -17,12 +17,8 @@ function (_super) {
17
17
  type: SHAPE.Polyline,
18
18
  style: __assign({
19
19
  points: [],
20
- lineJoin: "miter"
21
- /* Miter */
22
- ,
23
- lineCap: "butt"
24
- /* Butt */
25
- ,
20
+ lineJoin: LINE_JOIN.Miter,
21
+ lineCap: LINE_CAP.Butt,
26
22
  lineWidth: 1
27
23
  }, style)
28
24
  }, rest)) || this;
@@ -1,5 +1,5 @@
1
1
  import { __assign, __extends, __rest } from "tslib";
2
- import { SHAPE } from '../types';
2
+ import { SHAPE, LINE_JOIN, LINE_CAP } from '../types';
3
3
  import { DisplayObject } from './DisplayObject';
4
4
 
5
5
  var Text =
@@ -31,12 +31,8 @@ function (_super) {
31
31
  fill: '#000',
32
32
  letterSpacing: 0,
33
33
  lineHeight: 0,
34
- lineJoin: "miter"
35
- /* Miter */
36
- ,
37
- lineCap: "butt"
38
- /* Butt */
39
- ,
34
+ lineJoin: LINE_JOIN.Miter,
35
+ lineCap: LINE_CAP.Butt,
40
36
  lineWidth: 0,
41
37
  miterLimit: 10,
42
38
  padding: 0,
@@ -27,7 +27,7 @@ export declare class EventTarget implements IEventTarget {
27
27
  */
28
28
  off(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
29
29
  removeAllEventListeners(): void;
30
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
30
+ removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
31
31
  /**
32
32
  * @deprecated
33
33
  * @alias dispatchEvent
@@ -110,7 +110,7 @@ function () {
110
110
  var capture = isBoolean(options) && options || isObject(options) && options.capture;
111
111
  var context = isFunction(listener) ? undefined : listener;
112
112
  type = capture ? type + "capture" : type;
113
- listener = isFunction(listener) ? listener : listener.handleEvent;
113
+ listener = isFunction(listener) ? listener : listener === null || listener === void 0 ? void 0 : listener.handleEvent;
114
114
  this.emitter.off(type, listener, context);
115
115
  return this;
116
116
  };
@@ -595,11 +595,13 @@ function (_super) {
595
595
  e.eventPhase = e.AT_TARGET;
596
596
  e.currentTarget = e.target;
597
597
  this.notifyTarget(e, type);
598
- if (e.propagationStopped || e.propagationImmediatelyStopped) return; // bubbling phase
598
+ if (e.propagationStopped || e.propagationImmediatelyStopped) return; // find current target in composed path
599
+
600
+ var index = composedPath.indexOf(e.currentTarget); // bubbling phase
599
601
 
600
602
  e.eventPhase = e.BUBBLING_PHASE;
601
603
 
602
- for (var i = 1; i < composedPath.length; i++) {
604
+ for (var i = index + 1; i < composedPath.length; i++) {
603
605
  e.currentTarget = composedPath[i];
604
606
  this.notifyTarget(e, type);
605
607
  if (e.propagationStopped || e.propagationImmediatelyStopped) return;
@@ -144,7 +144,7 @@ function () {
144
144
 
145
145
  var transform = element.transformable;
146
146
 
147
- if (element.parentNode === null) {
147
+ if (element.parentNode === null || !element.parentNode.transformable) {
148
148
  _this.rotateLocal(element, degrees);
149
149
  } else {
150
150
  var rotation = quat.create();
@@ -214,7 +214,7 @@ function () {
214
214
 
215
215
  var transform = element.transformable;
216
216
 
217
- if (element.parentNode === null) {
217
+ if (element.parentNode === null || !element.parentNode.transformable) {
218
218
  _this.setLocalEulerAngles(element, degrees);
219
219
  } else {
220
220
  quat.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
@@ -285,7 +285,7 @@ function () {
285
285
 
286
286
  transform.position = position;
287
287
 
288
- if (element.parentNode === null) {
288
+ if (element.parentNode === null || !element.parentNode.transformable) {
289
289
  vec3.copy(transform.localPosition, position);
290
290
  } else {
291
291
  var parentTransform = element.parentNode.transformable;
@@ -547,7 +547,7 @@ function () {
547
547
  return transform.worldTransform;
548
548
  }
549
549
 
550
- if (element.parentNode) {
550
+ if (element.parentNode && element.parentNode.transformable) {
551
551
  this.getWorldTransform(element.parentNode);
552
552
  }
553
553
 
package/es/types.d.ts CHANGED
@@ -25,12 +25,12 @@ export interface EventPosition {
25
25
  x: number;
26
26
  y: number;
27
27
  }
28
- export declare const enum LINE_CAP {
28
+ export declare enum LINE_CAP {
29
29
  Butt = "butt",
30
30
  Round = "round",
31
31
  Square = "square"
32
32
  }
33
- export declare const enum LINE_JOIN {
33
+ export declare enum LINE_JOIN {
34
34
  Bevel = "bevel",
35
35
  Round = "round",
36
36
  Miter = "miter"
package/es/types.js CHANGED
@@ -14,4 +14,20 @@ export var SHAPE;
14
14
  SHAPE["HTML"] = "html";
15
15
  })(SHAPE || (SHAPE = {}));
16
16
 
17
+ export var LINE_CAP;
18
+
19
+ (function (LINE_CAP) {
20
+ LINE_CAP["Butt"] = "butt";
21
+ LINE_CAP["Round"] = "round";
22
+ LINE_CAP["Square"] = "square";
23
+ })(LINE_CAP || (LINE_CAP = {}));
24
+
25
+ export var LINE_JOIN;
26
+
27
+ (function (LINE_JOIN) {
28
+ LINE_JOIN["Bevel"] = "bevel";
29
+ LINE_JOIN["Round"] = "round";
30
+ LINE_JOIN["Miter"] = "miter";
31
+ })(LINE_JOIN || (LINE_JOIN = {}));
32
+
17
33
  export var CanvasConfig = 'CanvasConfig';
package/lib/Canvas.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { Cursor } from './types';
1
2
  import { CanvasConfig } from './types';
2
3
  import { DisplayObject } from './display-objects/DisplayObject';
3
4
  import { ContextService } from './services';
@@ -5,7 +6,7 @@ import { RenderingService } from './services/RenderingService';
5
6
  import { RenderingContext } from './services/RenderingContext';
6
7
  import { EventService } from './services/EventService';
7
8
  import { Camera } from './camera';
8
- import type { AbstractRenderer } from './AbstractRenderer';
9
+ import type { IRenderer } from './AbstractRenderer';
9
10
  import type { PointLike } from './shapes';
10
11
  import type { IChildNode } from './dom';
11
12
  import { Document, EventTarget } from './dom';
@@ -47,6 +48,9 @@ export declare class Canvas extends EventTarget implements ICanvas {
47
48
  */
48
49
  private eventService;
49
50
  private renderingService;
51
+ private inited;
52
+ private readyPromise;
53
+ private resolveReadyPromise;
50
54
  constructor(config: CanvasConfig);
51
55
  private initRenderingContext;
52
56
  private initDefaultCamera;
@@ -70,6 +74,7 @@ export declare class Canvas extends EventTarget implements ICanvas {
70
74
  rendered: number;
71
75
  };
72
76
  getComputedStyle(node: DisplayObject): any;
77
+ get ready(): Promise<any>;
73
78
  destroy(destroyScenegraph?: boolean): void;
74
79
  /**
75
80
  * compatible with G 3.0
@@ -87,7 +92,8 @@ export declare class Canvas extends EventTarget implements ICanvas {
87
92
  private initRenderer;
88
93
  private loadCommonContainerModule;
89
94
  private loadRendererContainerModule;
90
- setRenderer(renderer: AbstractRenderer): void;
95
+ setRenderer(renderer: IRenderer): void;
96
+ setCursor(cursor: Cursor): void;
91
97
  private unmountChildren;
92
98
  private mountChildren;
93
99
  client2Viewport(client: PointLike): PointLike;
package/lib/Canvas.js CHANGED
@@ -64,7 +64,8 @@ function (_super) {
64
64
 
65
65
 
66
66
  _this.container = _globalModule.globalContainer.createChild();
67
- _this.Element = _DisplayObject.DisplayObject; // create document
67
+ _this.Element = _DisplayObject.DisplayObject;
68
+ _this.inited = false; // create document
68
69
 
69
70
  _this.document = new _dom.Document();
70
71
  _this.document.defaultView = _this; // create registry of custom elements
@@ -74,8 +75,7 @@ function (_super) {
74
75
  var mergedConfig = (0, _tslib.__assign)({
75
76
  width: 300,
76
77
  height: 150,
77
- cursor: 'default',
78
- background: 'white'
78
+ cursor: 'default'
79
79
  }, config);
80
80
 
81
81
  _this.initRenderingContext(mergedConfig);
@@ -184,6 +184,28 @@ function (_super) {
184
184
  return node.parsedStyle;
185
185
  };
186
186
 
187
+ Object.defineProperty(Canvas.prototype, "ready", {
188
+ get: function get() {
189
+ var _this = this;
190
+
191
+ if (!this.readyPromise) {
192
+ this.readyPromise = new Promise(function (resolve) {
193
+ _this.resolveReadyPromise = function () {
194
+ resolve(_this);
195
+ };
196
+ });
197
+
198
+ if (this.inited) {
199
+ this.resolveReadyPromise();
200
+ }
201
+ }
202
+
203
+ return this.readyPromise;
204
+ },
205
+ enumerable: false,
206
+ configurable: true
207
+ });
208
+
187
209
  Canvas.prototype.destroy = function (destroyScenegraph) {
188
210
  if (destroyScenegraph === void 0) {
189
211
  destroyScenegraph = true;
@@ -297,8 +319,11 @@ function (_super) {
297
319
 
298
320
  if (!renderer) {
299
321
  throw new Error('Renderer is required.');
300
- }
322
+ } // reset
301
323
 
324
+
325
+ this.inited = false;
326
+ this.readyPromise = undefined;
302
327
  this.loadCommonContainerModule();
303
328
  this.loadRendererContainerModule(renderer); // init context
304
329
 
@@ -308,6 +333,12 @@ function (_super) {
308
333
  contextService.init();
309
334
  this.renderingService.init().then(function () {
310
335
  _this.emit(CanvasEvent.READY, {});
336
+
337
+ if (_this.readyPromise) {
338
+ _this.resolveReadyPromise();
339
+ }
340
+
341
+ _this.inited = true;
311
342
  });
312
343
 
313
344
  if (renderer.getConfig().enableAutoRendering) {
@@ -362,6 +393,10 @@ function (_super) {
362
393
  this.initRenderer(renderer);
363
394
  };
364
395
 
396
+ Canvas.prototype.setCursor = function (cursor) {
397
+ this.getContextService().applyCursorStyle(cursor);
398
+ };
399
+
365
400
  Canvas.prototype.unmountChildren = function (parent) {
366
401
  var path = [];
367
402
  parent.forEach(function (child) {
@@ -9,6 +9,7 @@ export interface LineStyleProps extends BaseStyleProps {
9
9
  y2: number;
10
10
  z1?: number;
11
11
  z2?: number;
12
+ isBillboard?: boolean;
12
13
  }
13
14
  export interface ParsedLineStyleProps extends ParsedBaseStyleProps {
14
15
  x1: number;
@@ -19,6 +20,7 @@ export interface ParsedLineStyleProps extends ParsedBaseStyleProps {
19
20
  z2?: number;
20
21
  defX: number;
21
22
  defY: number;
23
+ isBillboard?: boolean;
22
24
  }
23
25
  export declare class Line extends DisplayObject<LineStyleProps, ParsedLineStyleProps> {
24
26
  constructor({ style, ...rest }: DisplayObjectConfig<LineStyleProps>);
@@ -32,13 +32,10 @@ function (_super) {
32
32
  y2: 0,
33
33
  z1: 0,
34
34
  z2: 0,
35
- lineJoin: "miter"
36
- /* Miter */
37
- ,
38
- lineCap: "butt"
39
- /* Butt */
40
- ,
41
- lineWidth: 1
35
+ lineJoin: _types.LINE_JOIN.Miter,
36
+ lineCap: _types.LINE_CAP.Butt,
37
+ lineWidth: 1,
38
+ isBillboard: false
42
39
  }, style)
43
40
  }, rest)) || this;
44
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,
@@ -27,7 +27,7 @@ export declare class EventTarget implements IEventTarget {
27
27
  */
28
28
  off(type: string, listener: EventListenerOrEventListenerObject | ((...args: any[]) => void), options?: boolean | AddEventListenerOptions): this;
29
29
  removeAllEventListeners(): void;
30
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
30
+ removeEventListener(type: string, listener?: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;
31
31
  /**
32
32
  * @deprecated
33
33
  * @alias dispatchEvent
@@ -124,7 +124,7 @@ function () {
124
124
  var capture = (0, _util.isBoolean)(options) && options || (0, _util.isObject)(options) && options.capture;
125
125
  var context = (0, _util.isFunction)(listener) ? undefined : listener;
126
126
  type = capture ? type + "capture" : type;
127
- listener = (0, _util.isFunction)(listener) ? listener : listener.handleEvent;
127
+ listener = (0, _util.isFunction)(listener) ? listener : listener === null || listener === void 0 ? void 0 : listener.handleEvent;
128
128
  this.emitter.off(type, listener, context);
129
129
  return this;
130
130
  };
@@ -623,11 +623,13 @@ function (_super) {
623
623
  e.eventPhase = e.AT_TARGET;
624
624
  e.currentTarget = e.target;
625
625
  this.notifyTarget(e, type);
626
- if (e.propagationStopped || e.propagationImmediatelyStopped) return; // bubbling phase
626
+ if (e.propagationStopped || e.propagationImmediatelyStopped) return; // find current target in composed path
627
+
628
+ var index = composedPath.indexOf(e.currentTarget); // bubbling phase
627
629
 
628
630
  e.eventPhase = e.BUBBLING_PHASE;
629
631
 
630
- for (var i = 1; i < composedPath.length; i++) {
632
+ for (var i = index + 1; i < composedPath.length; i++) {
631
633
  e.currentTarget = composedPath[i];
632
634
  this.notifyTarget(e, type);
633
635
  if (e.propagationStopped || e.propagationImmediatelyStopped) return;
@@ -165,7 +165,7 @@ function () {
165
165
 
166
166
  var transform = element.transformable;
167
167
 
168
- if (element.parentNode === null) {
168
+ if (element.parentNode === null || !element.parentNode.transformable) {
169
169
  _this.rotateLocal(element, degrees);
170
170
  } else {
171
171
  var rotation = _glMatrix.quat.create();
@@ -244,7 +244,7 @@ function () {
244
244
 
245
245
  var transform = element.transformable;
246
246
 
247
- if (element.parentNode === null) {
247
+ if (element.parentNode === null || !element.parentNode.transformable) {
248
248
  _this.setLocalEulerAngles(element, degrees);
249
249
  } else {
250
250
  _glMatrix.quat.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
@@ -318,7 +318,7 @@ function () {
318
318
 
319
319
  transform.position = position;
320
320
 
321
- if (element.parentNode === null) {
321
+ if (element.parentNode === null || !element.parentNode.transformable) {
322
322
  _glMatrix.vec3.copy(transform.localPosition, position);
323
323
  } else {
324
324
  var parentTransform = element.parentNode.transformable;
@@ -595,7 +595,7 @@ function () {
595
595
  return transform.worldTransform;
596
596
  }
597
597
 
598
- if (element.parentNode) {
598
+ if (element.parentNode && element.parentNode.transformable) {
599
599
  this.getWorldTransform(element.parentNode);
600
600
  }
601
601
 
package/lib/types.d.ts CHANGED
@@ -25,12 +25,12 @@ export interface EventPosition {
25
25
  x: number;
26
26
  y: number;
27
27
  }
28
- export declare const enum LINE_CAP {
28
+ export declare enum LINE_CAP {
29
29
  Butt = "butt",
30
30
  Round = "round",
31
31
  Square = "square"
32
32
  }
33
- export declare const enum LINE_JOIN {
33
+ export declare enum LINE_JOIN {
34
34
  Bevel = "bevel",
35
35
  Round = "round",
36
36
  Miter = "miter"