viral-viewer-2 6.2.8 → 6.2.9

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 (293) hide show
  1. package/dist/index.mjs +41153 -0
  2. package/dist/threejs-addon/n8ao/post-processing.d.ts +109 -109
  3. package/package.json +1 -1
  4. package/dist/components/animation/viral-animation.js +0 -71
  5. package/dist/components/animation/viral-animation.js.map +0 -1
  6. package/dist/components/bvh/viral-bvh.js +0 -19
  7. package/dist/components/bvh/viral-bvh.js.map +0 -1
  8. package/dist/components/camera/viral-camera.js +0 -207
  9. package/dist/components/camera/viral-camera.js.map +0 -1
  10. package/dist/components/centralized-event-handler/viral-centralized-event-handler.d.ts +0 -7
  11. package/dist/components/centralized-event-handler/viral-centralized-event-handler.js +0 -47
  12. package/dist/components/centralized-event-handler/viral-centralized-event-handler.js.map +0 -1
  13. package/dist/components/compress/compress.processor.d.ts +0 -4
  14. package/dist/components/compress/compress.processor.js +0 -29
  15. package/dist/components/compress/compress.processor.js.map +0 -1
  16. package/dist/components/compress/viral-compress.processor.js +0 -13
  17. package/dist/components/compress/viral-compress.processor.js.map +0 -1
  18. package/dist/components/context-menu/viral-context-menu.d.ts +0 -17
  19. package/dist/components/context-menu/viral-context-menu.js +0 -74
  20. package/dist/components/context-menu/viral-context-menu.js.map +0 -1
  21. package/dist/components/custom-objects/index.js +0 -6
  22. package/dist/components/custom-objects/index.js.map +0 -1
  23. package/dist/components/custom-objects/viral-instanced-mesh.js +0 -203
  24. package/dist/components/custom-objects/viral-instanced-mesh.js.map +0 -1
  25. package/dist/components/custom-objects/viral-mesh.js +0 -25
  26. package/dist/components/custom-objects/viral-mesh.js.map +0 -1
  27. package/dist/components/data-manager/viral-data-manager.js +0 -35
  28. package/dist/components/data-manager/viral-data-manager.js.map +0 -1
  29. package/dist/components/event-handler/base/event-dispatcher.js +0 -35
  30. package/dist/components/event-handler/base/event-dispatcher.js.map +0 -1
  31. package/dist/components/event-handler/keyboard/viral-keyboard.js +0 -78
  32. package/dist/components/event-handler/keyboard/viral-keyboard.js.map +0 -1
  33. package/dist/components/event-handler/mouse/viral-mouse.js +0 -239
  34. package/dist/components/event-handler/mouse/viral-mouse.js.map +0 -1
  35. package/dist/components/event-handler/viral-centralized-event-handler.js +0 -186
  36. package/dist/components/event-handler/viral-centralized-event-handler.js.map +0 -1
  37. package/dist/components/event-handler/viral-lifecycle-event-handler.js +0 -55
  38. package/dist/components/event-handler/viral-lifecycle-event-handler.js.map +0 -1
  39. package/dist/components/keyboard/viral-keyboard.d.ts +0 -17
  40. package/dist/components/keyboard/viral-keyboard.js +0 -76
  41. package/dist/components/keyboard/viral-keyboard.js.map +0 -1
  42. package/dist/components/loader/viral-point-cloud.loader.js +0 -33
  43. package/dist/components/loader/viral-point-cloud.loader.js.map +0 -1
  44. package/dist/components/loader/viral-revit.loader.js +0 -339
  45. package/dist/components/loader/viral-revit.loader.js.map +0 -1
  46. package/dist/components/loader/viral-three.loader.js +0 -20
  47. package/dist/components/loader/viral-three.loader.js.map +0 -1
  48. package/dist/components/loader/viral-viewer-point-cloud.loader.d.ts +0 -16
  49. package/dist/components/loader/viral-viewer-point-cloud.loader.js +0 -33
  50. package/dist/components/loader/viral-viewer-point-cloud.loader.js.map +0 -1
  51. package/dist/components/loader/viral-viewer-revit.loader.d.ts +0 -13
  52. package/dist/components/loader/viral-viewer-revit.loader.js +0 -124
  53. package/dist/components/loader/viral-viewer-revit.loader.js.map +0 -1
  54. package/dist/components/loader/viral.loader.js +0 -16
  55. package/dist/components/loader/viral.loader.js.map +0 -1
  56. package/dist/components/material/viral-material-manager.js +0 -60
  57. package/dist/components/material/viral-material-manager.js.map +0 -1
  58. package/dist/components/mouse/viral-mouse.d.ts +0 -31
  59. package/dist/components/mouse/viral-mouse.js +0 -234
  60. package/dist/components/mouse/viral-mouse.js.map +0 -1
  61. package/dist/components/navigation-cube/components/cube-camera.d.ts +0 -15
  62. package/dist/components/navigation-cube/components/cube-camera.js +0 -74
  63. package/dist/components/navigation-cube/components/cube-camera.js.map +0 -1
  64. package/dist/components/navigation-cube/components/cube-renderer.d.ts +0 -9
  65. package/dist/components/navigation-cube/components/cube-renderer.js +0 -31
  66. package/dist/components/navigation-cube/components/cube-renderer.js.map +0 -1
  67. package/dist/components/navigation-cube/components/cube-scene.d.ts +0 -13
  68. package/dist/components/navigation-cube/components/cube-scene.js +0 -546
  69. package/dist/components/navigation-cube/components/cube-scene.js.map +0 -1
  70. package/dist/components/navigation-cube/components/cube.mouse.d.ts +0 -9
  71. package/dist/components/navigation-cube/components/cube.mouse.js +0 -109
  72. package/dist/components/navigation-cube/components/cube.mouse.js.map +0 -1
  73. package/dist/components/navigation-cube/viral-navigation-cube.d.ts +0 -16
  74. package/dist/components/navigation-cube/viral-navigation-cube.js +0 -50
  75. package/dist/components/navigation-cube/viral-navigation-cube.js.map +0 -1
  76. package/dist/components/post-processing/ambient-occlusion-effect.d.ts +0 -13
  77. package/dist/components/post-processing/ambient-occlusion-effect.js +0 -33
  78. package/dist/components/post-processing/ambient-occlusion-effect.js.map +0 -1
  79. package/dist/components/post-processing/bloom-effect.d.ts +0 -11
  80. package/dist/components/post-processing/bloom-effect.js +0 -29
  81. package/dist/components/post-processing/bloom-effect.js.map +0 -1
  82. package/dist/components/post-processing/outline-effect.d.ts +0 -13
  83. package/dist/components/post-processing/outline-effect.js +0 -33
  84. package/dist/components/post-processing/outline-effect.js.map +0 -1
  85. package/dist/components/post-processing/post-processing-renderer.js +0 -46
  86. package/dist/components/post-processing/post-processing-renderer.js.map +0 -1
  87. package/dist/components/renderer/viral-renderer.js +0 -55
  88. package/dist/components/renderer/viral-renderer.js.map +0 -1
  89. package/dist/components/scene/viral-scene.js +0 -131
  90. package/dist/components/scene/viral-scene.js.map +0 -1
  91. package/dist/components/spinner/viral-spinner.d.ts +0 -10
  92. package/dist/components/spinner/viral-spinner.js +0 -207
  93. package/dist/components/spinner/viral-spinner.js.map +0 -1
  94. package/dist/components/stats/viral-stats.js +0 -17
  95. package/dist/components/stats/viral-stats.js.map +0 -1
  96. package/dist/components/tools/tools/viral-tool-ambient-occlusion.d.ts +0 -7
  97. package/dist/components/tools/tools/viral-tool-ambient-occlusion.js +0 -16
  98. package/dist/components/tools/tools/viral-tool-ambient-occlusion.js.map +0 -1
  99. package/dist/components/tools/tools/viral-tool-dark-mode.d.ts +0 -7
  100. package/dist/components/tools/tools/viral-tool-dark-mode.js +0 -21
  101. package/dist/components/tools/tools/viral-tool-dark-mode.js.map +0 -1
  102. package/dist/components/tools/tools/viral-tool-elevation.d.ts +0 -11
  103. package/dist/components/tools/tools/viral-tool-elevation.js +0 -30
  104. package/dist/components/tools/tools/viral-tool-elevation.js.map +0 -1
  105. package/dist/components/tools/tools/viral-tool-measure.d.ts +0 -33
  106. package/dist/components/tools/tools/viral-tool-measure.js +0 -243
  107. package/dist/components/tools/tools/viral-tool-measure.js.map +0 -1
  108. package/dist/components/tools/tools/viral-tool-sunlight.d.ts +0 -7
  109. package/dist/components/tools/tools/viral-tool-sunlight.js +0 -46
  110. package/dist/components/tools/tools/viral-tool-sunlight.js.map +0 -1
  111. package/dist/components/tools/viral-tools.d.ts +0 -32
  112. package/dist/components/tools/viral-tools.js +0 -213
  113. package/dist/components/tools/viral-tools.js.map +0 -1
  114. package/dist/components/visibility-manager/viral-visibility-manager.js +0 -175
  115. package/dist/components/visibility-manager/viral-visibility-manager.js.map +0 -1
  116. package/dist/components/worker/base/worker-pool.js +0 -68
  117. package/dist/components/worker/base/worker-pool.js.map +0 -1
  118. package/dist/components/worker/base/worker-thread.js +0 -35
  119. package/dist/components/worker/base/worker-thread.js.map +0 -1
  120. package/dist/components/worker/fetch-data.worker.js +0 -31
  121. package/dist/components/worker/fetch-data.worker.js.map +0 -1
  122. package/dist/components/worker/load-element-by-material-v2.worker.js +0 -80
  123. package/dist/components/worker/load-element-by-material-v2.worker.js.map +0 -1
  124. package/dist/components/worker/load-element-by-material.worker.js +0 -59
  125. package/dist/components/worker/load-element-by-material.worker.js.map +0 -1
  126. package/dist/components/worker/load-element-standalone.worker.js +0 -109
  127. package/dist/components/worker/load-element-standalone.worker.js.map +0 -1
  128. package/dist/components/worker/load-model.d.ts +0 -126
  129. package/dist/components/worker/load-model.js +0 -1265
  130. package/dist/components/worker/load-model.js.map +0 -1
  131. package/dist/components/worker/test-worker-pool.d.ts +0 -6
  132. package/dist/components/worker/test-worker-pool.js +0 -21
  133. package/dist/components/worker/test-worker-pool.js.map +0 -1
  134. package/dist/components/worker/viral-viewer-2.worker.js +0 -127
  135. package/dist/components/worker/viral-viewer-2.worker.js.map +0 -1
  136. package/dist/components/worker/viral-viewer-3.worker.js +0 -82
  137. package/dist/components/worker/viral-viewer-3.worker.js.map +0 -1
  138. package/dist/components/worker/viral-viewer-4.worker.d.ts +0 -10
  139. package/dist/components/worker/viral-viewer-4.worker.js +0 -97
  140. package/dist/components/worker/viral-viewer-4.worker.js.map +0 -1
  141. package/dist/components/worker/viral-viewer.worker-pool.d.ts +0 -0
  142. package/dist/components/worker/viral-viewer.worker-pool.js +0 -61
  143. package/dist/components/worker/viral-viewer.worker-pool.js.map +0 -1
  144. package/dist/components/worker/viral-viewer.worker.js +0 -107
  145. package/dist/components/worker/viral-viewer.worker.js.map +0 -1
  146. package/dist/components/worker/worker-pool.d.ts +0 -21
  147. package/dist/components/worker/worker-pool.js +0 -47
  148. package/dist/components/worker/worker-pool.js.map +0 -1
  149. package/dist/components/worker/worker-thread.d.ts +0 -9
  150. package/dist/components/worker/worker-thread.js +0 -30
  151. package/dist/components/worker/worker-thread.js.map +0 -1
  152. package/dist/components/worker-script/fetch-data-worker.script.js +0 -56
  153. package/dist/components/worker-script/fetch-data-worker.script.js.map +0 -1
  154. package/dist/components/worker-script/load-element-by-material.script.js +0 -131
  155. package/dist/components/worker-script/load-element-by-material.script.js.map +0 -1
  156. package/dist/components/worker-script/load-element-standalone.script.js +0 -34172
  157. package/dist/components/worker-script/load-element-standalone.script.js.map +0 -1
  158. package/dist/components/worker-script/load-model-worker-2.script.js +0 -2704
  159. package/dist/components/worker-script/load-model-worker-2.script.js.map +0 -1
  160. package/dist/components/worker-script/load-model-worker-3.script.d.ts +0 -1
  161. package/dist/components/worker-script/load-model-worker-3.script.js +0 -34170
  162. package/dist/components/worker-script/load-model-worker-3.script.js.map +0 -1
  163. package/dist/components/worker-script/load-model-worker.script.js +0 -148
  164. package/dist/components/worker-script/load-model-worker.script.js.map +0 -1
  165. package/dist/components/worker-script/material-aproach/load-element-by-material-instanced-mesh.script.js +0 -34152
  166. package/dist/components/worker-script/material-aproach/load-element-by-material-instanced-mesh.script.js.map +0 -1
  167. package/dist/components/worker-script/material-aproach/load-element-by-material-mesh.script.js +0 -127
  168. package/dist/components/worker-script/material-aproach/load-element-by-material-mesh.script.js.map +0 -1
  169. package/dist/components/worker-script/test-worker-pool.script.d.ts +0 -1
  170. package/dist/components/worker-script/test-worker-pool.script.js +0 -12
  171. package/dist/components/worker-script/test-worker-pool.script.js.map +0 -1
  172. package/dist/components/worker-script/threejs.types.js +0 -34162
  173. package/dist/components/worker-script/threejs.types.js.map +0 -1
  174. package/dist/const/colors.js +0 -39
  175. package/dist/const/colors.js.map +0 -1
  176. package/dist/const/fonts.js +0 -17
  177. package/dist/const/fonts.js.map +0 -1
  178. package/dist/const/icons.js +0 -11
  179. package/dist/const/icons.js.map +0 -1
  180. package/dist/gui/context-menu/viral-context-menu.js +0 -78
  181. package/dist/gui/context-menu/viral-context-menu.js.map +0 -1
  182. package/dist/gui/draggable-modal/viral-draggable-modal.js +0 -167
  183. package/dist/gui/draggable-modal/viral-draggable-modal.js.map +0 -1
  184. package/dist/gui/fonts/fonts.js +0 -20
  185. package/dist/gui/fonts/fonts.js.map +0 -1
  186. package/dist/gui/navigation-cube/components/cube-camera.js +0 -74
  187. package/dist/gui/navigation-cube/components/cube-camera.js.map +0 -1
  188. package/dist/gui/navigation-cube/components/cube-renderer.js +0 -31
  189. package/dist/gui/navigation-cube/components/cube-renderer.js.map +0 -1
  190. package/dist/gui/navigation-cube/components/cube-scene.js +0 -546
  191. package/dist/gui/navigation-cube/components/cube-scene.js.map +0 -1
  192. package/dist/gui/navigation-cube/components/cube.mouse.js +0 -109
  193. package/dist/gui/navigation-cube/components/cube.mouse.js.map +0 -1
  194. package/dist/gui/navigation-cube/viral-navigation-cube.js +0 -50
  195. package/dist/gui/navigation-cube/viral-navigation-cube.js.map +0 -1
  196. package/dist/gui/spinner/viral-spinner.js +0 -102
  197. package/dist/gui/spinner/viral-spinner.js.map +0 -1
  198. package/dist/gui/tools/tools/viral-tool-ambient-occlusion.js +0 -25
  199. package/dist/gui/tools/tools/viral-tool-ambient-occlusion.js.map +0 -1
  200. package/dist/gui/tools/tools/viral-tool-dark-mode.js +0 -21
  201. package/dist/gui/tools/tools/viral-tool-dark-mode.js.map +0 -1
  202. package/dist/gui/tools/tools/viral-tool-elevation.js +0 -30
  203. package/dist/gui/tools/tools/viral-tool-elevation.js.map +0 -1
  204. package/dist/gui/tools/tools/viral-tool-export-scene.js +0 -36
  205. package/dist/gui/tools/tools/viral-tool-export-scene.js.map +0 -1
  206. package/dist/gui/tools/tools/viral-tool-measure.js +0 -243
  207. package/dist/gui/tools/tools/viral-tool-measure.js.map +0 -1
  208. package/dist/gui/tools/tools/viral-tool-sunlight.js +0 -46
  209. package/dist/gui/tools/tools/viral-tool-sunlight.js.map +0 -1
  210. package/dist/gui/tools/viral-tools.js +0 -213
  211. package/dist/gui/tools/viral-tools.js.map +0 -1
  212. package/dist/index.js +0 -21
  213. package/dist/index.js.map +0 -1
  214. package/dist/models/dictionary.model.d.ts +0 -10
  215. package/dist/models/dictionary.model.js +0 -42
  216. package/dist/models/dictionary.model.js.map +0 -1
  217. package/dist/services/local-storage.service.js +0 -57
  218. package/dist/services/local-storage.service.js.map +0 -1
  219. package/dist/threejs-addon/buffer-geometry-utils.d.ts +0 -64
  220. package/dist/threejs-addon/buffer-geometry-utils.js +0 -807
  221. package/dist/threejs-addon/buffer-geometry-utils.js.map +0 -1
  222. package/dist/threejs-addon/gltf-loader.d.ts +0 -17
  223. package/dist/threejs-addon/gltf-loader.js +0 -2796
  224. package/dist/threejs-addon/gltf-loader.js.map +0 -1
  225. package/dist/threejs-addon/n8ao/n8ao.js +0 -1952
  226. package/dist/threejs-addon/n8ao/n8ao.js.map +0 -1
  227. package/dist/threejs-addon/n8ao/post-processing.js +0 -15145
  228. package/dist/threejs-addon/n8ao/post-processing.js.map +0 -1
  229. package/dist/threejs-addon/post-processing/effect-composer.d.ts +0 -27
  230. package/dist/threejs-addon/post-processing/effect-composer.js +0 -134
  231. package/dist/threejs-addon/post-processing/effect-composer.js.map +0 -1
  232. package/dist/threejs-addon/post-processing/mask-pass.d.ts +0 -11
  233. package/dist/threejs-addon/post-processing/mask-pass.js +0 -69
  234. package/dist/threejs-addon/post-processing/mask-pass.js.map +0 -1
  235. package/dist/threejs-addon/post-processing/outline-pass.d.ts +0 -58
  236. package/dist/threejs-addon/post-processing/outline-pass.js +0 -484
  237. package/dist/threejs-addon/post-processing/outline-pass.js.map +0 -1
  238. package/dist/threejs-addon/post-processing/output-pass.d.ts +0 -11
  239. package/dist/threejs-addon/post-processing/output-pass.js +0 -61
  240. package/dist/threejs-addon/post-processing/output-pass.js.map +0 -1
  241. package/dist/threejs-addon/post-processing/pass.d.ts +0 -20
  242. package/dist/threejs-addon/post-processing/pass.js +0 -48
  243. package/dist/threejs-addon/post-processing/pass.js.map +0 -1
  244. package/dist/threejs-addon/post-processing/render-pass.d.ts +0 -13
  245. package/dist/threejs-addon/post-processing/render-pass.js +0 -50
  246. package/dist/threejs-addon/post-processing/render-pass.js.map +0 -1
  247. package/dist/threejs-addon/post-processing/sao-pass.d.ts +0 -62
  248. package/dist/threejs-addon/post-processing/sao-pass.js +0 -296
  249. package/dist/threejs-addon/post-processing/sao-pass.js.map +0 -1
  250. package/dist/threejs-addon/post-processing/shader-pass.d.ts +0 -11
  251. package/dist/threejs-addon/post-processing/shader-pass.js +0 -48
  252. package/dist/threejs-addon/post-processing/shader-pass.js.map +0 -1
  253. package/dist/threejs-addon/post-processing/unreal-bloom-pass.d.ts +0 -48
  254. package/dist/threejs-addon/post-processing/unreal-bloom-pass.js +0 -290
  255. package/dist/threejs-addon/post-processing/unreal-bloom-pass.js.map +0 -1
  256. package/dist/threejs-addon/shaders/copy-shader.d.ts +0 -13
  257. package/dist/threejs-addon/shaders/copy-shader.js +0 -39
  258. package/dist/threejs-addon/shaders/copy-shader.js.map +0 -1
  259. package/dist/threejs-addon/shaders/depth-limited-blur-shader.d.ts +0 -48
  260. package/dist/threejs-addon/shaders/depth-limited-blur-shader.js +0 -142
  261. package/dist/threejs-addon/shaders/depth-limited-blur-shader.js.map +0 -1
  262. package/dist/threejs-addon/shaders/luminosity-high-pass-shader.d.ts +0 -27
  263. package/dist/threejs-addon/shaders/luminosity-high-pass-shader.js +0 -56
  264. package/dist/threejs-addon/shaders/luminosity-high-pass-shader.js.map +0 -1
  265. package/dist/threejs-addon/shaders/output-shader.d.ts +0 -13
  266. package/dist/threejs-addon/shaders/output-shader.js +0 -72
  267. package/dist/threejs-addon/shaders/output-shader.js.map +0 -1
  268. package/dist/threejs-addon/shaders/sao-shader.d.ts +0 -71
  269. package/dist/threejs-addon/shaders/sao-shader.js +0 -180
  270. package/dist/threejs-addon/shaders/sao-shader.js.map +0 -1
  271. package/dist/threejs-addon/shaders/unpack-depth-rgba-shader.d.ts +0 -13
  272. package/dist/threejs-addon/shaders/unpack-depth-rgba-shader.js +0 -41
  273. package/dist/threejs-addon/shaders/unpack-depth-rgba-shader.js.map +0 -1
  274. package/dist/threejs-addon/simplify-modifier.d.ts +0 -4
  275. package/dist/threejs-addon/simplify-modifier.js +0 -325
  276. package/dist/threejs-addon/simplify-modifier.js.map +0 -1
  277. package/dist/threejs-addon/stats.js +0 -102
  278. package/dist/threejs-addon/stats.js.map +0 -1
  279. package/dist/threejs-addon/transform-control.d.ts +0 -74
  280. package/dist/threejs-addon/transform-control.js +0 -1033
  281. package/dist/threejs-addon/transform-control.js.map +0 -1
  282. package/dist/types.js +0 -173
  283. package/dist/types.js.map +0 -1
  284. package/dist/utils/html.js +0 -12
  285. package/dist/utils/html.js.map +0 -1
  286. package/dist/utils/index.js +0 -10
  287. package/dist/utils/index.js.map +0 -1
  288. package/dist/utils/log.js +0 -14
  289. package/dist/utils/log.js.map +0 -1
  290. package/dist/utils/threejs.js +0 -44
  291. package/dist/utils/threejs.js.map +0 -1
  292. package/dist/viral-viewer-api.js +0 -76
  293. package/dist/viral-viewer-api.js.map +0 -1
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ViralToolSunlight = void 0;
4
- const three_1 = require("three");
5
- class ViralToolSunlight {
6
- constructor(viralTools) {
7
- this.viralTools = viralTools;
8
- }
9
- activate(input) {
10
- if (this.viralTools.viralViewerApi.targetElement) {
11
- let sunlight = this.viralTools.viralViewerApi.viralScene.lights.find((x) => x.name == "sunlight");
12
- if (input.activate) {
13
- if (sunlight) {
14
- sunlight.visible = true;
15
- if (this.viralTools.viralViewerApi.viralScene.models.length > 0) {
16
- let box = new three_1.Box3().setFromObject(this.viralTools.viralViewerApi.viralScene.models[0]);
17
- // const helper = new Box3Helper(box, new Color(0xffff00));
18
- // this.viralTools.viralViewerApi.viralScene.addObject(helper);
19
- const boxSize = new three_1.Vector3();
20
- box.getSize(boxSize);
21
- const center = new three_1.Vector3();
22
- box.getCenter(center);
23
- const width = boxSize.x;
24
- const height = boxSize.y;
25
- const depth = boxSize.z;
26
- const size = Math.sqrt(width * width + depth * depth);
27
- sunlight.position.set(center.x + size, size / Math.tan(Math.PI / 4), center.z + size);
28
- sunlight.shadow.camera.top = size / 2;
29
- sunlight.shadow.camera.bottom = -size / 2;
30
- sunlight.shadow.camera.left = -size / 2;
31
- sunlight.shadow.camera.right = size / 2;
32
- sunlight.target = this.viralTools.viralViewerApi.viralScene.models[0];
33
- }
34
- this.viralTools.viralViewerApi.viralRenderer.render();
35
- }
36
- this.viralTools.viralViewerApi.viralScene.enableLightHelper(true);
37
- }
38
- else {
39
- sunlight.visible = false;
40
- this.viralTools.viralViewerApi.viralScene.enableLightHelper(false);
41
- }
42
- }
43
- }
44
- }
45
- exports.ViralToolSunlight = ViralToolSunlight;
46
- //# sourceMappingURL=viral-tool-sunlight.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"viral-tool-sunlight.js","sourceRoot":"","sources":["../../../../src/components/tools/tools/viral-tool-sunlight.ts"],"names":[],"mappings":";;;AAAA,iCAQe;AAIf,MAAa,iBAAiB;IAC5B,YAAmB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IACtC,QAAQ,CAAC,KAAsB;QACpC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,aAAa,EAAE;YAChD,IAAI,QAAQ,GACV,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CACnD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,UAAU,CACR,CAAC;YACxB,IAAI,KAAK,CAAC,QAAQ,EAAE;gBAClB,IAAI,QAAQ,EAAE;oBACZ,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;oBACxB,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;wBAC/D,IAAI,GAAG,GAAG,IAAI,YAAI,EAAE,CAAC,aAAa,CAChC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CACpD,CAAC;wBACF,2DAA2D;wBAC3D,+DAA+D;wBAC/D,MAAM,OAAO,GAAG,IAAI,eAAO,EAAE,CAAC;wBAC9B,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;wBACrB,MAAM,MAAM,GAAG,IAAI,eAAO,EAAE,CAAC;wBAC7B,GAAG,CAAC,SAAS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AC,CAAC;aACpE;SACF;IACH,CAAC;CACF;AA7CD,8CA6CC"}
@@ -1,32 +0,0 @@
1
- import { ViralViewerTool } from "../..";
2
- import { ViralViewerApi } from "../../viral-viewer-api";
3
- import { ViralToolAmbientOcclusion } from "./tools/viral-tool-ambient-occlusion";
4
- import { ViralToolDarkMode } from "./tools/viral-tool-dark-mode";
5
- import { ViralToolElevation } from "./tools/viral-tool-elevation";
6
- import { ViralToolMeasure } from "./tools/viral-tool-measure";
7
- import { ViralToolSunlight } from "./tools/viral-tool-sunlight";
8
- export declare class ViralTools {
9
- viralViewerApi: ViralViewerApi;
10
- viralToolDarkMode: ViralToolDarkMode;
11
- viralToolSunlight: ViralToolSunlight;
12
- viralToolElevation: ViralToolElevation;
13
- viralToolMeasure: ViralToolMeasure;
14
- viralToolAmbientOcclusion: ViralToolAmbientOcclusion;
15
- tools: {
16
- name: string;
17
- tools: {
18
- svg: string;
19
- index: number;
20
- activate: boolean;
21
- allowDehydrated: boolean;
22
- name: string;
23
- action: (model: ViralViewerTool) => void;
24
- }[];
25
- }[];
26
- items: HTMLElement[];
27
- constructor(viralViewerApi: ViralViewerApi);
28
- private injectTools;
29
- private dehydratedCachedData;
30
- executeToolsByDefault(): void;
31
- private handleClick;
32
- }
@@ -1,213 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ViralTools = void 0;
4
- const __1 = require("../..");
5
- const colors_1 = require("../../const/colors");
6
- const viral_tool_ambient_occlusion_1 = require("./tools/viral-tool-ambient-occlusion");
7
- const viral_tool_dark_mode_1 = require("./tools/viral-tool-dark-mode");
8
- const viral_tool_elevation_1 = require("./tools/viral-tool-elevation");
9
- const viral_tool_measure_1 = require("./tools/viral-tool-measure");
10
- const viral_tool_sunlight_1 = require("./tools/viral-tool-sunlight");
11
- class ViralTools {
12
- constructor(viralViewerApi) {
13
- this.viralViewerApi = viralViewerApi;
14
- this.tools = [
15
- {
16
- name: "navigation",
17
- tools: [
18
- {
19
- svg: `<svg fill="${colors_1.LightTheme.primary}" style="height: 30px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>cursor-move</title><path d="M13,6V11H18V7.75L22.25,12L18,16.25V13H13V18H16.25L12,22.25L7.75,18H11V13H6V16.25L1.75,12L6,7.75V11H11V6H7.75L12,1.75L16.25,6H13Z" /></svg>`,
20
- index: 0,
21
- activate: true,
22
- allowDehydrated: false,
23
- name: "orbit",
24
- action: () => { },
25
- },
26
- {
27
- svg: `<svg fill="${colors_1.LightTheme.primary}" style="height: 30px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>nature-people-outline</title><path d="M16 20V16.12C19.47 15.71 22.17 12.76 22.17 9.17C22.17 5.3 19.04 2.17 15.17 2.17C13.31 2.17 11.53 2.91 10.22 4.22C8.91 5.53 8.17 7.31 8.17 9.17C8.17 9.95 8.3 10.69 8.53 11.38C8.64 11.71 8.77 12.03 8.93 12.33C9.91 14.27 11.78 15.68 14 16.06V20H6V17H7V12.95C7 12.72 6.89 12.5 6.74 12.33L6.71 12.29L6.66 12.25C6.5 12.09 6.25 12 6 12H3C2.76 12 2.5 12.09 2.34 12.25L2.29 12.29C2.11 12.5 2 12.74 2 13V17H3V22H19V20H16M15.08 14.22L14.33 14.09C11.96 13.69 10.17 11.64 10.17 9.17C10.17 7.84 10.7 6.57 11.63 5.63C12.57 4.7 13.85 4.17 15.17 4.17C17.93 4.17 20.17 6.41 20.17 9.17C20.17 11.73 18.24 13.84 15.77 14.13L15.08 14.21M4.5 11C5.33 11 6 10.33 6 9.5C6 8.67 5.33 8 4.5 8C3.67 8 3 8.67 3 9.5C3 10.33 3.67 11 4.5 11Z" /></svg>`,
28
- index: 1,
29
- activate: false,
30
- allowDehydrated: false,
31
- name: "first-person",
32
- action: () => { },
33
- },
34
- ],
35
- },
36
- {
37
- name: "helper",
38
- tools: [
39
- {
40
- svg: `<svg fill="${colors_1.LightTheme.primary}" style="height: 30px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>flag-variant-outline</title><path d="M6,3A1,1 0 0,1 7,4V4.88C8.06,4.44 9.5,4 11,4C14,4 14,6 16,6C19,6 20,4 20,4V12C20,12 19,14 16,14C13,14 13,12 11,12C8,12 7,14 7,14V21H5V4A1,1 0 0,1 6,3M7,7.25V11.5C7,11.5 9,10 11,10C13,10 14,12 16,12C18,12 18,11 18,11V7.5C18,7.5 17,8 16,8C14,8 13,6 11,6C9,6 7,7.25 7,7.25Z" /></svg>`,
41
- index: 0,
42
- activate: false,
43
- allowDehydrated: false,
44
- name: "elevation",
45
- action: (model) => this.viralToolElevation.activate(model),
46
- },
47
- {
48
- svg: `<svg fill="${colors_1.LightTheme.primary}" style="height: 30px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>ruler</title><path d="M1.39,18.36L3.16,16.6L4.58,18L5.64,16.95L4.22,15.54L5.64,14.12L8.11,16.6L9.17,15.54L6.7,13.06L8.11,11.65L9.53,13.06L10.59,12L9.17,10.59L10.59,9.17L13.06,11.65L14.12,10.59L11.65,8.11L13.06,6.7L14.47,8.11L15.54,7.05L14.12,5.64L15.54,4.22L18,6.7L19.07,5.64L16.6,3.16L18.36,1.39L22.61,5.64L5.64,22.61L1.39,18.36Z" /></svg>`,
49
- index: 1,
50
- activate: false,
51
- allowDehydrated: false,
52
- name: "ruler",
53
- action: (model) => this.viralToolMeasure.activate(model),
54
- },
55
- {
56
- svg: `<svg fill="${colors_1.LightTheme.primary}" style="height: 30px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>vector-intersection</title><path d="M3.14,1A2.14,2.14 0 0,0 1,3.14V5H3V3H5V1H3.14M7,1V3H10V1H7M12,1V3H14V5H16V3.14C16,1.96 15.04,1 13.86,1H12M1,7V10H3V7H1M9,7C7.89,7 7,7.89 7,9C7,11.33 7,16 7,16C7,16 11.57,16 13.86,16A2.14,2.14 0 0,0 16,13.86C16,11.57 16,7 16,7C16,7 11.33,7 9,7M18,7V9H20V11H22V9C22,7.89 21.11,7 20,7H18M9,9H14V14H9V9M1,12V13.86C1,15.04 1.96,16 3.14,16H5V14H3V12H1M20,13V16H22V13H20M7,18V20C7,21.11 7.89,22 9,22H11V20H9V18H7M20,18V20H18V22H20C21.11,22 22,21.11 22,20V18H20M13,20V22H16V20H13Z" /></svg>`,
57
- index: 2,
58
- activate: false,
59
- allowDehydrated: false,
60
- name: "clip-plane",
61
- action: () => { },
62
- },
63
- ],
64
- },
65
- {
66
- name: "environment",
67
- tools: [
68
- {
69
- svg: `<svg fill="${colors_1.LightTheme.primary}" style="height: 30px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>white-balance-sunny</title><path d="M3.55 19.09L4.96 20.5L6.76 18.71L5.34 17.29M12 6C8.69 6 6 8.69 6 12S8.69 18 12 18 18 15.31 18 12C18 8.68 15.31 6 12 6M20 13H23V11H20M17.24 18.71L19.04 20.5L20.45 19.09L18.66 17.29M20.45 5L19.04 3.6L17.24 5.39L18.66 6.81M13 1H11V4H13M6.76 5.39L4.96 3.6L3.55 5L5.34 6.81L6.76 5.39M1 13H4V11H1M13 20H11V23H13" /></svg>`,
70
- index: 0,
71
- activate: false,
72
- allowDehydrated: false,
73
- name: "sun",
74
- action: (model) => this.viralToolSunlight.activate(model),
75
- },
76
- {
77
- svg: `<svg fill="${colors_1.LightTheme.primary}" style="height: 30px;" xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M480-120q-75 0-140.5-28.5t-114-77q-48.5-48.5-77-114T120-480q0-75 28.5-140.5t77-114q48.5-48.5 114-77T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-120ZM200-480q0 83 44.5 152T365-225q-42-51-63.5-120T280-492q0-66 16-125t46-107q-66 38-104 103t-38 141Zm348 272q75-19 130-74t74-130L548-208Zm-67-18 278-278q-2-14-4-28.5t-7-28.5L444-257q8 9 17.5 16.5T481-226Zm-74-79 315-315q-6-10-12-19.5T696-658L385-348q5 11 10.5 21.5T407-305Zm-40-108 286-287q-10-8-19.5-14.5T613-727L360-474q1 16 2.5 31t4.5 30Zm0-152 185-186q-15-4-30-6t-30-3q-49 29-81 79t-44 116Zm-25-159Z"/></svg>`,
78
- index: 1,
79
- activate: false,
80
- allowDehydrated: false,
81
- name: "ambient-occlusion",
82
- action: (model) => this.viralToolAmbientOcclusion.activate(model),
83
- },
84
- ],
85
- },
86
- {
87
- name: "theme",
88
- tools: [
89
- {
90
- svg: `<svg fill="${colors_1.LightTheme.primary}" style="height: 30px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><title>moon-waning-crescent</title><path d="M2 12A10 10 0 0 0 15 21.54A10 10 0 0 1 15 2.46A10 10 0 0 0 2 12Z" /></svg>`,
91
- index: 0,
92
- activate: false,
93
- allowDehydrated: true,
94
- name: "night-mode",
95
- action: (model) => this.viralToolDarkMode.activate(model),
96
- },
97
- ],
98
- },
99
- ];
100
- this.items = [];
101
- this.viralToolDarkMode = new viral_tool_dark_mode_1.ViralToolDarkMode(this);
102
- this.viralToolSunlight = new viral_tool_sunlight_1.ViralToolSunlight(this);
103
- this.viralToolElevation = new viral_tool_elevation_1.ViralToolElevation(this);
104
- this.viralToolMeasure = new viral_tool_measure_1.ViralToolMeasure(this);
105
- this.viralToolAmbientOcclusion = new viral_tool_ambient_occlusion_1.ViralToolAmbientOcclusion(this);
106
- this.dehydratedCachedData();
107
- this.executeToolsByDefault();
108
- this.injectTools();
109
- this.viralViewerApi.lifeCycleEvent.emit(__1.ViralutionEvent.LOADED_TOOLS);
110
- }
111
- //#region Init
112
- injectTools() {
113
- if (this.viralViewerApi.targetElement) {
114
- const wrapperDiv = document.createElement("div");
115
- wrapperDiv.setAttribute("style", "position: absolute;bottom: 10px;left: 0px;right: 0px;display: flex;flex-direction: row;justify-content: center; align-items: center; pointer-events: none;flex-wrap:wrap;row-gap: 5px;");
116
- for (let index = 0; index < this.tools.length; index++) {
117
- const element = this.tools[index];
118
- const contentDiv = document.createElement("div");
119
- contentDiv.setAttribute("style", `padding: 8px 10px 10px 10px; display: flex;flex-direction: row;justify-content: center; align-items: center; background-color: ${colors_1.LightTheme.background}; border-radius: 10px; pointer-events: visible;margin: 0 2.5px;`);
120
- for (let j = 0; j < element.tools.length; j++) {
121
- const item = element.tools[j];
122
- const itemWrapperDiv = document.createElement("div");
123
- this.items.push(itemWrapperDiv);
124
- itemWrapperDiv.setAttribute("style", "display:flex; flex-direction: column; cursor: pointer; margin: 0 2px;");
125
- itemWrapperDiv.id = item.name;
126
- itemWrapperDiv.addEventListener("click", (ev) => {
127
- this.handleClick(ev, itemWrapperDiv);
128
- });
129
- //border top
130
- const borderDiv = document.createElement("div");
131
- borderDiv.setAttribute("style", `border-top: 2px solid ; padding-bottom: 2px; border-color: ${colors_1.LightTheme.background};`);
132
- if (item.activate) {
133
- borderDiv.setAttribute("style", `border-top: 2px solid ; padding-bottom: 2px; border-color: ${colors_1.LightTheme.secondary};`);
134
- }
135
- itemWrapperDiv.appendChild(borderDiv);
136
- //icon
137
- const iconWrapperDiv = document.createElement("div");
138
- iconWrapperDiv.setAttribute("style", "display:flex; padding: 5px 5px; border-radius: 5px;");
139
- iconWrapperDiv.onmouseover = function () {
140
- iconWrapperDiv.style.setProperty("background-color", "rgba(134, 149 ,125, 0.3)");
141
- };
142
- iconWrapperDiv.onmouseleave = function () {
143
- iconWrapperDiv.style.setProperty("background-color", "unset");
144
- };
145
- const svg = __1.HTMLUtil.createElementFromHTML(item.svg);
146
- if (item.activate && svg) {
147
- svg.setAttribute("fill", `${colors_1.LightTheme.secondary}`);
148
- }
149
- iconWrapperDiv.appendChild(svg);
150
- itemWrapperDiv.appendChild(iconWrapperDiv);
151
- contentDiv.appendChild(itemWrapperDiv);
152
- }
153
- wrapperDiv.appendChild(contentDiv);
154
- }
155
- this.viralViewerApi.targetElement.appendChild(wrapperDiv);
156
- }
157
- }
158
- dehydratedCachedData() {
159
- let rawData = this.viralViewerApi.localStorageService.get("viral-viewer-tool");
160
- if (rawData) {
161
- let cachedData = JSON.parse(rawData);
162
- if (cachedData) {
163
- for (let index = 0; index < cachedData.length; index++) {
164
- const element = cachedData[index];
165
- let currentToolGroup = this.tools[index];
166
- for (let j = 0; j < element.tools.length; j++) {
167
- const childTool = element.tools[j];
168
- if (currentToolGroup.tools[j].allowDehydrated) {
169
- currentToolGroup.tools[j].activate = childTool.activate;
170
- }
171
- }
172
- }
173
- }
174
- }
175
- }
176
- executeToolsByDefault() {
177
- let toolGroup = this.tools.find((x) => x.name == "theme");
178
- let tool = toolGroup === null || toolGroup === void 0 ? void 0 : toolGroup.tools.find((x) => x.name == "night-mode");
179
- if (tool) {
180
- this.viralToolDarkMode.activate(tool);
181
- }
182
- }
183
- handleClick(ev, host) {
184
- let id = host.id;
185
- let tool = null;
186
- if (id) {
187
- for (let index = 0; index < this.tools.length; index++) {
188
- const element = this.tools[index];
189
- tool = element.tools.find((x) => x.name == id);
190
- if (tool) {
191
- break;
192
- }
193
- }
194
- }
195
- if (tool) {
196
- tool.activate = !tool.activate;
197
- const borderElement = host.children[0];
198
- const iconWrapperElement = host.children[1];
199
- const svg = iconWrapperElement.children[0];
200
- if (tool.activate) {
201
- borderElement.style.setProperty("border-color", `${colors_1.LightTheme.secondary}`);
202
- svg.setAttribute("fill", `${colors_1.LightTheme.secondary}`);
203
- }
204
- else {
205
- borderElement.style.setProperty("border-color", `${colors_1.LightTheme.background}`);
206
- svg.setAttribute("fill", `${colors_1.LightTheme.primary}`);
207
- }
208
- tool.action(tool);
209
- }
210
- }
211
- }
212
- exports.ViralTools = ViralTools;
213
- //# sourceMappingURL=viral-tools.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"viral-tools.js","sourceRoot":"","sources":["../../../src/components/tools/viral-tools.ts"],"names":[],"mappings":";;;AAAA,6BAAmE;AACnE,+CAAgD;AAEhD,uFAAiF;AACjF,uEAAiE;AACjE,uEAAkE;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AQ,EAAE;gBACjB,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,EAAE,GAAG,mBAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBAC3E,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,mBAAU,CAAC,SAAS,EAAE,CAAC,CAAC;aACrD;iBAAM;gBACL,aAAa,CAAC,KAAK,CAAC,WAAW,CAC7B,cAAc,EACd,GAAG,mBAAU,CAAC,UAAU,EAAE,CAC3B,CAAC;gBACF,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,mBAAU,CAAC,OAAO,EAAE,CAAC,CAAC;aACnD;YACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SACnB;IACH,CAAC;CAEF;AAlPD,gCAkPC"}
@@ -1,175 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ViralVisibilityManager = void 0;
4
- const __1 = require("../..");
5
- class ViralVisibilityManager {
6
- constructor(viralViewerApi) {
7
- this.viralViewerApi = viralViewerApi;
8
- //#region Hover Meshes
9
- this.hoverMeshes = [];
10
- this.hoverInstancedMesh = null;
11
- //#endregion
12
- //#region Selected Meshes
13
- this.selectedMeshes = [];
14
- this.selectedInstancedMeshes = [];
15
- //#endregion
16
- //#region Isolate Meshes
17
- this.isolateMeshes = [];
18
- this.isolateInstancedMeshes = [];
19
- //#endregion
20
- //#region Hidden Meshes
21
- this.hiddenMeshes = [];
22
- this.hiddenInstancedMeshes = [];
23
- }
24
- reverseColor() {
25
- var _a, _b;
26
- if (this.hoverMeshes.length == 0 && !this.hoverInstancedMesh)
27
- return;
28
- this.hoverMeshes.forEach((element) => {
29
- // if current selected object difference than hover object, then allowed reverse color
30
- if (this.selectedMeshes.findIndex((x) => x.id == element.id) < 0)
31
- element.material = element.userData.originalMaterial;
32
- });
33
- this.hoverMeshes = [];
34
- (_a = this.hoverInstancedMesh) === null || _a === void 0 ? void 0 : _a.reverseIndex(true, false);
35
- (_b = this.hoverInstancedMesh) === null || _b === void 0 ? void 0 : _b.reverseToOriginal(true, false);
36
- this.hoverInstancedMesh = null;
37
- this.viralViewerApi.viralRenderer.render();
38
- }
39
- reverseSelectedColor() {
40
- if (this.selectedMeshes.length == 0 &&
41
- this.selectedInstancedMeshes.length == 0)
42
- return;
43
- if (!this.viralViewerApi.viralCentralizedEventHandler.isShiftPressed) {
44
- this.selectedMeshes.forEach((element) => {
45
- element.material = element.userData.originalMaterial;
46
- });
47
- }
48
- this.selectedInstancedMeshes.forEach((selectedInstancedMesh) => {
49
- //in case already hide or isolate, ignore
50
- // if (
51
- // this.isolateInstancedMeshes.findIndex(
52
- // (x) => x.id == selectedInstancedMesh.id
53
- // ) >= 0 ||
54
- // this.hiddenInstancedMeshes.findIndex(
55
- // (x) => x.id == selectedInstancedMesh.id
56
- // ) >= 0
57
- // ) {
58
- // return;
59
- // }
60
- if (this.viralViewerApi.viralCentralizedEventHandler.isShiftPressed) {
61
- selectedInstancedMesh === null || selectedInstancedMesh === void 0 ? void 0 : selectedInstancedMesh.reverseIndex(true, false);
62
- selectedInstancedMesh === null || selectedInstancedMesh === void 0 ? void 0 : selectedInstancedMesh.reverseToOriginal(true, false);
63
- }
64
- else {
65
- selectedInstancedMesh === null || selectedInstancedMesh === void 0 ? void 0 : selectedInstancedMesh.reverseIndex(true, true);
66
- selectedInstancedMesh === null || selectedInstancedMesh === void 0 ? void 0 : selectedInstancedMesh.reverseToOriginal();
67
- }
68
- });
69
- this.viralViewerApi.viralRenderer.render();
70
- //in case not shift pressed not reset
71
- if (!this.viralViewerApi.viralCentralizedEventHandler.isShiftPressed) {
72
- this.selectedMeshes = [];
73
- this.selectedInstancedMeshes = [];
74
- }
75
- }
76
- //#endregion
77
- showAll() {
78
- //hidden items
79
- if (this.hiddenMeshes.length > 0) {
80
- this.hiddenMeshes.forEach((mesh) => {
81
- mesh.visible = true;
82
- //add again to selectable list
83
- this.viralViewerApi.viralScene.selectables.push(mesh);
84
- });
85
- //after show all, clear hidden list
86
- this.hiddenMeshes = [];
87
- }
88
- if (this.hiddenInstancedMeshes.length > 0) {
89
- this.hiddenInstancedMeshes.forEach((instancedMesh) => {
90
- instancedMesh.reverseToOriginal(true, true, true);
91
- });
92
- //after show all, clear hidden list
93
- this.hiddenInstancedMeshes = [];
94
- }
95
- //isolate items
96
- if (this.isolateMeshes.length > 0 ||
97
- this.isolateInstancedMeshes.length > 0) {
98
- this.isolateMeshes.forEach((element) => {
99
- let findedIndex = this.viralViewerApi.viralScene.mainModel.children.findIndex((x) => x.id == element.id);
100
- __1.LogUtil.information(findedIndex);
101
- this.viralViewerApi.viralScene.mainModel.add(element);
102
- this.viralViewerApi.viralScene.isolateModel.remove(element);
103
- });
104
- this.isolateInstancedMeshes.forEach((element) => {
105
- element.reverseToOriginal(true, true, true);
106
- this.viralViewerApi.viralScene.mainModel.add(element);
107
- this.viralViewerApi.viralScene.isolateModel.remove(element);
108
- });
109
- this.viralViewerApi.viralScene.selectables =
110
- this.viralViewerApi.viralScene.mainModel.children;
111
- //reset list
112
- this.isolateInstancedMeshes = [];
113
- this.isolateMeshes = [];
114
- }
115
- this.viralViewerApi.viralScene.mainModel.visible = true;
116
- this.viralViewerApi.viralRenderer.render();
117
- }
118
- hide() {
119
- if (this.selectedMeshes.length > 0) {
120
- this.selectedMeshes.forEach((mesh) => {
121
- this.hiddenMeshes.push(mesh);
122
- //remove from selectable list for ray cast purpose
123
- this.viralViewerApi.viralScene.selectables =
124
- this.viralViewerApi.viralScene.selectables.filter((x) => x.id !== mesh.id);
125
- });
126
- this.hiddenMeshes.forEach((mesh) => {
127
- mesh.visible = false;
128
- });
129
- }
130
- if (this.selectedInstancedMeshes.length > 0) {
131
- this.selectedInstancedMeshes.forEach((instancedMesh) => {
132
- instancedMesh.hideObjects();
133
- this.hiddenInstancedMeshes.push(instancedMesh);
134
- });
135
- }
136
- if (this.hiddenMeshes.length > 0 || this.hiddenInstancedMeshes.length > 0) {
137
- this.viralViewerApi.viralRenderer.render();
138
- }
139
- }
140
- isolate() {
141
- if (this.selectedMeshes.length == 0 &&
142
- this.selectedInstancedMeshes.length == 0)
143
- return;
144
- //reset selectable list
145
- this.viralViewerApi.viralScene.selectables = [];
146
- if (this.selectedMeshes.length > 0) {
147
- for (let index = 0; index < this.selectedMeshes.length; index++) {
148
- const mesh = this.selectedMeshes[index];
149
- this.isolateMeshes.push(mesh);
150
- this.viralViewerApi.viralScene.isolateModel.add(mesh);
151
- //add to selectable list for ray cast purpose
152
- this.viralViewerApi.viralScene.selectables.push(mesh);
153
- }
154
- }
155
- if (this.selectedInstancedMeshes.length > 0) {
156
- for (let index = 0; index < this.selectedInstancedMeshes.length; index++) {
157
- const instancedMesh = this.selectedInstancedMeshes[index];
158
- instancedMesh.isolateObjects();
159
- this.isolateInstancedMeshes.push(instancedMesh);
160
- // instancedMesh.removeFromParent();
161
- this.viralViewerApi.viralScene.isolateModel.add(instancedMesh);
162
- //add to selectable list for ray cast purpose
163
- this.viralViewerApi.viralScene.selectables.push(instancedMesh);
164
- }
165
- }
166
- if (this.isolateMeshes.length > 0 ||
167
- this.isolateInstancedMeshes.length > 0) {
168
- //hide main model
169
- this.viralViewerApi.viralScene.mainModel.visible = false;
170
- this.viralViewerApi.viralRenderer.render();
171
- }
172
- }
173
- }
174
- exports.ViralVisibilityManager = ViralVisibilityManager;
175
- //# sourceMappingURL=viral-visibility-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"viral-visibility-manager.js","sourceRoot":"","sources":["../../../src/components/visibility-manager/viral-visibility-manager.ts"],"names":[],"mappings":";;;AAEA,6BAAoD;AAEpD,MAAa,sBAAsB;IACjC,YAAoB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QAElD,sBAAsB;QACf,gBAAW,GAAqB,EAAE,CAAC;QACnC,uBAAkB,GAA8B,IAAI,CAAC;QAe5D,YAAY;QAEZ,yBAAyB;QAClB,mBAAc,GAAqB,EAAE,CAAC;QACtC,4BAAuB,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AAM,EAC3C,KAAK,EAAE,EACP;gBACA,MAAM,aAAa,GAAG,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;gBAC1D,aAAa,CAAC,cAAc,EAAE,CAAC;gBAC/B,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBAChD,oCAAoC;gBACpC,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;gBAC/D,6CAA6C;gBAC7C,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aAChE;SACF;QAED,IACE,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC;YAC7B,IAAI,CAAC,sBAAsB,CAAC,MAAM,GAAG,CAAC,EACtC;YACA,iBAAiB;YACjB,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;YACzD,IAAI,CAAC,cAAe,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;SAC7C;IACH,CAAC;CACF;AAnMD,wDAmMC"}
@@ -1,68 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WorkerThreadPool = void 0;
4
- const worker_thread_1 = require("./worker-thread");
5
- class WorkerThreadPool {
6
- /**
7
- *
8
- * @param maxSize maximum number of worker
9
- * @param scriptPath javascript path for worker execute
10
- */
11
- constructor(maxSize, scriptPath) {
12
- this._workers = [];
13
- this.maximumNumberOfWorker = maxSize;
14
- this.scriptPath = scriptPath;
15
- // only have 1 workerthread from the begining, we will create more when we need it
16
- this._workers.push(new worker_thread_1.WorkerThread(scriptPath));
17
- this._free = [...this._workers];
18
- this._busy = {};
19
- this._queue = [];
20
- }
21
- get length() {
22
- return this._workers.length;
23
- }
24
- get busy() {
25
- return this._queue.length > 0 || Object.keys(this._busy).length > 0;
26
- }
27
- /**
28
- *
29
- * @param inputData Input data send to worker
30
- * @param resolve callback from worker
31
- */
32
- Enqueue(inputData, resolve) {
33
- this._queue.push([inputData, resolve]);
34
- this._PumpQueue();
35
- }
36
- _PumpQueue() {
37
- //only execute when have queue need to be action
38
- while (this._queue.length > 0) {
39
- //if we dont have any free worker and can create more, create more
40
- if (this._free.length == 0 &&
41
- this._workers.length < this.maximumNumberOfWorker) {
42
- const newWorker = new worker_thread_1.WorkerThread(this.scriptPath);
43
- this._workers.push(newWorker);
44
- this._free.push(newWorker);
45
- }
46
- //if still do not have any free worker, continue and execute later
47
- if (this._free.length == 0) {
48
- continue;
49
- }
50
- const w = this._free.pop();
51
- this._workers = this._workers.filter((x) => x._id !== w._id);
52
- this._busy[w.id] = w;
53
- const [inputData, workResolve] = this._queue.shift();
54
- w.postMessage(inputData, (v) => {
55
- delete this._busy[w.id];
56
- // mark this worker is free to use
57
- // this._free.push(w);
58
- workResolve(v);
59
- // call again
60
- this._PumpQueue();
61
- // terminate worker
62
- w.dispose();
63
- });
64
- }
65
- }
66
- }
67
- exports.WorkerThreadPool = WorkerThreadPool;
68
- //# sourceMappingURL=worker-pool.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker-pool.js","sourceRoot":"","sources":["../../../../src/components/worker/base/worker-pool.ts"],"names":[],"mappings":";;;AAAA,mDAA+C;AAE/C,MAAa,gBAAgB;IAQ3B;;;;OAIG;IACH,YAAY,OAAe,EAAE,UAAkB;QAVvC,aAAQ,GAAmB,EAAE,CAAC;QAWpC,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,kFAAkF;QAClF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,4BAAY,CAAC,UAAU,CAAC,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QACh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AI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;YACrB,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAG,CAAC;YACtD,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,CAAM,EAAE,EAAE;gBAClC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBACxB,kCAAkC;gBAClC,sBAAsB;gBACtB,WAAW,CAAC,CAAC,CAAC,CAAC;gBACf,aAAa;gBACb,IAAI,CAAC,UAAU,EAAE,CAAC;gBAClB,mBAAmB;gBACnB,CAAC,CAAC,OAAO,EAAE,CAAC;YACd,CAAC,CAAC,CAAC;SACJ;IACH,CAAC;CACF;AAxED,4CAwEC"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WorkerThread = void 0;
4
- let _IDs = 1;
5
- //this is wrapper class for worker, called workerthread
6
- class WorkerThread {
7
- constructor(s) {
8
- this._worker = new Worker(s);
9
- this._worker.onmessage = (e) => {
10
- this._OnMessage(e);
11
- };
12
- this._resolve = null;
13
- this._id = _IDs++;
14
- }
15
- _OnMessage(e) {
16
- const resolve = this._resolve;
17
- this._resolve = null;
18
- if (resolve) {
19
- resolve(e.data);
20
- }
21
- }
22
- get id() {
23
- return this._id;
24
- }
25
- postMessage(data, resolve) {
26
- this._resolve = resolve;
27
- this._worker.postMessage(data);
28
- }
29
- dispose() {
30
- //kill worker
31
- this._worker.terminate();
32
- }
33
- }
34
- exports.WorkerThread = WorkerThread;
35
- //# sourceMappingURL=worker-thread.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"worker-thread.js","sourceRoot":"","sources":["../../../../src/components/worker/base/worker-thread.ts"],"names":[],"mappings":";;;AAAA,IAAI,IAAI,GAAG,CAAC,CAAC;AAEb,uDAAuD;AACvD,MAAa,YAAY;IAKrB,YAAY,CAAS;QACjB,IAAI,CAAC,OAAO,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,EAAE;YAC3B,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC,CAAC;QACF,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,IAAI,EAAE,CAAC;IACtB,CAAC;IAEO,UAAU,CAAC,CAAe;QAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,OAAO,EAAE;YACT,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SACnB;IACL,CAAC;IAED,IAAW,EAAE;QACT,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAEM,WAAW,CAAC,IAAS,EAAE,OAA4B;QACtD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAEM,OAAO;QACV,aAAa;QACb,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IAC7B,CAAC;CACJ;AAnCD,oCAmCC"}