@openglobus/og 0.22.1 → 0.23.0

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 (168) hide show
  1. package/css/og.css +137 -1
  2. package/lib/@openglobus/js/Object3d.d.ts +20 -10
  3. package/lib/@openglobus/js/camera/Camera.d.ts +9 -0
  4. package/lib/@openglobus/js/camera/Frustum.d.ts +3 -0
  5. package/lib/@openglobus/js/control/CameraLock.d.ts +38 -0
  6. package/lib/@openglobus/js/control/SimpleNavigation.d.ts +27 -10
  7. package/lib/@openglobus/js/control/geoObjectEditor/ArrowEntity.d.ts +15 -0
  8. package/lib/@openglobus/js/control/geoObjectEditor/AxisTrackEntity.d.ts +9 -0
  9. package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditor.d.ts +13 -0
  10. package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorDialog.d.ts +69 -0
  11. package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +78 -9
  12. package/lib/@openglobus/js/control/geoObjectEditor/MoveAxisEntity.d.ts +17 -0
  13. package/lib/@openglobus/js/control/geoObjectEditor/MovePlaneEntity.d.ts +7 -0
  14. package/lib/@openglobus/js/control/geoObjectEditor/RotateEntity.d.ts +9 -0
  15. package/lib/@openglobus/js/control/geoObjectEditor/colors.d.ts +8 -0
  16. package/lib/@openglobus/js/control/index.d.ts +2 -0
  17. package/lib/@openglobus/js/entity/Entity.d.ts +278 -19
  18. package/lib/@openglobus/js/entity/EntityCollection.d.ts +8 -9
  19. package/lib/@openglobus/js/entity/GeoObject.d.ts +141 -36
  20. package/lib/@openglobus/js/entity/GeoObjectHandler.d.ts +39 -63
  21. package/lib/@openglobus/js/entity/InstanceData.d.ts +76 -0
  22. package/lib/@openglobus/js/entity/Polyline.d.ts +19 -6
  23. package/lib/@openglobus/js/entity/PolylineHandler.d.ts +7 -0
  24. package/lib/@openglobus/js/index.d.ts +2 -1
  25. package/lib/@openglobus/js/layer/Vector.d.ts +4 -0
  26. package/lib/@openglobus/js/light/LightSource.d.ts +1 -139
  27. package/lib/@openglobus/js/math/Quat.d.ts +46 -33
  28. package/lib/@openglobus/js/math/Ray.d.ts +10 -4
  29. package/lib/@openglobus/js/math/Vec3.d.ts +15 -0
  30. package/lib/@openglobus/js/math.d.ts +2 -2
  31. package/lib/@openglobus/js/quadTree/EntityCollectionNode.d.ts +2 -2
  32. package/lib/@openglobus/js/quadTree/Node.d.ts +1 -1
  33. package/lib/@openglobus/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +1 -1
  34. package/lib/@openglobus/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +1 -1
  35. package/lib/@openglobus/js/renderer/Renderer.d.ts +64 -44
  36. package/lib/@openglobus/js/renderer/RendererEvents.d.ts +1 -0
  37. package/lib/@openglobus/js/scene/Planet.d.ts +11 -7
  38. package/lib/@openglobus/js/scene/RenderNode.d.ts +10 -25
  39. package/lib/@openglobus/js/shaders/drawnode.d.ts +1 -0
  40. package/lib/@openglobus/js/shaders/geoObject.d.ts +1 -0
  41. package/lib/@openglobus/js/shaders/utils.d.ts +1 -1
  42. package/lib/@openglobus/js/ui/Checkbox.d.ts +31 -0
  43. package/lib/@openglobus/js/ui/Dialog.d.ts +3 -0
  44. package/lib/@openglobus/js/ui/Input.d.ts +32 -0
  45. package/lib/@openglobus/js/ui/View.d.ts +3 -1
  46. package/lib/@openglobus/js/utils/objParser.d.ts +44 -12
  47. package/lib/@openglobus/js/utils/shared.d.ts +22 -0
  48. package/lib/@openglobus/js/webgl/BaseFramebuffer.d.ts +0 -1
  49. package/lib/@openglobus/js/webgl/Framebuffer.d.ts +35 -8
  50. package/lib/@openglobus/js/webgl/Handler.d.ts +3 -0
  51. package/lib/@openglobus/og.css +1 -1
  52. package/lib/@openglobus/og.esm.js +1 -1
  53. package/lib/@openglobus/og.esm.js.map +1 -1
  54. package/lib/@openglobus/og.umd.js +1 -1
  55. package/lib/@openglobus/og.umd.js.map +1 -1
  56. package/lib/js/Globe.js +2 -1
  57. package/lib/js/Object3d.d.ts +20 -10
  58. package/lib/js/Object3d.js +124 -48
  59. package/lib/js/camera/Camera.d.ts +9 -0
  60. package/lib/js/camera/Camera.js +27 -1
  61. package/lib/js/camera/Frustum.d.ts +3 -0
  62. package/lib/js/camera/Frustum.js +7 -0
  63. package/lib/js/control/Atmosphere.js +10 -6
  64. package/lib/js/control/CameraLock.d.ts +38 -0
  65. package/lib/js/control/CameraLock.js +216 -0
  66. package/lib/js/control/Control.js +1 -1
  67. package/lib/js/control/DebugInfo.js +13 -3
  68. package/lib/js/control/KeyboardNavigation.js +1 -1
  69. package/lib/js/control/ScaleControl.js +9 -3
  70. package/lib/js/control/SimpleNavigation.d.ts +27 -10
  71. package/lib/js/control/SimpleNavigation.js +148 -49
  72. package/lib/js/control/Sun.js +1 -1
  73. package/lib/js/control/elevationProfile/ElevationProfileScene.js +4 -4
  74. package/lib/js/control/geoObjectEditor/ArrowEntity.d.ts +15 -0
  75. package/lib/js/control/geoObjectEditor/ArrowEntity.js +59 -0
  76. package/lib/js/control/geoObjectEditor/AxisTrackEntity.d.ts +9 -0
  77. package/lib/js/control/geoObjectEditor/AxisTrackEntity.js +93 -0
  78. package/lib/js/control/geoObjectEditor/GeoObjectEditor.d.ts +13 -0
  79. package/lib/js/control/geoObjectEditor/GeoObjectEditor.js +30 -0
  80. package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.d.ts +69 -0
  81. package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.js +502 -0
  82. package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +78 -9
  83. package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.js +487 -43
  84. package/lib/js/control/geoObjectEditor/MoveAxisEntity.d.ts +17 -0
  85. package/lib/js/control/geoObjectEditor/MoveAxisEntity.js +106 -0
  86. package/lib/js/control/geoObjectEditor/MovePlaneEntity.d.ts +7 -0
  87. package/lib/js/control/geoObjectEditor/MovePlaneEntity.js +34 -0
  88. package/lib/js/control/geoObjectEditor/RotateEntity.d.ts +9 -0
  89. package/lib/js/control/geoObjectEditor/RotateEntity.js +105 -0
  90. package/lib/js/control/geoObjectEditor/colors.d.ts +8 -0
  91. package/lib/js/control/geoObjectEditor/colors.js +8 -0
  92. package/lib/js/control/index.d.ts +2 -0
  93. package/lib/js/control/index.js +2 -0
  94. package/lib/js/control/timeline/TimelineControl.js +2 -0
  95. package/lib/js/entity/Entity.d.ts +278 -19
  96. package/lib/js/entity/Entity.js +483 -63
  97. package/lib/js/entity/EntityCollection.d.ts +8 -9
  98. package/lib/js/entity/EntityCollection.js +48 -45
  99. package/lib/js/entity/GeoObject.d.ts +141 -36
  100. package/lib/js/entity/GeoObject.js +153 -90
  101. package/lib/js/entity/GeoObjectHandler.d.ts +39 -63
  102. package/lib/js/entity/GeoObjectHandler.js +198 -295
  103. package/lib/js/entity/InstanceData.d.ts +76 -0
  104. package/lib/js/entity/InstanceData.js +344 -0
  105. package/lib/js/entity/Polyline.d.ts +19 -6
  106. package/lib/js/entity/Polyline.js +76 -36
  107. package/lib/js/entity/PolylineHandler.d.ts +7 -0
  108. package/lib/js/entity/PolylineHandler.js +26 -1
  109. package/lib/js/index.d.ts +2 -1
  110. package/lib/js/index.js +2 -1
  111. package/lib/js/layer/Bing.js +2 -2
  112. package/lib/js/layer/Vector.d.ts +4 -0
  113. package/lib/js/layer/Vector.js +16 -0
  114. package/lib/js/light/LightSource.d.ts +1 -139
  115. package/lib/js/light/LightSource.js +21 -227
  116. package/lib/js/math/Quat.d.ts +46 -33
  117. package/lib/js/math/Quat.js +91 -90
  118. package/lib/js/math/Ray.d.ts +10 -4
  119. package/lib/js/math/Ray.js +20 -4
  120. package/lib/js/math/Vec3.d.ts +15 -0
  121. package/lib/js/math/Vec3.js +30 -1
  122. package/lib/js/math.d.ts +2 -2
  123. package/lib/js/math.js +3 -3
  124. package/lib/js/quadTree/EntityCollectionNode.d.ts +2 -2
  125. package/lib/js/quadTree/EntityCollectionNode.js +8 -8
  126. package/lib/js/quadTree/Node.d.ts +1 -1
  127. package/lib/js/quadTree/Node.js +2 -2
  128. package/lib/js/quadTree/QuadTreeStrategy.js +1 -1
  129. package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +1 -1
  130. package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.js +2 -2
  131. package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +1 -1
  132. package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.js +2 -2
  133. package/lib/js/renderer/Renderer.d.ts +64 -44
  134. package/lib/js/renderer/Renderer.js +264 -263
  135. package/lib/js/renderer/RendererEvents.d.ts +1 -0
  136. package/lib/js/renderer/RendererEvents.js +2 -1
  137. package/lib/js/scene/Planet.d.ts +11 -7
  138. package/lib/js/scene/Planet.js +109 -87
  139. package/lib/js/scene/RenderNode.d.ts +10 -25
  140. package/lib/js/scene/RenderNode.js +70 -58
  141. package/lib/js/shaders/depth.js +2 -5
  142. package/lib/js/shaders/drawnode.d.ts +1 -0
  143. package/lib/js/shaders/drawnode.js +51 -52
  144. package/lib/js/shaders/geoObject.d.ts +1 -0
  145. package/lib/js/shaders/geoObject.js +154 -91
  146. package/lib/js/shaders/polyline.js +68 -51
  147. package/lib/js/shaders/utils.d.ts +1 -1
  148. package/lib/js/shaders/utils.js +11 -0
  149. package/lib/js/ui/Checkbox.d.ts +31 -0
  150. package/lib/js/ui/Checkbox.js +110 -0
  151. package/lib/js/ui/Color.js +2 -1
  152. package/lib/js/ui/Dialog.d.ts +3 -0
  153. package/lib/js/ui/Dialog.js +20 -0
  154. package/lib/js/ui/Input.d.ts +32 -0
  155. package/lib/js/ui/Input.js +107 -0
  156. package/lib/js/ui/View.d.ts +3 -1
  157. package/lib/js/ui/View.js +6 -0
  158. package/lib/js/utils/objParser.d.ts +44 -12
  159. package/lib/js/utils/objParser.js +241 -149
  160. package/lib/js/utils/shared.d.ts +22 -0
  161. package/lib/js/utils/shared.js +34 -0
  162. package/lib/js/webgl/BaseFramebuffer.d.ts +0 -1
  163. package/lib/js/webgl/Framebuffer.d.ts +35 -8
  164. package/lib/js/webgl/Framebuffer.js +136 -29
  165. package/lib/js/webgl/Handler.d.ts +3 -0
  166. package/lib/js/webgl/Handler.js +11 -1
  167. package/lib/js/webgl/Program.js +0 -8
  168. package/package.json +4 -2
@@ -0,0 +1,110 @@
1
+ import { View } from './View';
2
+ import { stringTemplate } from '../utils/shared';
3
+ const SLIDER_EVENTS = ["change"];
4
+ const TEMPLATE = `<div class="og-checkbox">
5
+ <div class="og-input-label">{label}</div>
6
+ <div class="og-checkbox-input">
7
+ <input type="checkbox" {checked}/>
8
+ </div>
9
+ </div>`;
10
+ class Checkbox extends View {
11
+ constructor(options = {}) {
12
+ super({
13
+ template: stringTemplate(TEMPLATE, {
14
+ label: options.label || "",
15
+ checked: options.checked ? "checked" : ""
16
+ })
17
+ });
18
+ this._onResize = () => {
19
+ };
20
+ this._onMouseWheel = (e) => {
21
+ //@ts-ignore
22
+ e = e || window.event;
23
+ e.preventDefault();
24
+ e.stopPropagation();
25
+ };
26
+ this._onMouseWheelFF = (e) => {
27
+ this._onMouseWheel(e);
28
+ };
29
+ this._onClick = (e) => {
30
+ //@ts-ignore
31
+ e = e || window.event;
32
+ e.stopPropagation();
33
+ this.checked = !this._checked;
34
+ };
35
+ this._checked = options.checked || false;
36
+ this._disabled = options.disabled || false;
37
+ //@ts-ignore
38
+ this.events = this.events.registerNames(SLIDER_EVENTS);
39
+ this.$label = null;
40
+ this.$input = null;
41
+ }
42
+ set disabled(disabled) {
43
+ this._disabled = disabled;
44
+ this._updateDisabled();
45
+ }
46
+ _updateDisabled() {
47
+ if (!this.el)
48
+ return;
49
+ if (this._disabled) {
50
+ this.el.classList.add("og-input-disabled");
51
+ }
52
+ else {
53
+ this.el.classList.remove("og-input-disabled");
54
+ }
55
+ }
56
+ get disabled() {
57
+ return this._disabled;
58
+ }
59
+ render(params) {
60
+ super.render(params);
61
+ this.$label = this.select(".og-input-label");
62
+ if (this.$label.innerHTML === "") {
63
+ this.$label.style.display = "none";
64
+ }
65
+ this.$input = this.select("input");
66
+ this.$input.checked = this._checked;
67
+ this._updateDisabled();
68
+ this._initEvents();
69
+ return this;
70
+ }
71
+ set checked(isChecked) {
72
+ if (isChecked !== this._checked) {
73
+ this._checked = isChecked;
74
+ if (this.$input) {
75
+ this.$input.checked = this._checked;
76
+ }
77
+ this.events.dispatch(this.events.change, this._checked, this);
78
+ }
79
+ }
80
+ get checked() {
81
+ return this._checked;
82
+ }
83
+ _initEvents() {
84
+ //@ts-ignore
85
+ this.el.addEventListener("mousewheel", this._onMouseWheel);
86
+ this.el.addEventListener("wheel", this._onMouseWheelFF);
87
+ this.$input.addEventListener("click", this._onClick);
88
+ }
89
+ _clearEvents() {
90
+ //@ts-ignore
91
+ this.el.removeEventListener("mousewheel", this._onMouseWheel);
92
+ this.el.removeEventListener("wheel", this._onMouseWheelFF);
93
+ this.$input.removeEventListener("click", this._onClick);
94
+ }
95
+ remove() {
96
+ this._clearEvents();
97
+ super.remove();
98
+ }
99
+ set visibility(visibility) {
100
+ if (this.el) {
101
+ if (visibility) {
102
+ this.el.style.display = "";
103
+ }
104
+ else {
105
+ this.el.style.display = "none";
106
+ }
107
+ }
108
+ }
109
+ }
110
+ export { Checkbox };
@@ -11,7 +11,8 @@ class Color extends View {
11
11
  super({
12
12
  template: stringTemplate(TEMPLATE, {
13
13
  id: `color-${__labelCounter__++}`,
14
- label: options.label || ""
14
+ label: options.label || "",
15
+ value: options.value || "#000000",
15
16
  })
16
17
  });
17
18
  this._onInput = (e) => {
@@ -8,6 +8,7 @@ export interface IDialogParams extends IViewParams {
8
8
  width?: number;
9
9
  height?: number;
10
10
  left?: number;
11
+ right?: number;
11
12
  top?: number;
12
13
  minHeight?: number;
13
14
  maxHeight?: number;
@@ -28,6 +29,7 @@ declare class Dialog<M> extends View<M> {
28
29
  protected _startPosY: number;
29
30
  protected _closeBtn: Button;
30
31
  protected _visibility: boolean;
32
+ protected _right: number | null;
31
33
  constructor(options?: IDialogParams);
32
34
  setContainer(htmlStr: string): void;
33
35
  get container(): HTMLElement | null;
@@ -39,6 +41,7 @@ declare class Dialog<M> extends View<M> {
39
41
  hide(): void;
40
42
  close(): void;
41
43
  setVisibility(visibility: boolean): void;
44
+ getVisibility(): boolean;
42
45
  protected _initButtons(): void;
43
46
  protected _initEvents(): void;
44
47
  protected _onCloseBtnClick: () => void;
@@ -70,6 +70,7 @@ class Dialog extends View {
70
70
  });
71
71
  this.useHide = options.useHide || false;
72
72
  this._visibility = getDefault(options.visible, true);
73
+ this._right = options.right != undefined ? options.right : null;
73
74
  }
74
75
  setContainer(htmlStr) {
75
76
  this.$container.innerHTML = htmlStr;
@@ -95,6 +96,22 @@ class Dialog extends View {
95
96
  this.$buttons = this.select(".og-ddialog-header__buttons");
96
97
  this._initEvents();
97
98
  this._initButtons();
99
+ if (this._right != null) {
100
+ this.el.style.visibility = "hidden";
101
+ const observer = new IntersectionObserver((entries, obs) => {
102
+ entries.forEach(entry => {
103
+ if (entry.isIntersecting) {
104
+ this.el.style.visibility = "visible";
105
+ //@ts-ignore
106
+ if (this.el.parentNode) {
107
+ this.setPosition(this.el.parentNode.clientWidth - this.el.clientWidth - this._right);
108
+ obs.disconnect();
109
+ }
110
+ }
111
+ });
112
+ });
113
+ observer.observe(this.el);
114
+ }
98
115
  return this;
99
116
  }
100
117
  show() {
@@ -128,6 +145,9 @@ class Dialog extends View {
128
145
  this.hide();
129
146
  }
130
147
  }
148
+ getVisibility() {
149
+ return this._visibility;
150
+ }
131
151
  _initButtons() {
132
152
  this._closeBtn.events.on("click", this._onCloseBtnClick);
133
153
  this._closeBtn.appendTo(this.$buttons);
@@ -0,0 +1,32 @@
1
+ import { EventsHandler } from "../Events";
2
+ import { IViewParams, View, ViewEventsList } from './View';
3
+ interface IInputParams extends IViewParams {
4
+ label?: string;
5
+ value?: string;
6
+ min?: number;
7
+ max?: number;
8
+ type?: string;
9
+ maxFixed?: number;
10
+ }
11
+ type InputEventsList = ["change"];
12
+ declare class Input extends View<null> {
13
+ events: EventsHandler<InputEventsList> & EventsHandler<ViewEventsList>;
14
+ protected _value: string;
15
+ protected $label: HTMLElement | null;
16
+ protected $input: HTMLInputElement | null;
17
+ protected _maxFixed: number;
18
+ constructor(options?: IInputParams);
19
+ render(params: any): this;
20
+ protected _onResize: () => void;
21
+ set value(val: string | number);
22
+ protected _setValue(val: string | number): void;
23
+ get value(): string;
24
+ protected _initEvents(): void;
25
+ protected _clearEvents(): void;
26
+ protected _onMouseWheel: (e: WheelEvent) => void;
27
+ protected _onMouseWheelFF: (e: WheelEvent) => void;
28
+ protected _onInput: (e: Event) => void;
29
+ remove(): void;
30
+ set visibility(visibility: boolean);
31
+ }
32
+ export { Input };
@@ -0,0 +1,107 @@
1
+ import { View } from './View';
2
+ import { stringTemplate, toFixedMax } from '../utils/shared';
3
+ const SLIDER_EVENTS = ["change"];
4
+ const TEMPLATE = `<div class="og-input">
5
+ <div class="og-input-label">{label}</div>
6
+ <input type="{type}"/>
7
+ </div>`;
8
+ class Input extends View {
9
+ constructor(options = {}) {
10
+ super({
11
+ template: stringTemplate(TEMPLATE, {
12
+ label: options.label || "",
13
+ type: options.type || "text"
14
+ })
15
+ });
16
+ this._onResize = () => {
17
+ };
18
+ this._onMouseWheel = (e) => {
19
+ //@ts-ignore
20
+ e = e || window.event;
21
+ e.preventDefault();
22
+ e.stopPropagation();
23
+ };
24
+ this._onMouseWheelFF = (e) => {
25
+ this._onMouseWheel(e);
26
+ };
27
+ this._onInput = (e) => {
28
+ //@ts-ignore
29
+ e = e || window.event;
30
+ e.preventDefault();
31
+ e.stopPropagation();
32
+ //@ts-ignore
33
+ this._setValue(e.target.value);
34
+ };
35
+ //@ts-ignore
36
+ this.events = this.events.registerNames(SLIDER_EVENTS);
37
+ this._value = options.value || "";
38
+ this._maxFixed = options.maxFixed != undefined ? options.maxFixed : -1;
39
+ this.$label = null;
40
+ this.$input = null;
41
+ }
42
+ render(params) {
43
+ super.render(params);
44
+ this.$label = this.select(".og-input-label");
45
+ if (this.$label.innerHTML === "") {
46
+ this.$label.style.display = "none";
47
+ }
48
+ this.$input = this.select("input");
49
+ this._initEvents();
50
+ return this;
51
+ }
52
+ set value(val) {
53
+ if (val !== this._value) {
54
+ if (typeof val === "number") {
55
+ this._value = toFixedMax(val, this._maxFixed);
56
+ }
57
+ else {
58
+ this._value = val;
59
+ }
60
+ if (this.$input) {
61
+ this.$input.value = this._value;
62
+ }
63
+ this.events.dispatch(this.events.change, this._value, this);
64
+ }
65
+ }
66
+ _setValue(val) {
67
+ if (val !== this._value) {
68
+ if (typeof val === "number") {
69
+ this._value = toFixedMax(val, this._maxFixed);
70
+ }
71
+ else {
72
+ this._value = val;
73
+ }
74
+ this.events.dispatch(this.events.change, this._value, this);
75
+ }
76
+ }
77
+ get value() {
78
+ return this._value;
79
+ }
80
+ _initEvents() {
81
+ //@ts-ignore
82
+ this.el.addEventListener("mousewheel", this._onMouseWheel);
83
+ this.el.addEventListener("wheel", this._onMouseWheelFF);
84
+ this.$input.addEventListener("input", this._onInput);
85
+ }
86
+ _clearEvents() {
87
+ //@ts-ignore
88
+ this.el.removeEventListener("mousewheel", this._onMouseWheel);
89
+ this.el.removeEventListener("wheel", this._onMouseWheelFF);
90
+ this.$input.removeEventListener("input", this._onInput);
91
+ }
92
+ remove() {
93
+ this._clearEvents();
94
+ super.remove();
95
+ }
96
+ set visibility(visibility) {
97
+ if (this.el) {
98
+ if (visibility) {
99
+ this.el.style.display = "";
100
+ }
101
+ else {
102
+ this.el.style.display = "none";
103
+ }
104
+ }
105
+ }
106
+ }
107
+ export { Input };
@@ -1,4 +1,4 @@
1
- import { EventsHandler } from '../Events';
1
+ import { EventCallback, EventsHandler } from '../Events';
2
2
  export interface IViewParams {
3
3
  model?: any;
4
4
  template?: string;
@@ -16,6 +16,8 @@ declare class View<M> {
16
16
  el: HTMLElement | null;
17
17
  protected _classList: string[];
18
18
  constructor(options?: IViewParams);
19
+ on(name: string, callback: EventCallback, sender?: any, priority?: number): void;
20
+ off(name: string, callback: EventCallback): void;
19
21
  static getHTML(template: string, params: any): string;
20
22
  static parseHTML(htmlStr: string): HTMLElement[];
21
23
  static insertAfter(newNodes: HTMLElement | HTMLElement[], referenceNode: Node): HTMLElement[];
package/lib/js/ui/View.js CHANGED
@@ -11,6 +11,12 @@ class View {
11
11
  this._classList = options.classList || [];
12
12
  this.el = null;
13
13
  }
14
+ on(name, callback, sender, priority) {
15
+ this.events.on(name, callback, sender, priority);
16
+ }
17
+ off(name, callback) {
18
+ this.events.off(name, callback);
19
+ }
14
20
  static getHTML(template, params) {
15
21
  return stringTemplate(template, params);
16
22
  }
@@ -1,24 +1,56 @@
1
- interface IObjGeometryData {
1
+ import { NumberArray3 } from "../math/Vec3";
2
+ export interface IObjGeometryData {
2
3
  vertices: number[];
3
- textures: number[];
4
+ texCoords: number[];
4
5
  normals: number[];
5
6
  }
6
- interface IObjGeometry {
7
+ export interface IObjGeometry {
7
8
  object: string;
8
9
  groups: string[];
9
10
  material: string;
10
11
  data: IObjGeometryData;
11
12
  }
12
- interface IObjData {
13
- geometries: IObjGeometry[];
14
- materialLibs: string[];
13
+ export interface IObjMaterial {
14
+ ambient?: NumberArray3;
15
+ diffuse?: NumberArray3;
16
+ specular?: NumberArray3;
17
+ shininess?: number;
18
+ color?: NumberArray3;
19
+ opacity?: number;
20
+ illum?: number;
21
+ colorTexture?: string;
22
+ normalTexture?: string;
23
+ metallicRoughnessTexture?: string;
15
24
  }
16
- export declare function objParser(text: string): {
25
+ type MaterialMap = Record<string, IObjMaterial>;
26
+ export interface IObj {
17
27
  geometries: IObjGeometry[];
18
- materialLibs: string[];
19
- };
20
- export declare function transformLeftToRightCoordinateSystem(objData: IObjData): {
28
+ materials: MaterialMap;
29
+ }
30
+ export declare class Obj {
31
+ objPositions: number[][];
32
+ objTexcoords: number[][];
33
+ objNormals: number[][];
34
+ objVertexData: [number[][], number[][], number[][]];
35
+ vertexData: [number[], number[], number[]];
36
+ _materialLibs: string[];
21
37
  geometries: IObjGeometry[];
22
- materialLibs: string[];
23
- };
38
+ geometry: IObjGeometry | null;
39
+ materials: MaterialMap;
40
+ material: IObjMaterial;
41
+ object: string;
42
+ groups: string[];
43
+ keywords: Record<string, (parts: string[], unparsedArgs: string) => void>;
44
+ protected _path: string;
45
+ constructor();
46
+ newGeometry(): void;
47
+ setGeometry(): void;
48
+ addVertex(vert: string): void;
49
+ protected _innerParser(text: string, fileName: string): void;
50
+ get data(): IObj;
51
+ load(src: string): Promise<IObj>;
52
+ protected _readAndParse(file: File): Promise<void>;
53
+ readFile(objFile: File, mtlFile?: File): Promise<IObj>;
54
+ protected _cleanupGeometryArrays(): void;
55
+ }
24
56
  export {};