@woosh/meep-engine 2.39.25 → 2.39.27

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.
@@ -69,7 +69,7 @@ async function main(engine) {
69
69
 
70
70
  editor_controls.enable();
71
71
 
72
- const camera_orientation_gizmo = new BlenderCameraOrientationGizmo(new Quaternion());
72
+ const camera_orientation_gizmo = new BlenderCameraOrientationGizmo();
73
73
 
74
74
  camera_orientation_gizmo.css({
75
75
  position: 'absolute',
@@ -6,8 +6,41 @@ interface ISignals extends IViewSignals {
6
6
  readonly axisSelected: Signal<string>
7
7
  }
8
8
 
9
+ interface IDirectionStyle {
10
+ near_fill?: string
11
+ near_stroke_width?: number
12
+ near_stroke_color?: string
13
+
14
+ far_fill?: string
15
+ far_stroke_width?: number
16
+ far_stroke_color?: string
17
+ }
18
+
19
+ interface IOptions {
20
+ size?: number,
21
+ padding?: number,
22
+ bubbleSizePrimary?: number,
23
+ bubbleSizeSecondary?: number,
24
+ lineWidth?: number,
25
+ fontSize?: string,
26
+ fontFamily?: string,
27
+ fontWeight?: string,
28
+ fontColor?: string,
29
+ fontYAdjust?: number,
30
+ selectionFontColor?: string,
31
+ axisStyles?: {
32
+ px?: IDirectionStyle,
33
+ py?: IDirectionStyle,
34
+ pz?: IDirectionStyle,
35
+
36
+ nx?: IDirectionStyle,
37
+ ny?: IDirectionStyle,
38
+ nz?: IDirectionStyle,
39
+ }
40
+ }
41
+
9
42
  export class BlenderCameraOrientationGizmo extends View {
10
- constructor(orientation?: Quaternion)
43
+ constructor(options?: IOptions)
11
44
 
12
45
  on: ISignals
13
46
 
@@ -57,6 +57,30 @@ class DirectionStyle {
57
57
  }
58
58
  }
59
59
 
60
+ function apply_hierarchical_options(source, target) {
61
+ for (const prop_name in source) {
62
+ if (!target.hasOwnProperty(prop_name)) {
63
+ console.warn(`Property '${prop_name}' doesn't exist, valid properties are : ${Object.keys(target)}`);
64
+ continue;
65
+ }
66
+
67
+ const existing_target_value = target[prop_name];
68
+ const source_value = source[prop_name];
69
+
70
+ if (typeof existing_target_value === "object") {
71
+ if (typeof existing_target_value.fromJSON === "function") {
72
+ existing_target_value.fromJSON(source_value);
73
+ } else {
74
+ apply_hierarchical_options(source_value, existing_target_value);
75
+ }
76
+ } else {
77
+ target[prop_name] = source_value;
78
+ }
79
+
80
+
81
+ }
82
+ }
83
+
60
84
 
61
85
  /**
62
86
  * Modelled on https://github.com/jrj2211/three-orientation-gizmo/blob/master/src/OrientationGizmo.js
@@ -64,16 +88,15 @@ class DirectionStyle {
64
88
  export class BlenderCameraOrientationGizmo extends CanvasView {
65
89
  /**
66
90
  *
67
- * @param {Quaternion} quaternion
68
91
  */
69
- constructor(quaternion = null) {
92
+ constructor(options = {}) {
70
93
  super();
71
94
 
72
95
  /**
73
96
  *
74
97
  * @type {Quaternion}
75
98
  */
76
- this.orientation = quaternion;
99
+ this.orientation = null;
77
100
 
78
101
  this.options = {
79
102
  size: 100,
@@ -129,6 +152,9 @@ export class BlenderCameraOrientationGizmo extends CanvasView {
129
152
  }
130
153
  };
131
154
 
155
+ // read options
156
+ apply_hierarchical_options(options, this.options);
157
+
132
158
  // Generate list of axes
133
159
  this.bubbles = [
134
160
  {
@@ -1,4 +1,4 @@
1
- import {Camera, PerspectiveCamera, Scene, WebGLRenderer, WebGLRenderTarget} from "three";
1
+ import {PerspectiveCamera, Scene, WebGLRenderer, WebGLRenderTarget} from "three";
2
2
  import {RenderLayerManager} from "./render/layers/RenderLayerManager";
3
3
  import Vector3 from "../../core/geom/Vector3";
4
4
  import Vector2 from "../../core/geom/Vector2";
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "productName": "Meep",
6
6
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.39.25",
8
+ "version": "2.39.27",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",