@babylonjs/viewer 5.0.0-rc.3 → 5.0.1

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 (192) hide show
  1. package/configuration/configuration.d.ts +107 -107
  2. package/configuration/configuration.js +15 -15
  3. package/configuration/configuration.js.map +1 -1
  4. package/configuration/configurationCompatibility.d.ts +8 -8
  5. package/configuration/configurationCompatibility.js +65 -65
  6. package/configuration/configurationCompatibility.js.map +1 -1
  7. package/configuration/configurationContainer.d.ts +10 -10
  8. package/configuration/configurationContainer.js +9 -9
  9. package/configuration/configurationContainer.js.map +1 -1
  10. package/configuration/globals.d.ts +6 -6
  11. package/configuration/globals.js +17 -17
  12. package/configuration/globals.js.map +1 -1
  13. package/configuration/index.d.ts +2 -2
  14. package/configuration/index.js +3 -2
  15. package/configuration/index.js.map +1 -1
  16. package/configuration/interfaces/cameraConfiguration.d.ts +31 -31
  17. package/configuration/interfaces/cameraConfiguration.js +1 -1
  18. package/configuration/interfaces/cameraConfiguration.js.map +1 -1
  19. package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -81
  20. package/configuration/interfaces/colorGradingConfiguration.js +1 -1
  21. package/configuration/interfaces/colorGradingConfiguration.js.map +1 -1
  22. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -20
  23. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +1 -1
  24. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +1 -1
  25. package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -22
  26. package/configuration/interfaces/environmentMapConfiguration.js +1 -1
  27. package/configuration/interfaces/environmentMapConfiguration.js.map +1 -1
  28. package/configuration/interfaces/groundConfiguration.d.ts +24 -24
  29. package/configuration/interfaces/groundConfiguration.js +1 -1
  30. package/configuration/interfaces/groundConfiguration.js.map +1 -1
  31. package/configuration/interfaces/imageProcessingConfiguration.d.ts +43 -43
  32. package/configuration/interfaces/imageProcessingConfiguration.js +1 -1
  33. package/configuration/interfaces/imageProcessingConfiguration.js.map +1 -1
  34. package/configuration/interfaces/index.d.ts +15 -15
  35. package/configuration/interfaces/index.js +15 -15
  36. package/configuration/interfaces/index.js.map +1 -1
  37. package/configuration/interfaces/lightConfiguration.d.ts +60 -60
  38. package/configuration/interfaces/lightConfiguration.js +1 -1
  39. package/configuration/interfaces/lightConfiguration.js.map +1 -1
  40. package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -26
  41. package/configuration/interfaces/modelAnimationConfiguration.js +1 -1
  42. package/configuration/interfaces/modelAnimationConfiguration.js.map +1 -1
  43. package/configuration/interfaces/modelConfiguration.d.ts +65 -65
  44. package/configuration/interfaces/modelConfiguration.js +1 -1
  45. package/configuration/interfaces/modelConfiguration.js.map +1 -1
  46. package/configuration/interfaces/observersConfiguration.d.ts +5 -5
  47. package/configuration/interfaces/observersConfiguration.js +1 -1
  48. package/configuration/interfaces/observersConfiguration.js.map +1 -1
  49. package/configuration/interfaces/sceneConfiguration.d.ts +48 -48
  50. package/configuration/interfaces/sceneConfiguration.js +1 -1
  51. package/configuration/interfaces/sceneConfiguration.js.map +1 -1
  52. package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -23
  53. package/configuration/interfaces/sceneOptimizerConfiguration.js +1 -1
  54. package/configuration/interfaces/sceneOptimizerConfiguration.js.map +1 -1
  55. package/configuration/interfaces/skyboxConfiguration.d.ts +21 -21
  56. package/configuration/interfaces/skyboxConfiguration.js +1 -1
  57. package/configuration/interfaces/skyboxConfiguration.js.map +1 -1
  58. package/configuration/interfaces/templateConfiguration.d.ts +67 -67
  59. package/configuration/interfaces/templateConfiguration.js +1 -1
  60. package/configuration/interfaces/templateConfiguration.js.map +1 -1
  61. package/configuration/interfaces/vrConfiguration.d.ts +16 -16
  62. package/configuration/interfaces/vrConfiguration.js +1 -1
  63. package/configuration/interfaces/vrConfiguration.js.map +1 -1
  64. package/configuration/loader.d.ts +4 -4
  65. package/configuration/loader.js +16 -28
  66. package/configuration/loader.js.map +1 -1
  67. package/configuration/mappers.d.ts +42 -42
  68. package/configuration/mappers.js +190 -189
  69. package/configuration/mappers.js.map +1 -1
  70. package/configuration/renderOnlyLoader.d.ts +33 -33
  71. package/configuration/renderOnlyLoader.js +161 -158
  72. package/configuration/renderOnlyLoader.js.map +1 -1
  73. package/configuration/types/default.d.ts +6 -6
  74. package/configuration/types/default.js +120 -119
  75. package/configuration/types/default.js.map +1 -1
  76. package/configuration/types/environmentMap.d.ts +5 -5
  77. package/configuration/types/environmentMap.js +13 -13
  78. package/configuration/types/environmentMap.js.map +1 -1
  79. package/configuration/types/extended.d.ts +6 -6
  80. package/configuration/types/extended.js +316 -316
  81. package/configuration/types/extended.js.map +1 -1
  82. package/configuration/types/index.d.ts +13 -13
  83. package/configuration/types/index.js +49 -48
  84. package/configuration/types/index.js.map +1 -1
  85. package/configuration/types/minimal.d.ts +6 -6
  86. package/configuration/types/minimal.js +42 -42
  87. package/configuration/types/minimal.js.map +1 -1
  88. package/configuration/types/renderOnlyDefault.d.ts +30 -30
  89. package/configuration/types/renderOnlyDefault.js +30 -30
  90. package/configuration/types/renderOnlyDefault.js.map +1 -1
  91. package/configuration/types/shadowLight.d.ts +9 -9
  92. package/configuration/types/shadowLight.js +63 -63
  93. package/configuration/types/shadowLight.js.map +1 -1
  94. package/helper/index.d.ts +26 -26
  95. package/helper/index.js +62 -56
  96. package/helper/index.js.map +1 -1
  97. package/index.d.ts +30 -30
  98. package/index.js +45 -41
  99. package/index.js.map +1 -1
  100. package/initializer.d.ts +11 -11
  101. package/initializer.js +34 -33
  102. package/initializer.js.map +1 -1
  103. package/interfaces.d.ts +5 -5
  104. package/interfaces.js +1 -1
  105. package/interfaces.js.map +1 -1
  106. package/labs/environmentSerializer.d.ts +126 -126
  107. package/labs/environmentSerializer.js +190 -186
  108. package/labs/environmentSerializer.js.map +1 -1
  109. package/labs/texture.d.ts +183 -184
  110. package/labs/texture.js +300 -297
  111. package/labs/texture.js.map +1 -1
  112. package/labs/viewerLabs.d.ts +51 -51
  113. package/labs/viewerLabs.js +133 -131
  114. package/labs/viewerLabs.js.map +1 -1
  115. package/license.md +71 -0
  116. package/loader/modelLoader.d.ts +47 -44
  117. package/loader/modelLoader.js +189 -182
  118. package/loader/modelLoader.js.map +1 -1
  119. package/loader/plugins/applyMaterialConfig.d.ts +12 -12
  120. package/loader/plugins/applyMaterialConfig.js +15 -15
  121. package/loader/plugins/applyMaterialConfig.js.map +1 -1
  122. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -9
  123. package/loader/plugins/extendedMaterialLoaderPlugin.js +15 -15
  124. package/loader/plugins/extendedMaterialLoaderPlugin.js.map +1 -1
  125. package/loader/plugins/index.d.ts +18 -17
  126. package/loader/plugins/index.js +42 -41
  127. package/loader/plugins/index.js.map +1 -1
  128. package/loader/plugins/loaderPlugin.d.ts +24 -24
  129. package/loader/plugins/loaderPlugin.js +1 -1
  130. package/loader/plugins/loaderPlugin.js.map +1 -1
  131. package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -12
  132. package/loader/plugins/msftLodLoaderPlugin.js +20 -19
  133. package/loader/plugins/msftLodLoaderPlugin.js.map +1 -1
  134. package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -12
  135. package/loader/plugins/telemetryLoaderPlugin.js +35 -35
  136. package/loader/plugins/telemetryLoaderPlugin.js.map +1 -1
  137. package/managers/observablesManager.d.ts +66 -66
  138. package/managers/observablesManager.js +34 -34
  139. package/managers/observablesManager.js.map +1 -1
  140. package/managers/sceneManager.d.ts +243 -245
  141. package/managers/sceneManager.js +1388 -1387
  142. package/managers/sceneManager.js.map +1 -1
  143. package/managers/telemetryManager.d.ts +57 -57
  144. package/managers/telemetryManager.js +113 -113
  145. package/managers/telemetryManager.js.map +1 -1
  146. package/model/modelAnimation.d.ts +215 -215
  147. package/model/modelAnimation.js +232 -232
  148. package/model/modelAnimation.js.map +1 -1
  149. package/model/viewerModel.d.ts +228 -236
  150. package/model/viewerModel.js +669 -664
  151. package/model/viewerModel.js.map +1 -1
  152. package/optimizer/custom/extended.d.ts +11 -13
  153. package/optimizer/custom/extended.js +98 -100
  154. package/optimizer/custom/extended.js.map +1 -1
  155. package/optimizer/custom/index.d.ts +8 -8
  156. package/optimizer/custom/index.js +24 -24
  157. package/optimizer/custom/index.js.map +1 -1
  158. package/package.json +41 -215
  159. package/readme.md +12 -8
  160. package/renderOnlyIndex.d.ts +11 -11
  161. package/renderOnlyIndex.js +17 -15
  162. package/renderOnlyIndex.js.map +1 -1
  163. package/templating/eventManager.d.ts +35 -35
  164. package/templating/eventManager.js +65 -63
  165. package/templating/eventManager.js.map +1 -1
  166. package/templating/plugins/hdButtonPlugin.d.ts +9 -9
  167. package/templating/plugins/hdButtonPlugin.js +21 -34
  168. package/templating/plugins/hdButtonPlugin.js.map +1 -1
  169. package/templating/plugins/printButton.d.ts +9 -10
  170. package/templating/plugins/printButton.js +40 -53
  171. package/templating/plugins/printButton.js.map +1 -1
  172. package/templating/templateManager.d.ts +190 -189
  173. package/templating/templateManager.js +553 -543
  174. package/templating/templateManager.js.map +1 -1
  175. package/templating/viewerTemplatePlugin.d.ts +21 -21
  176. package/templating/viewerTemplatePlugin.js +68 -68
  177. package/templating/viewerTemplatePlugin.js.map +1 -1
  178. package/viewer/defaultViewer.d.ts +122 -116
  179. package/viewer/defaultViewer.js +665 -670
  180. package/viewer/defaultViewer.js.map +1 -1
  181. package/viewer/renderOnlyViewer.d.ts +8 -8
  182. package/viewer/renderOnlyViewer.js +43 -50
  183. package/viewer/renderOnlyViewer.js.map +1 -1
  184. package/viewer/viewer.d.ts +254 -253
  185. package/viewer/viewer.js +777 -763
  186. package/viewer/viewer.js.map +1 -1
  187. package/viewer/viewerManager.d.ts +55 -55
  188. package/viewer/viewerManager.js +87 -86
  189. package/viewer/viewerManager.js.map +1 -1
  190. package/viewer/viewerWithTemplate.d.ts +9 -9
  191. package/viewer/viewerWithTemplate.js +19 -32
  192. package/viewer/viewerWithTemplate.js.map +1 -1
package/package.json CHANGED
@@ -1,229 +1,55 @@
1
1
  {
2
- "author": {
3
- "name": "Raanan Weber"
4
- },
5
2
  "name": "@babylonjs/viewer",
6
- "description": "A simple-to-use viewer based on BabylonJS to display 3D elements natively",
7
- "version": "5.0.0-rc.3",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/BabylonJS/Babylon.js.git"
11
- },
3
+ "version": "5.0.1",
12
4
  "main": "index.js",
5
+ "module": "index.js",
6
+ "types": "index.d.ts",
13
7
  "files": [
14
- "configuration/configuration.d.ts",
15
- "configuration/configuration.js",
16
- "configuration/configuration.js.map",
17
- "configuration/configurationCompatibility.d.ts",
18
- "configuration/configurationCompatibility.js",
19
- "configuration/configurationCompatibility.js.map",
20
- "configuration/configurationContainer.d.ts",
21
- "configuration/configurationContainer.js",
22
- "configuration/configurationContainer.js.map",
23
- "configuration/globals.d.ts",
24
- "configuration/globals.js",
25
- "configuration/globals.js.map",
26
- "configuration/index.d.ts",
27
- "configuration/index.js",
28
- "configuration/index.js.map",
29
- "configuration/interfaces/cameraConfiguration.d.ts",
30
- "configuration/interfaces/cameraConfiguration.js",
31
- "configuration/interfaces/cameraConfiguration.js.map",
32
- "configuration/interfaces/colorGradingConfiguration.d.ts",
33
- "configuration/interfaces/colorGradingConfiguration.js",
34
- "configuration/interfaces/colorGradingConfiguration.js.map",
35
- "configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts",
36
- "configuration/interfaces/defaultRenderingPipelineConfiguration.js",
37
- "configuration/interfaces/defaultRenderingPipelineConfiguration.js.map",
38
- "configuration/interfaces/environmentMapConfiguration.d.ts",
39
- "configuration/interfaces/environmentMapConfiguration.js",
40
- "configuration/interfaces/environmentMapConfiguration.js.map",
41
- "configuration/interfaces/groundConfiguration.d.ts",
42
- "configuration/interfaces/groundConfiguration.js",
43
- "configuration/interfaces/groundConfiguration.js.map",
44
- "configuration/interfaces/imageProcessingConfiguration.d.ts",
45
- "configuration/interfaces/imageProcessingConfiguration.js",
46
- "configuration/interfaces/imageProcessingConfiguration.js.map",
47
- "configuration/interfaces/index.d.ts",
48
- "configuration/interfaces/index.js",
49
- "configuration/interfaces/index.js.map",
50
- "configuration/interfaces/lightConfiguration.d.ts",
51
- "configuration/interfaces/lightConfiguration.js",
52
- "configuration/interfaces/lightConfiguration.js.map",
53
- "configuration/interfaces/modelAnimationConfiguration.d.ts",
54
- "configuration/interfaces/modelAnimationConfiguration.js",
55
- "configuration/interfaces/modelAnimationConfiguration.js.map",
56
- "configuration/interfaces/modelConfiguration.d.ts",
57
- "configuration/interfaces/modelConfiguration.js",
58
- "configuration/interfaces/modelConfiguration.js.map",
59
- "configuration/interfaces/observersConfiguration.d.ts",
60
- "configuration/interfaces/observersConfiguration.js",
61
- "configuration/interfaces/observersConfiguration.js.map",
62
- "configuration/interfaces/sceneConfiguration.d.ts",
63
- "configuration/interfaces/sceneConfiguration.js",
64
- "configuration/interfaces/sceneConfiguration.js.map",
65
- "configuration/interfaces/sceneOptimizerConfiguration.d.ts",
66
- "configuration/interfaces/sceneOptimizerConfiguration.js",
67
- "configuration/interfaces/sceneOptimizerConfiguration.js.map",
68
- "configuration/interfaces/skyboxConfiguration.d.ts",
69
- "configuration/interfaces/skyboxConfiguration.js",
70
- "configuration/interfaces/skyboxConfiguration.js.map",
71
- "configuration/interfaces/templateConfiguration.d.ts",
72
- "configuration/interfaces/templateConfiguration.js",
73
- "configuration/interfaces/templateConfiguration.js.map",
74
- "configuration/interfaces/vrConfiguration.d.ts",
75
- "configuration/interfaces/vrConfiguration.js",
76
- "configuration/interfaces/vrConfiguration.js.map",
77
- "configuration/loader.d.ts",
78
- "configuration/loader.js",
79
- "configuration/loader.js.map",
80
- "configuration/mappers.d.ts",
81
- "configuration/mappers.js",
82
- "configuration/mappers.js.map",
83
- "configuration/renderOnlyLoader.d.ts",
84
- "configuration/renderOnlyLoader.js",
85
- "configuration/renderOnlyLoader.js.map",
86
- "configuration/types/default.d.ts",
87
- "configuration/types/default.js",
88
- "configuration/types/default.js.map",
89
- "configuration/types/environmentMap.d.ts",
90
- "configuration/types/environmentMap.js",
91
- "configuration/types/environmentMap.js.map",
92
- "configuration/types/extended.d.ts",
93
- "configuration/types/extended.js",
94
- "configuration/types/extended.js.map",
95
- "configuration/types/index.d.ts",
96
- "configuration/types/index.js",
97
- "configuration/types/index.js.map",
98
- "configuration/types/minimal.d.ts",
99
- "configuration/types/minimal.js",
100
- "configuration/types/minimal.js.map",
101
- "configuration/types/renderOnlyDefault.d.ts",
102
- "configuration/types/renderOnlyDefault.js",
103
- "configuration/types/renderOnlyDefault.js.map",
104
- "configuration/types/shadowLight.d.ts",
105
- "configuration/types/shadowLight.js",
106
- "configuration/types/shadowLight.js.map",
107
- "helper/index.d.ts",
108
- "helper/index.js",
109
- "helper/index.js.map",
110
- "index.d.ts",
111
- "index.js",
112
- "index.js.map",
113
- "initializer.d.ts",
114
- "initializer.js",
115
- "initializer.js.map",
116
- "interfaces.d.ts",
117
- "interfaces.js",
118
- "interfaces.js.map",
119
- "labs/environmentSerializer.d.ts",
120
- "labs/environmentSerializer.js",
121
- "labs/environmentSerializer.js.map",
122
- "labs/texture.d.ts",
123
- "labs/texture.js",
124
- "labs/texture.js.map",
125
- "labs/viewerLabs.d.ts",
126
- "labs/viewerLabs.js",
127
- "labs/viewerLabs.js.map",
128
- "loader/modelLoader.d.ts",
129
- "loader/modelLoader.js",
130
- "loader/modelLoader.js.map",
131
- "loader/plugins/applyMaterialConfig.d.ts",
132
- "loader/plugins/applyMaterialConfig.js",
133
- "loader/plugins/applyMaterialConfig.js.map",
134
- "loader/plugins/extendedMaterialLoaderPlugin.d.ts",
135
- "loader/plugins/extendedMaterialLoaderPlugin.js",
136
- "loader/plugins/extendedMaterialLoaderPlugin.js.map",
137
- "loader/plugins/index.d.ts",
138
- "loader/plugins/index.js",
139
- "loader/plugins/index.js.map",
140
- "loader/plugins/loaderPlugin.d.ts",
141
- "loader/plugins/loaderPlugin.js",
142
- "loader/plugins/loaderPlugin.js.map",
143
- "loader/plugins/msftLodLoaderPlugin.d.ts",
144
- "loader/plugins/msftLodLoaderPlugin.js",
145
- "loader/plugins/msftLodLoaderPlugin.js.map",
146
- "loader/plugins/telemetryLoaderPlugin.d.ts",
147
- "loader/plugins/telemetryLoaderPlugin.js",
148
- "loader/plugins/telemetryLoaderPlugin.js.map",
149
- "managers/observablesManager.d.ts",
150
- "managers/observablesManager.js",
151
- "managers/observablesManager.js.map",
152
- "managers/sceneManager.d.ts",
153
- "managers/sceneManager.js",
154
- "managers/sceneManager.js.map",
155
- "managers/telemetryManager.d.ts",
156
- "managers/telemetryManager.js",
157
- "managers/telemetryManager.js.map",
158
- "model/modelAnimation.d.ts",
159
- "model/modelAnimation.js",
160
- "model/modelAnimation.js.map",
161
- "model/viewerModel.d.ts",
162
- "model/viewerModel.js",
163
- "model/viewerModel.js.map",
164
- "optimizer/custom/extended.d.ts",
165
- "optimizer/custom/extended.js",
166
- "optimizer/custom/extended.js.map",
167
- "optimizer/custom/index.d.ts",
168
- "optimizer/custom/index.js",
169
- "optimizer/custom/index.js.map",
8
+ "**/*.js",
9
+ "**/*.d.ts",
10
+ "**/*.map",
170
11
  "readme.md",
171
- "renderOnlyIndex.d.ts",
172
- "renderOnlyIndex.js",
173
- "renderOnlyIndex.js.map",
174
- "templating/eventManager.d.ts",
175
- "templating/eventManager.js",
176
- "templating/eventManager.js.map",
177
- "templating/plugins/hdButtonPlugin.d.ts",
178
- "templating/plugins/hdButtonPlugin.js",
179
- "templating/plugins/hdButtonPlugin.js.map",
180
- "templating/plugins/printButton.d.ts",
181
- "templating/plugins/printButton.js",
182
- "templating/plugins/printButton.js.map",
183
- "templating/templateManager.d.ts",
184
- "templating/templateManager.js",
185
- "templating/templateManager.js.map",
186
- "templating/viewerTemplatePlugin.d.ts",
187
- "templating/viewerTemplatePlugin.js",
188
- "templating/viewerTemplatePlugin.js.map",
189
- "viewer/defaultViewer.d.ts",
190
- "viewer/defaultViewer.js",
191
- "viewer/defaultViewer.js.map",
192
- "viewer/renderOnlyViewer.d.ts",
193
- "viewer/renderOnlyViewer.js",
194
- "viewer/renderOnlyViewer.js.map",
195
- "viewer/viewer.d.ts",
196
- "viewer/viewer.js",
197
- "viewer/viewer.js.map",
198
- "viewer/viewerManager.d.ts",
199
- "viewer/viewerManager.js",
200
- "viewer/viewerManager.js.map",
201
- "viewer/viewerWithTemplate.d.ts",
202
- "viewer/viewerWithTemplate.js",
203
- "viewer/viewerWithTemplate.js.map"
12
+ "license.md"
204
13
  ],
205
- "typings": "index.d.ts",
14
+ "scripts": {
15
+ "build": "npm run clean && npm run compile",
16
+ "clean": "rimraf dist && rimraf *.tsbuildinfo && rimraf \"./**/*.!(md|json|build.json)\"",
17
+ "compile": "tsc -b tsconfig.build.json --verbose",
18
+ "postcompile": "build-tools -c add-js-to-es6",
19
+ "prepublishOnly": "build-tools -c prepare-es6-build"
20
+ },
21
+ "dependencies": {
22
+ "@babylonjs/core": "^5.0.1",
23
+ "@babylonjs/loaders": "^5.0.1",
24
+ "babylonjs-gltf2interface": "^5.0.1",
25
+ "babylonjs-viewer-assets": "^5.0.1",
26
+ "deepmerge": "~4.2.2",
27
+ "handlebars": "~4.7.7",
28
+ "pepjs": "~0.4.3",
29
+ "tslib": "^2.3.1"
30
+ },
31
+ "devDependencies": {
32
+ "@dev/build-tools": "^1.0.0",
33
+ "rimraf": "^3.0.2",
34
+ "typescript": "^4.4.4"
35
+ },
206
36
  "keywords": [
207
37
  "3D",
208
38
  "javascript",
209
39
  "html5",
210
40
  "webgl",
211
- "viewer"
41
+ "babylon.js"
212
42
  ],
213
43
  "license": "Apache-2.0",
214
- "engines": {
215
- "node": "*"
216
- },
217
- "dependencies": {
218
- "deepmerge": "~2.1.1",
219
- "handlebars": "~4.7.7",
220
- "pepjs": "~0.4.3",
221
- "@babylonjs/core": "5.0.0-rc.3",
222
- "@babylonjs/loaders": "5.0.0-rc.3",
223
- "babylonjs-gltf2interface": "5.0.0-rc.3",
224
- "babylonjs-viewer-assets": "5.0.0-rc.3",
225
- "tslib": "^2.3.1"
44
+ "esnext": "index.js",
45
+ "type": "module",
46
+ "sideEffects": true,
47
+ "homepage": "https://www.babylonjs.com",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/BabylonJS/Babylon.js.git"
226
51
  },
227
- "module": "index.js",
228
- "esnext": "index.js"
229
- }
52
+ "bugs": {
53
+ "url": "https://github.com/BabylonJS/Babylon.js/issues"
54
+ }
55
+ }
package/readme.md CHANGED
@@ -6,31 +6,35 @@ Online docs: https://doc.babylonjs.com/extensions/the_babylon_viewer
6
6
  ## ES6/NPM usage
7
7
 
8
8
  Install the package using npm:
9
- ```
9
+
10
+ ```bash
10
11
  npm install @babylonjs/viewer --save
11
12
  ```
12
13
 
13
14
  Then in JS/Typescript the viewer to be imported via:
14
- ```
15
+
16
+ ```bash
15
17
  import * as BabylonViewer from '@babylonjs/viewer';
16
18
  ```
17
19
 
18
- Add a babylon element in an html file:
19
- ```
20
+ Add a babylon element in a html file:
21
+
22
+ ```html
20
23
  <babylon id="babylon-viewer" camera.behaviors.auto-rotate="0"></babylon>
21
24
  ```
22
25
 
23
26
  And used to load models
24
- ```
25
- BabylonViewer.viewerManager.getViewerPromiseById('babylon-viewer').then(function (viewer) {
27
+
28
+ ```javascript
29
+ BabylonViewer.viewerManager.getViewerPromiseById("babylon-viewer").then(function (viewer) {
26
30
  // this will resolve only after the viewer with this specific ID is initialized
27
31
  viewer.onEngineInitObservable.add(function (scene) {
28
32
  viewer.loadModel({
29
33
  title: "Helmet",
30
34
  subtitle: "BabylonJS",
31
35
  thumbnail: "https://www.babylonjs.com/img/favicon/apple-icon-144x144.png",
32
- url: "https://www.babylonjs.com/Assets/DamagedHelmet/glTF/DamagedHelmet.gltf"
36
+ url: "https://www.babylonjs.com/Assets/DamagedHelmet/glTF/DamagedHelmet.gltf",
33
37
  });
34
38
  });
35
39
  });
36
- ```
40
+ ```
@@ -1,11 +1,11 @@
1
- import { RenderOnlyViewer } from './viewer/renderOnlyViewer';
2
- import '@babylonjs/loaders/glTF/2.0';
3
- import "@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent";
4
- import "@babylonjs/core/Debug/debugLayer";
5
- import "@babylonjs/core/Meshes/Builders/planeBuilder";
6
- import "@babylonjs/core/Meshes/Builders/boxBuilder";
7
- import "@babylonjs/core/Materials/Textures/Loaders/ddsTextureLoader";
8
- import "@babylonjs/core/Materials/Textures/Loaders/envTextureLoader";
9
- import "@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader";
10
- import "@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent";
11
- export { RenderOnlyViewer };
1
+ import { RenderOnlyViewer } from "./viewer/renderOnlyViewer";
2
+ import "@babylonjs/loaders/glTF/2.0.js";
3
+ import "@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent.js";
4
+ import "@babylonjs/core/Debug/debugLayer.js";
5
+ import "@babylonjs/core/Meshes/Builders/planeBuilder.js";
6
+ import "@babylonjs/core/Meshes/Builders/boxBuilder.js";
7
+ import "@babylonjs/core/Materials/Textures/Loaders/ddsTextureLoader.js";
8
+ import "@babylonjs/core/Materials/Textures/Loaders/envTextureLoader.js";
9
+ import "@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader.js";
10
+ import "@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.js";
11
+ export { RenderOnlyViewer };
@@ -1,16 +1,18 @@
1
- import { RenderOnlyViewer } from './viewer/renderOnlyViewer.js';
2
- // Required side effects
3
- import '@babylonjs/loaders/glTF/2.0.js';
4
- import "@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent.js";
5
- import "@babylonjs/core/Debug/debugLayer.js";
6
- import "@babylonjs/core/Meshes/Builders/planeBuilder.js";
7
- import "@babylonjs/core/Meshes/Builders/boxBuilder.js";
8
- import "@babylonjs/core/Materials/Textures/Loaders/ddsTextureLoader.js";
9
- import "@babylonjs/core/Materials/Textures/Loaders/envTextureLoader.js";
10
- import "@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader.js";
11
- import "@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.js";
12
- // Override default material factory to avoid the dependency on standard material
13
- import { Scene } from '@babylonjs/core/scene.js';
14
- Scene.DefaultMaterialFactory = function (scene) { return null; };
15
- export { RenderOnlyViewer };
1
+ import { RenderOnlyViewer } from "./viewer/renderOnlyViewer.js";
2
+ // Required side effects
3
+ import "@babylonjs/loaders/glTF/2.0.js";
4
+ import "@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent.js";
5
+ import "@babylonjs/core/Debug/debugLayer.js";
6
+ import "@babylonjs/core/Meshes/Builders/planeBuilder.js";
7
+ import "@babylonjs/core/Meshes/Builders/boxBuilder.js";
8
+ import "@babylonjs/core/Materials/Textures/Loaders/ddsTextureLoader.js";
9
+ import "@babylonjs/core/Materials/Textures/Loaders/envTextureLoader.js";
10
+ import "@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader.js";
11
+ import "@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent.js";
12
+ // Override default material factory to avoid the dependency on standard material
13
+ import { Scene } from "@babylonjs/core/scene.js";
14
+ Scene.DefaultMaterialFactory = function () {
15
+ return null;
16
+ };
17
+ export { RenderOnlyViewer };
16
18
  //# sourceMappingURL=renderOnlyIndex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderOnlyIndex.js","sourceRoot":"","sources":["../../../sourceES6/viewer/src/renderOnlyIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,wBAAwB;AACxB,OAAO,6BAA6B,CAAC;AACrC,OAAO,8DAA8D,CAAA;AACrE,OAAO,kCAAkC,CAAC;AAC1C,OAAO,8CAA8C,CAAC;AACtD,OAAO,4CAA4C,CAAC;AACpD,OAAO,6DAA6D,CAAA;AACpE,OAAO,6DAA6D,CAAA;AACpE,OAAO,6DAA6D,CAAA;AACpE,OAAO,6FAA6F,CAAC;AAErG,iFAAiF;AACjF,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,KAAK,CAAC,sBAAsB,GAAG,UAAC,KAAY,IAAO,OAAO,IAAW,CAAA,CAAC,CAAC,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { RenderOnlyViewer } from './viewer/renderOnlyViewer';\r\n\r\n// Required side effects\r\nimport '@babylonjs/loaders/glTF/2.0';\r\nimport \"@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent\"\r\nimport \"@babylonjs/core/Debug/debugLayer\";\r\nimport \"@babylonjs/core/Meshes/Builders/planeBuilder\";\r\nimport \"@babylonjs/core/Meshes/Builders/boxBuilder\";\r\nimport \"@babylonjs/core/Materials/Textures/Loaders/ddsTextureLoader\"\r\nimport \"@babylonjs/core/Materials/Textures/Loaders/envTextureLoader\"\r\nimport \"@babylonjs/core/Materials/Textures/Loaders/ktxTextureLoader\"\r\nimport \"@babylonjs/core/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent\";\r\n\r\n// Override default material factory to avoid the dependency on standard material\r\nimport { Scene } from '@babylonjs/core/scene';\r\nScene.DefaultMaterialFactory = (scene: Scene) => { return null as any };\r\n\r\nexport { RenderOnlyViewer };\r\n"]}
1
+ {"version":3,"file":"renderOnlyIndex.js","sourceRoot":"","sources":["../../../../tools/viewer/src/renderOnlyIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,wBAAwB;AACxB,wCAA0B;AAC1B,yEAA2D;AAC3D,6CAA+B;AAC/B,yDAA2C;AAC3C,uDAAyC;AACzC,wEAA0D;AAC1D,wEAA0D;AAC1D,wEAA0D;AAC1D,wGAA0F;AAE1F,iFAAiF;AACjF,OAAO,EAAE,KAAK,EAAE,iCAAmB;AACnC,KAAK,CAAC,sBAAsB,GAAG;IAC3B,OAAO,IAAW,CAAC;AACvB,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { RenderOnlyViewer } from \"./viewer/renderOnlyViewer\";\r\n\r\n// Required side effects\r\nimport \"loaders/glTF/2.0\";\r\nimport \"core/Lights/Shadows/shadowGeneratorSceneComponent\";\r\nimport \"core/Debug/debugLayer\";\r\nimport \"core/Meshes/Builders/planeBuilder\";\r\nimport \"core/Meshes/Builders/boxBuilder\";\r\nimport \"core/Materials/Textures/Loaders/ddsTextureLoader\";\r\nimport \"core/Materials/Textures/Loaders/envTextureLoader\";\r\nimport \"core/Materials/Textures/Loaders/ktxTextureLoader\";\r\nimport \"core/PostProcesses/RenderPipeline/postProcessRenderPipelineManagerSceneComponent\";\r\n\r\n// Override default material factory to avoid the dependency on standard material\r\nimport { Scene } from \"core/scene\";\r\nScene.DefaultMaterialFactory = () => {\r\n return null as any;\r\n};\r\n\r\nexport { RenderOnlyViewer };\r\n"]}
@@ -1,35 +1,35 @@
1
- import { EventCallback, TemplateManager } from "./templateManager";
2
- /**
3
- * The EventManager is in charge of registering user interctions with the viewer.
4
- * It is used in the TemplateManager
5
- */
6
- export declare class EventManager {
7
- private _templateManager;
8
- private _callbacksContainer;
9
- constructor(_templateManager: TemplateManager);
10
- /**
11
- * Register a new callback to a specific template.
12
- * The best example for the usage can be found in the DefaultViewer
13
- *
14
- * @param templateName the templateName to register the event to
15
- * @param callback The callback to be executed
16
- * @param eventType the type of event to register
17
- * @param selector an optional selector. if not defined the parent object in the template will be selected
18
- */
19
- registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
20
- /**
21
- * This will remove a registered event from the defined template.
22
- * Each one of the variables apart from the template name are optional, but one must be provided.
23
- *
24
- * @param templateName the templateName
25
- * @param callback the callback to remove (optional)
26
- * @param eventType the event type to remove (optional)
27
- * @param selector the selector from which to remove the event (optional)
28
- */
29
- unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
30
- private _eventTriggered;
31
- /**
32
- * Dispose the event manager
33
- */
34
- dispose(): void;
35
- }
1
+ import type { EventCallback, TemplateManager } from "./templateManager";
2
+ /**
3
+ * The EventManager is in charge of registering user interctions with the viewer.
4
+ * It is used in the TemplateManager
5
+ */
6
+ export declare class EventManager {
7
+ private _templateManager;
8
+ private _callbacksContainer;
9
+ constructor(_templateManager: TemplateManager);
10
+ /**
11
+ * Register a new callback to a specific template.
12
+ * The best example for the usage can be found in the DefaultViewer
13
+ *
14
+ * @param templateName the templateName to register the event to
15
+ * @param callback The callback to be executed
16
+ * @param eventType the type of event to register
17
+ * @param selector an optional selector. if not defined the parent object in the template will be selected
18
+ */
19
+ registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
20
+ /**
21
+ * This will remove a registered event from the defined template.
22
+ * Each one of the variables apart from the template name are optional, but one must be provided.
23
+ *
24
+ * @param templateName the templateName
25
+ * @param callback the callback to remove (optional)
26
+ * @param eventType the event type to remove (optional)
27
+ * @param selector the selector from which to remove the event (optional)
28
+ */
29
+ unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string): void;
30
+ private _eventTriggered;
31
+ /**
32
+ * Dispose the event manager
33
+ */
34
+ dispose(): void;
35
+ }
@@ -1,64 +1,66 @@
1
- /**
2
- * The EventManager is in charge of registering user interctions with the viewer.
3
- * It is used in the TemplateManager
4
- */
5
- var EventManager = /** @class */ (function () {
6
- function EventManager(_templateManager) {
7
- var _this = this;
8
- this._templateManager = _templateManager;
9
- this._callbacksContainer = {};
10
- this._templateManager.onEventTriggered.add(function (eventData) {
11
- _this._eventTriggered(eventData);
12
- });
13
- }
14
- /**
15
- * Register a new callback to a specific template.
16
- * The best example for the usage can be found in the DefaultViewer
17
- *
18
- * @param templateName the templateName to register the event to
19
- * @param callback The callback to be executed
20
- * @param eventType the type of event to register
21
- * @param selector an optional selector. if not defined the parent object in the template will be selected
22
- */
23
- EventManager.prototype.registerCallback = function (templateName, callback, eventType, selector) {
24
- if (!this._callbacksContainer[templateName]) {
25
- this._callbacksContainer[templateName] = [];
26
- }
27
- this._callbacksContainer[templateName].push({
28
- eventType: eventType,
29
- callback: callback,
30
- selector: selector
31
- });
32
- };
33
- /**
34
- * This will remove a registered event from the defined template.
35
- * Each one of the variables apart from the template name are optional, but one must be provided.
36
- *
37
- * @param templateName the templateName
38
- * @param callback the callback to remove (optional)
39
- * @param eventType the event type to remove (optional)
40
- * @param selector the selector from which to remove the event (optional)
41
- */
42
- EventManager.prototype.unregisterCallback = function (templateName, callback, eventType, selector) {
43
- var callbackDefs = this._callbacksContainer[templateName] || [];
44
- this._callbacksContainer[templateName] = callbackDefs.filter(function (callbackDef) { return (!callbackDef.eventType || callbackDef.eventType === eventType) && (!callbackDef.selector || callbackDef.selector === selector); });
45
- };
46
- EventManager.prototype._eventTriggered = function (data) {
47
- var templateName = data.template.name;
48
- var eventType = data.event.type;
49
- var selector = data.selector;
50
- var callbackDefs = this._callbacksContainer[templateName] || [];
51
- callbackDefs.filter(function (callbackDef) { return (!callbackDef.eventType || callbackDef.eventType === eventType) && (!callbackDef.selector || callbackDef.selector === selector); }).forEach(function (callbackDef) {
52
- callbackDef.callback(data);
53
- });
54
- };
55
- /**
56
- * Dispose the event manager
57
- */
58
- EventManager.prototype.dispose = function () {
59
- this._callbacksContainer = {};
60
- };
61
- return EventManager;
62
- }());
63
- export { EventManager };
1
+ /**
2
+ * The EventManager is in charge of registering user interctions with the viewer.
3
+ * It is used in the TemplateManager
4
+ */
5
+ var EventManager = /** @class */ (function () {
6
+ function EventManager(_templateManager) {
7
+ var _this = this;
8
+ this._templateManager = _templateManager;
9
+ this._callbacksContainer = {};
10
+ this._templateManager.onEventTriggered.add(function (eventData) {
11
+ _this._eventTriggered(eventData);
12
+ });
13
+ }
14
+ /**
15
+ * Register a new callback to a specific template.
16
+ * The best example for the usage can be found in the DefaultViewer
17
+ *
18
+ * @param templateName the templateName to register the event to
19
+ * @param callback The callback to be executed
20
+ * @param eventType the type of event to register
21
+ * @param selector an optional selector. if not defined the parent object in the template will be selected
22
+ */
23
+ EventManager.prototype.registerCallback = function (templateName, callback, eventType, selector) {
24
+ if (!this._callbacksContainer[templateName]) {
25
+ this._callbacksContainer[templateName] = [];
26
+ }
27
+ this._callbacksContainer[templateName].push({
28
+ eventType: eventType,
29
+ callback: callback,
30
+ selector: selector,
31
+ });
32
+ };
33
+ /**
34
+ * This will remove a registered event from the defined template.
35
+ * Each one of the variables apart from the template name are optional, but one must be provided.
36
+ *
37
+ * @param templateName the templateName
38
+ * @param callback the callback to remove (optional)
39
+ * @param eventType the event type to remove (optional)
40
+ * @param selector the selector from which to remove the event (optional)
41
+ */
42
+ EventManager.prototype.unregisterCallback = function (templateName, callback, eventType, selector) {
43
+ var callbackDefs = this._callbacksContainer[templateName] || [];
44
+ this._callbacksContainer[templateName] = callbackDefs.filter(function (callbackDef) { return (!callbackDef.eventType || callbackDef.eventType === eventType) && (!callbackDef.selector || callbackDef.selector === selector); });
45
+ };
46
+ EventManager.prototype._eventTriggered = function (data) {
47
+ var templateName = data.template.name;
48
+ var eventType = data.event.type;
49
+ var selector = data.selector;
50
+ var callbackDefs = this._callbacksContainer[templateName] || [];
51
+ callbackDefs
52
+ .filter(function (callbackDef) { return (!callbackDef.eventType || callbackDef.eventType === eventType) && (!callbackDef.selector || callbackDef.selector === selector); })
53
+ .forEach(function (callbackDef) {
54
+ callbackDef.callback(data);
55
+ });
56
+ };
57
+ /**
58
+ * Dispose the event manager
59
+ */
60
+ EventManager.prototype.dispose = function () {
61
+ this._callbacksContainer = {};
62
+ };
63
+ return EventManager;
64
+ }());
65
+ export { EventManager };
64
66
  //# sourceMappingURL=eventManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"eventManager.js","sourceRoot":"","sources":["../../../../sourceES6/viewer/src/templating/eventManager.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH;IAII,sBAAoB,gBAAiC;QAArD,iBAKC;QALmB,qBAAgB,GAAhB,gBAAgB,CAAiB;QACjD,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;QAC9B,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAC,SAAS;YACjD,KAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;OAQG;IACI,uCAAgB,GAAvB,UAAwB,YAAoB,EAAE,QAA4C,EAAE,SAAkB,EAAE,QAAiB;QAC7H,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE;YACzC,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;SAC/C;QACD,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;YACxC,SAAS,WAAA;YACT,QAAQ,UAAA;YACR,QAAQ,UAAA;SACX,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;OAQG;IACI,yCAAkB,GAAzB,UAA0B,YAAoB,EAAE,QAA4C,EAAE,SAAkB,EAAE,QAAiB;QAC/H,IAAI,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QAChE,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,UAAC,WAAW,IAAK,OAAA,CAAC,CAAC,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,KAAK,QAAQ,CAAC,EAA/H,CAA+H,CAAC,CAAC;IACnN,CAAC;IAEO,sCAAe,GAAvB,UAAwB,IAAmB;QACvC,IAAI,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtC,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAChC,IAAI,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE7B,IAAI,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QAChE,YAAY,CAAC,MAAM,CAAC,UAAC,WAAW,IAAK,OAAA,CAAC,CAAC,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,KAAK,QAAQ,CAAC,EAA/H,CAA+H,CAAC,CAAC,OAAO,CAAC,UAAC,WAAW;YACtL,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,8BAAO,GAAd;QACI,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;IAClC,CAAC;IACL,mBAAC;AAAD,CAAC,AA9DD,IA8DC","sourcesContent":["import { EventCallback, TemplateManager } from \"./templateManager\";\r\n\r\n/**\r\n * The EventManager is in charge of registering user interctions with the viewer.\r\n * It is used in the TemplateManager\r\n */\r\nexport class EventManager {\r\n\r\n private _callbacksContainer: { [key: string]: Array<{ eventType?: string, selector?: string, callback: (eventData: EventCallback) => void }> };\r\n\r\n constructor(private _templateManager: TemplateManager) {\r\n this._callbacksContainer = {};\r\n this._templateManager.onEventTriggered.add((eventData) => {\r\n this._eventTriggered(eventData);\r\n });\r\n }\r\n\r\n /**\r\n * Register a new callback to a specific template.\r\n * The best example for the usage can be found in the DefaultViewer\r\n *\r\n * @param templateName the templateName to register the event to\r\n * @param callback The callback to be executed\r\n * @param eventType the type of event to register\r\n * @param selector an optional selector. if not defined the parent object in the template will be selected\r\n */\r\n public registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string) {\r\n if (!this._callbacksContainer[templateName]) {\r\n this._callbacksContainer[templateName] = [];\r\n }\r\n this._callbacksContainer[templateName].push({\r\n eventType,\r\n callback,\r\n selector\r\n });\r\n }\r\n\r\n /**\r\n * This will remove a registered event from the defined template.\r\n * Each one of the variables apart from the template name are optional, but one must be provided.\r\n *\r\n * @param templateName the templateName\r\n * @param callback the callback to remove (optional)\r\n * @param eventType the event type to remove (optional)\r\n * @param selector the selector from which to remove the event (optional)\r\n */\r\n public unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string) {\r\n let callbackDefs = this._callbacksContainer[templateName] || [];\r\n this._callbacksContainer[templateName] = callbackDefs.filter((callbackDef) => (!callbackDef.eventType || callbackDef.eventType === eventType) && (!callbackDef.selector || callbackDef.selector === selector));\r\n }\r\n\r\n private _eventTriggered(data: EventCallback) {\r\n let templateName = data.template.name;\r\n let eventType = data.event.type;\r\n let selector = data.selector;\r\n\r\n let callbackDefs = this._callbacksContainer[templateName] || [];\r\n callbackDefs.filter((callbackDef) => (!callbackDef.eventType || callbackDef.eventType === eventType) && (!callbackDef.selector || callbackDef.selector === selector)).forEach((callbackDef) => {\r\n callbackDef.callback(data);\r\n });\r\n }\r\n\r\n /**\r\n * Dispose the event manager\r\n */\r\n public dispose() {\r\n this._callbacksContainer = {};\r\n }\r\n}"]}
1
+ {"version":3,"file":"eventManager.js","sourceRoot":"","sources":["../../../../../tools/viewer/src/templating/eventManager.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH;IAGI,sBAAoB,gBAAiC;QAArD,iBAKC;QALmB,qBAAgB,GAAhB,gBAAgB,CAAiB;QACjD,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;QAC9B,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAC,SAAS;YACjD,KAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;OAQG;IACI,uCAAgB,GAAvB,UAAwB,YAAoB,EAAE,QAA4C,EAAE,SAAkB,EAAE,QAAiB;QAC7H,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE;YACzC,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;SAC/C;QACD,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;YACxC,SAAS,WAAA;YACT,QAAQ,UAAA;YACR,QAAQ,UAAA;SACX,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;OAQG;IACI,yCAAkB,GAAzB,UAA0B,YAAoB,EAAE,QAA4C,EAAE,SAAkB,EAAE,QAAiB;QAC/H,IAAM,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QAClE,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC,MAAM,CACxD,UAAC,WAAW,IAAK,OAAA,CAAC,CAAC,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,KAAK,QAAQ,CAAC,EAA/H,CAA+H,CACnJ,CAAC;IACN,CAAC;IAEO,sCAAe,GAAvB,UAAwB,IAAmB;QACvC,IAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QACxC,IAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;QAClC,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE/B,IAAM,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;QAClE,YAAY;aACP,MAAM,CAAC,UAAC,WAAW,IAAK,OAAA,CAAC,CAAC,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,QAAQ,IAAI,WAAW,CAAC,QAAQ,KAAK,QAAQ,CAAC,EAA/H,CAA+H,CAAC;aACxJ,OAAO,CAAC,UAAC,WAAW;YACjB,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACX,CAAC;IAED;;OAEG;IACI,8BAAO,GAAd;QACI,IAAI,CAAC,mBAAmB,GAAG,EAAE,CAAC;IAClC,CAAC;IACL,mBAAC;AAAD,CAAC,AAjED,IAiEC","sourcesContent":["import type { EventCallback, TemplateManager } from \"./templateManager\";\r\n\r\n/**\r\n * The EventManager is in charge of registering user interctions with the viewer.\r\n * It is used in the TemplateManager\r\n */\r\nexport class EventManager {\r\n private _callbacksContainer: { [key: string]: Array<{ eventType?: string; selector?: string; callback: (eventData: EventCallback) => void }> };\r\n\r\n constructor(private _templateManager: TemplateManager) {\r\n this._callbacksContainer = {};\r\n this._templateManager.onEventTriggered.add((eventData) => {\r\n this._eventTriggered(eventData);\r\n });\r\n }\r\n\r\n /**\r\n * Register a new callback to a specific template.\r\n * The best example for the usage can be found in the DefaultViewer\r\n *\r\n * @param templateName the templateName to register the event to\r\n * @param callback The callback to be executed\r\n * @param eventType the type of event to register\r\n * @param selector an optional selector. if not defined the parent object in the template will be selected\r\n */\r\n public registerCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string) {\r\n if (!this._callbacksContainer[templateName]) {\r\n this._callbacksContainer[templateName] = [];\r\n }\r\n this._callbacksContainer[templateName].push({\r\n eventType,\r\n callback,\r\n selector,\r\n });\r\n }\r\n\r\n /**\r\n * This will remove a registered event from the defined template.\r\n * Each one of the variables apart from the template name are optional, but one must be provided.\r\n *\r\n * @param templateName the templateName\r\n * @param callback the callback to remove (optional)\r\n * @param eventType the event type to remove (optional)\r\n * @param selector the selector from which to remove the event (optional)\r\n */\r\n public unregisterCallback(templateName: string, callback: (eventData: EventCallback) => void, eventType?: string, selector?: string) {\r\n const callbackDefs = this._callbacksContainer[templateName] || [];\r\n this._callbacksContainer[templateName] = callbackDefs.filter(\r\n (callbackDef) => (!callbackDef.eventType || callbackDef.eventType === eventType) && (!callbackDef.selector || callbackDef.selector === selector)\r\n );\r\n }\r\n\r\n private _eventTriggered(data: EventCallback) {\r\n const templateName = data.template.name;\r\n const eventType = data.event.type;\r\n const selector = data.selector;\r\n\r\n const callbackDefs = this._callbacksContainer[templateName] || [];\r\n callbackDefs\r\n .filter((callbackDef) => (!callbackDef.eventType || callbackDef.eventType === eventType) && (!callbackDef.selector || callbackDef.selector === selector))\r\n .forEach((callbackDef) => {\r\n callbackDef.callback(data);\r\n });\r\n }\r\n\r\n /**\r\n * Dispose the event manager\r\n */\r\n public dispose() {\r\n this._callbacksContainer = {};\r\n }\r\n}\r\n"]}
@@ -1,9 +1,9 @@
1
- import { AbstractViewerNavbarButton } from "../viewerTemplatePlugin";
2
- import { DefaultViewer } from "../../viewer/defaultViewer";
3
- import { EventCallback } from "../templateManager";
4
- export declare class HDButtonPlugin extends AbstractViewerNavbarButton {
5
- private _viewer;
6
- constructor(_viewer: DefaultViewer);
7
- onEvent(event: EventCallback): void;
8
- protected static HtmlTemplate: string;
9
- }
1
+ import { AbstractViewerNavbarButton } from "../viewerTemplatePlugin";
2
+ import type { DefaultViewer } from "../../viewer/defaultViewer";
3
+ import type { EventCallback } from "../templateManager";
4
+ export declare class HDButtonPlugin extends AbstractViewerNavbarButton {
5
+ private _viewer;
6
+ constructor(_viewer: DefaultViewer);
7
+ onEvent(event: EventCallback): void;
8
+ protected static HtmlTemplate: string;
9
+ }