viral-viewer-2 6.2.1 → 6.2.4

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 (257) hide show
  1. package/README.md +0 -0
  2. package/dist/index.js +2 -21
  3. package/dist/index.js.LICENSE.txt +19 -0
  4. package/dist/threejs-addon/n8ao/post-processing.d.ts +109 -109
  5. package/package.json +6 -4
  6. package/dist/components/animation/viral-animation.js +0 -59
  7. package/dist/components/animation/viral-animation.js.map +0 -1
  8. package/dist/components/bvh/viral-bvh.js +0 -19
  9. package/dist/components/bvh/viral-bvh.js.map +0 -1
  10. package/dist/components/camera/viral-camera.js +0 -201
  11. package/dist/components/camera/viral-camera.js.map +0 -1
  12. package/dist/components/centralized-event-handler/viral-centralized-event-handler.d.ts +0 -7
  13. package/dist/components/centralized-event-handler/viral-centralized-event-handler.js +0 -47
  14. package/dist/components/centralized-event-handler/viral-centralized-event-handler.js.map +0 -1
  15. package/dist/components/compress/viral-compress.processor.js +0 -13
  16. package/dist/components/compress/viral-compress.processor.js.map +0 -1
  17. package/dist/components/context-menu/viral-context-menu.d.ts +0 -17
  18. package/dist/components/context-menu/viral-context-menu.js +0 -74
  19. package/dist/components/context-menu/viral-context-menu.js.map +0 -1
  20. package/dist/components/custom-objects/index.js +0 -6
  21. package/dist/components/custom-objects/index.js.map +0 -1
  22. package/dist/components/custom-objects/viral-instanced-mesh.js +0 -200
  23. package/dist/components/custom-objects/viral-instanced-mesh.js.map +0 -1
  24. package/dist/components/data-manager/viral-data-manager.js +0 -35
  25. package/dist/components/data-manager/viral-data-manager.js.map +0 -1
  26. package/dist/components/event-handler/base/event-dispatcher.js +0 -35
  27. package/dist/components/event-handler/base/event-dispatcher.js.map +0 -1
  28. package/dist/components/event-handler/keyboard/viral-keyboard.js +0 -76
  29. package/dist/components/event-handler/keyboard/viral-keyboard.js.map +0 -1
  30. package/dist/components/event-handler/mouse/viral-mouse.js +0 -234
  31. package/dist/components/event-handler/mouse/viral-mouse.js.map +0 -1
  32. package/dist/components/event-handler/viral-centralized-event-handler.js +0 -158
  33. package/dist/components/event-handler/viral-centralized-event-handler.js.map +0 -1
  34. package/dist/components/event-handler/viral-lifecycle-event-handler.js +0 -55
  35. package/dist/components/event-handler/viral-lifecycle-event-handler.js.map +0 -1
  36. package/dist/components/keyboard/viral-keyboard.d.ts +0 -17
  37. package/dist/components/keyboard/viral-keyboard.js +0 -76
  38. package/dist/components/keyboard/viral-keyboard.js.map +0 -1
  39. package/dist/components/loader/viral-point-cloud.loader.js +0 -33
  40. package/dist/components/loader/viral-point-cloud.loader.js.map +0 -1
  41. package/dist/components/loader/viral-revit.loader.js +0 -119
  42. package/dist/components/loader/viral-revit.loader.js.map +0 -1
  43. package/dist/components/loader/viral-three.loader.js +0 -20
  44. package/dist/components/loader/viral-three.loader.js.map +0 -1
  45. package/dist/components/loader/viral.loader.js +0 -16
  46. package/dist/components/loader/viral.loader.js.map +0 -1
  47. package/dist/components/material/viral-material-manager.js +0 -60
  48. package/dist/components/material/viral-material-manager.js.map +0 -1
  49. package/dist/components/mouse/viral-mouse.d.ts +0 -31
  50. package/dist/components/mouse/viral-mouse.js +0 -234
  51. package/dist/components/mouse/viral-mouse.js.map +0 -1
  52. package/dist/components/navigation-cube/components/cube-camera.d.ts +0 -15
  53. package/dist/components/navigation-cube/components/cube-camera.js +0 -74
  54. package/dist/components/navigation-cube/components/cube-camera.js.map +0 -1
  55. package/dist/components/navigation-cube/components/cube-renderer.d.ts +0 -9
  56. package/dist/components/navigation-cube/components/cube-renderer.js +0 -31
  57. package/dist/components/navigation-cube/components/cube-renderer.js.map +0 -1
  58. package/dist/components/navigation-cube/components/cube-scene.d.ts +0 -13
  59. package/dist/components/navigation-cube/components/cube-scene.js +0 -546
  60. package/dist/components/navigation-cube/components/cube-scene.js.map +0 -1
  61. package/dist/components/navigation-cube/components/cube.mouse.d.ts +0 -9
  62. package/dist/components/navigation-cube/components/cube.mouse.js +0 -109
  63. package/dist/components/navigation-cube/components/cube.mouse.js.map +0 -1
  64. package/dist/components/navigation-cube/viral-navigation-cube.d.ts +0 -16
  65. package/dist/components/navigation-cube/viral-navigation-cube.js +0 -50
  66. package/dist/components/navigation-cube/viral-navigation-cube.js.map +0 -1
  67. package/dist/components/post-processing/ambient-occlusion-effect.d.ts +0 -11
  68. package/dist/components/post-processing/ambient-occlusion-effect.js +0 -32
  69. package/dist/components/post-processing/ambient-occlusion-effect.js.map +0 -1
  70. package/dist/components/post-processing/bloom-effect.d.ts +0 -11
  71. package/dist/components/post-processing/bloom-effect.js +0 -29
  72. package/dist/components/post-processing/bloom-effect.js.map +0 -1
  73. package/dist/components/post-processing/outline-effect.d.ts +0 -13
  74. package/dist/components/post-processing/outline-effect.js +0 -33
  75. package/dist/components/post-processing/outline-effect.js.map +0 -1
  76. package/dist/components/post-processing/post-processing-renderer.js +0 -46
  77. package/dist/components/post-processing/post-processing-renderer.js.map +0 -1
  78. package/dist/components/post-processing/viral-post-processing.d.ts +0 -11
  79. package/dist/components/post-processing/viral-post-processing.js +0 -29
  80. package/dist/components/post-processing/viral-post-processing.js.map +0 -1
  81. package/dist/components/renderer/viral-renderer.js +0 -51
  82. package/dist/components/renderer/viral-renderer.js.map +0 -1
  83. package/dist/components/scene/viral-scene.js +0 -129
  84. package/dist/components/scene/viral-scene.js.map +0 -1
  85. package/dist/components/spinner/viral-spinner.d.ts +0 -10
  86. package/dist/components/spinner/viral-spinner.js +0 -207
  87. package/dist/components/spinner/viral-spinner.js.map +0 -1
  88. package/dist/components/stats/viral-stats.js +0 -17
  89. package/dist/components/stats/viral-stats.js.map +0 -1
  90. package/dist/components/tools/tools/viral-tool-ambient-occlusion.d.ts +0 -7
  91. package/dist/components/tools/tools/viral-tool-ambient-occlusion.js +0 -16
  92. package/dist/components/tools/tools/viral-tool-ambient-occlusion.js.map +0 -1
  93. package/dist/components/tools/tools/viral-tool-dark-mode.d.ts +0 -7
  94. package/dist/components/tools/tools/viral-tool-dark-mode.js +0 -21
  95. package/dist/components/tools/tools/viral-tool-dark-mode.js.map +0 -1
  96. package/dist/components/tools/tools/viral-tool-elevation.d.ts +0 -11
  97. package/dist/components/tools/tools/viral-tool-elevation.js +0 -30
  98. package/dist/components/tools/tools/viral-tool-elevation.js.map +0 -1
  99. package/dist/components/tools/tools/viral-tool-measure.d.ts +0 -33
  100. package/dist/components/tools/tools/viral-tool-measure.js +0 -243
  101. package/dist/components/tools/tools/viral-tool-measure.js.map +0 -1
  102. package/dist/components/tools/tools/viral-tool-sunlight.d.ts +0 -7
  103. package/dist/components/tools/tools/viral-tool-sunlight.js +0 -46
  104. package/dist/components/tools/tools/viral-tool-sunlight.js.map +0 -1
  105. package/dist/components/tools/viral-tools.d.ts +0 -32
  106. package/dist/components/tools/viral-tools.js +0 -213
  107. package/dist/components/tools/viral-tools.js.map +0 -1
  108. package/dist/components/visibility-manager/viral-visibility-manager.js +0 -168
  109. package/dist/components/visibility-manager/viral-visibility-manager.js.map +0 -1
  110. package/dist/components/worker/base/worker-pool.js +0 -68
  111. package/dist/components/worker/base/worker-pool.js.map +0 -1
  112. package/dist/components/worker/base/worker-thread.js +0 -35
  113. package/dist/components/worker/base/worker-thread.js.map +0 -1
  114. package/dist/components/worker/fetch-data.worker.js +0 -31
  115. package/dist/components/worker/fetch-data.worker.js.map +0 -1
  116. package/dist/components/worker/viral-viewer-2.worker.js +0 -127
  117. package/dist/components/worker/viral-viewer-2.worker.js.map +0 -1
  118. package/dist/components/worker/viral-viewer-3.worker.js +0 -82
  119. package/dist/components/worker/viral-viewer-3.worker.js.map +0 -1
  120. package/dist/components/worker/viral-viewer-4.worker.js +0 -97
  121. package/dist/components/worker/viral-viewer-4.worker.js.map +0 -1
  122. package/dist/components/worker/viral-viewer.worker.js +0 -107
  123. package/dist/components/worker/viral-viewer.worker.js.map +0 -1
  124. package/dist/components/worker-script/fetch-data-worker.script.js +0 -56
  125. package/dist/components/worker-script/fetch-data-worker.script.js.map +0 -1
  126. package/dist/components/worker-script/load-model-worker-2.script.js +0 -2704
  127. package/dist/components/worker-script/load-model-worker-2.script.js.map +0 -1
  128. package/dist/components/worker-script/load-model-worker-3.script.js +0 -34170
  129. package/dist/components/worker-script/load-model-worker-3.script.js.map +0 -1
  130. package/dist/components/worker-script/load-model-worker.script.js +0 -148
  131. package/dist/components/worker-script/load-model-worker.script.js.map +0 -1
  132. package/dist/components/worker-script/threejs.types.js +0 -34162
  133. package/dist/components/worker-script/threejs.types.js.map +0 -1
  134. package/dist/const/colors.js +0 -38
  135. package/dist/const/colors.js.map +0 -1
  136. package/dist/const/fonts.js +0 -17
  137. package/dist/const/fonts.js.map +0 -1
  138. package/dist/gui/context-menu/viral-context-menu.js +0 -74
  139. package/dist/gui/context-menu/viral-context-menu.js.map +0 -1
  140. package/dist/gui/draggable-modal/viral-draggable-modal.js +0 -91
  141. package/dist/gui/draggable-modal/viral-draggable-modal.js.map +0 -1
  142. package/dist/gui/fonts/fonts.js +0 -20
  143. package/dist/gui/fonts/fonts.js.map +0 -1
  144. package/dist/gui/navigation-cube/components/cube-camera.js +0 -74
  145. package/dist/gui/navigation-cube/components/cube-camera.js.map +0 -1
  146. package/dist/gui/navigation-cube/components/cube-renderer.js +0 -31
  147. package/dist/gui/navigation-cube/components/cube-renderer.js.map +0 -1
  148. package/dist/gui/navigation-cube/components/cube-scene.js +0 -546
  149. package/dist/gui/navigation-cube/components/cube-scene.js.map +0 -1
  150. package/dist/gui/navigation-cube/components/cube.mouse.js +0 -109
  151. package/dist/gui/navigation-cube/components/cube.mouse.js.map +0 -1
  152. package/dist/gui/navigation-cube/viral-navigation-cube.js +0 -50
  153. package/dist/gui/navigation-cube/viral-navigation-cube.js.map +0 -1
  154. package/dist/gui/spinner/viral-spinner.js +0 -102
  155. package/dist/gui/spinner/viral-spinner.js.map +0 -1
  156. package/dist/gui/tools/tools/viral-tool-ambient-occlusion.js +0 -16
  157. package/dist/gui/tools/tools/viral-tool-ambient-occlusion.js.map +0 -1
  158. package/dist/gui/tools/tools/viral-tool-dark-mode.js +0 -21
  159. package/dist/gui/tools/tools/viral-tool-dark-mode.js.map +0 -1
  160. package/dist/gui/tools/tools/viral-tool-elevation.js +0 -30
  161. package/dist/gui/tools/tools/viral-tool-elevation.js.map +0 -1
  162. package/dist/gui/tools/tools/viral-tool-measure.js +0 -243
  163. package/dist/gui/tools/tools/viral-tool-measure.js.map +0 -1
  164. package/dist/gui/tools/tools/viral-tool-sunlight.js +0 -46
  165. package/dist/gui/tools/tools/viral-tool-sunlight.js.map +0 -1
  166. package/dist/gui/tools/viral-tools.js +0 -213
  167. package/dist/gui/tools/viral-tools.js.map +0 -1
  168. package/dist/index.js.map +0 -1
  169. package/dist/models/dictionary.model.d.ts +0 -0
  170. package/dist/models/dictionary.model.js +0 -1
  171. package/dist/models/dictionary.model.js.map +0 -1
  172. package/dist/services/local-storage.service.js +0 -57
  173. package/dist/services/local-storage.service.js.map +0 -1
  174. package/dist/threejs-addon/buffer-geometry-utils.d.ts +0 -64
  175. package/dist/threejs-addon/buffer-geometry-utils.js +0 -807
  176. package/dist/threejs-addon/buffer-geometry-utils.js.map +0 -1
  177. package/dist/threejs-addon/gltf-loader.d.ts +0 -17
  178. package/dist/threejs-addon/gltf-loader.js +0 -2796
  179. package/dist/threejs-addon/gltf-loader.js.map +0 -1
  180. package/dist/threejs-addon/n8ao/n8ao.js +0 -1952
  181. package/dist/threejs-addon/n8ao/n8ao.js.map +0 -1
  182. package/dist/threejs-addon/n8ao/post-processing.js +0 -15145
  183. package/dist/threejs-addon/n8ao/post-processing.js.map +0 -1
  184. package/dist/threejs-addon/post-processing/effect-composer.d.ts +0 -27
  185. package/dist/threejs-addon/post-processing/effect-composer.js +0 -134
  186. package/dist/threejs-addon/post-processing/effect-composer.js.map +0 -1
  187. package/dist/threejs-addon/post-processing/mask-pass.d.ts +0 -11
  188. package/dist/threejs-addon/post-processing/mask-pass.js +0 -69
  189. package/dist/threejs-addon/post-processing/mask-pass.js.map +0 -1
  190. package/dist/threejs-addon/post-processing/outline-pass.d.ts +0 -58
  191. package/dist/threejs-addon/post-processing/outline-pass.js +0 -484
  192. package/dist/threejs-addon/post-processing/outline-pass.js.map +0 -1
  193. package/dist/threejs-addon/post-processing/output-pass.d.ts +0 -11
  194. package/dist/threejs-addon/post-processing/output-pass.js +0 -61
  195. package/dist/threejs-addon/post-processing/output-pass.js.map +0 -1
  196. package/dist/threejs-addon/post-processing/pass.d.ts +0 -20
  197. package/dist/threejs-addon/post-processing/pass.js +0 -48
  198. package/dist/threejs-addon/post-processing/pass.js.map +0 -1
  199. package/dist/threejs-addon/post-processing/render-pass.d.ts +0 -13
  200. package/dist/threejs-addon/post-processing/render-pass.js +0 -50
  201. package/dist/threejs-addon/post-processing/render-pass.js.map +0 -1
  202. package/dist/threejs-addon/post-processing/sao-pass.d.ts +0 -62
  203. package/dist/threejs-addon/post-processing/sao-pass.js +0 -296
  204. package/dist/threejs-addon/post-processing/sao-pass.js.map +0 -1
  205. package/dist/threejs-addon/post-processing/shader-pass.d.ts +0 -11
  206. package/dist/threejs-addon/post-processing/shader-pass.js +0 -48
  207. package/dist/threejs-addon/post-processing/shader-pass.js.map +0 -1
  208. package/dist/threejs-addon/post-processing/ssaa-render-pass.d.ts +0 -30
  209. package/dist/threejs-addon/post-processing/ssaa-render-pass.js +0 -202
  210. package/dist/threejs-addon/post-processing/ssaa-render-pass.js.map +0 -1
  211. package/dist/threejs-addon/post-processing/unreal-bloom-pass.d.ts +0 -48
  212. package/dist/threejs-addon/post-processing/unreal-bloom-pass.js +0 -290
  213. package/dist/threejs-addon/post-processing/unreal-bloom-pass.js.map +0 -1
  214. package/dist/threejs-addon/shaders/color-correction-shader.d.ts +0 -22
  215. package/dist/threejs-addon/shaders/color-correction-shader.js +0 -43
  216. package/dist/threejs-addon/shaders/color-correction-shader.js.map +0 -1
  217. package/dist/threejs-addon/shaders/copy-shader.d.ts +0 -13
  218. package/dist/threejs-addon/shaders/copy-shader.js +0 -39
  219. package/dist/threejs-addon/shaders/copy-shader.js.map +0 -1
  220. package/dist/threejs-addon/shaders/depth-limited-blur-shader.d.ts +0 -48
  221. package/dist/threejs-addon/shaders/depth-limited-blur-shader.js +0 -142
  222. package/dist/threejs-addon/shaders/depth-limited-blur-shader.js.map +0 -1
  223. package/dist/threejs-addon/shaders/fxaa-shader.d.ts +0 -14
  224. package/dist/threejs-addon/shaders/fxaa-shader.js +0 -279
  225. package/dist/threejs-addon/shaders/fxaa-shader.js.map +0 -1
  226. package/dist/threejs-addon/shaders/luminosity-high-pass-shader.d.ts +0 -27
  227. package/dist/threejs-addon/shaders/luminosity-high-pass-shader.js +0 -56
  228. package/dist/threejs-addon/shaders/luminosity-high-pass-shader.js.map +0 -1
  229. package/dist/threejs-addon/shaders/output-shader.d.ts +0 -13
  230. package/dist/threejs-addon/shaders/output-shader.js +0 -72
  231. package/dist/threejs-addon/shaders/output-shader.js.map +0 -1
  232. package/dist/threejs-addon/shaders/sao-shader.d.ts +0 -71
  233. package/dist/threejs-addon/shaders/sao-shader.js +0 -180
  234. package/dist/threejs-addon/shaders/sao-shader.js.map +0 -1
  235. package/dist/threejs-addon/shaders/unpack-depth-rgba-shader.d.ts +0 -13
  236. package/dist/threejs-addon/shaders/unpack-depth-rgba-shader.js +0 -41
  237. package/dist/threejs-addon/shaders/unpack-depth-rgba-shader.js.map +0 -1
  238. package/dist/threejs-addon/simplify-modifier.d.ts +0 -4
  239. package/dist/threejs-addon/simplify-modifier.js +0 -325
  240. package/dist/threejs-addon/simplify-modifier.js.map +0 -1
  241. package/dist/threejs-addon/stats.js +0 -102
  242. package/dist/threejs-addon/stats.js.map +0 -1
  243. package/dist/threejs-addon/transform-control.d.ts +0 -74
  244. package/dist/threejs-addon/transform-control.js +0 -1033
  245. package/dist/threejs-addon/transform-control.js.map +0 -1
  246. package/dist/types.js +0 -145
  247. package/dist/types.js.map +0 -1
  248. package/dist/utils/html.js +0 -12
  249. package/dist/utils/html.js.map +0 -1
  250. package/dist/utils/index.js +0 -10
  251. package/dist/utils/index.js.map +0 -1
  252. package/dist/utils/log.js +0 -14
  253. package/dist/utils/log.js.map +0 -1
  254. package/dist/utils/threejs.js +0 -44
  255. package/dist/utils/threejs.js.map +0 -1
  256. package/dist/viral-viewer-api.js +0 -73
  257. package/dist/viral-viewer-api.js.map +0 -1
@@ -1,243 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ViralToolMeasure = void 0;
4
- const three_1 = require("three");
5
- const colors_1 = require("../../../const/colors");
6
- const __1 = require("../../..");
7
- class ViralToolMeasure {
8
- constructor(viralTools) {
9
- this.viralTools = viralTools;
10
- this.viralToolMeasureScene = new three_1.Scene();
11
- this.isActivated = false;
12
- this.measures = [];
13
- this.point1 = null;
14
- this.point2 = null;
15
- this.tempPoint2 = null;
16
- this.defaultSprite = this.makeSprite();
17
- this.measureObject = new three_1.Mesh();
18
- this.tempMeasure = new three_1.Mesh();
19
- this.tempSprite1 = null;
20
- this.tempLine = null;
21
- this.tempSprite2 = null;
22
- }
23
- activate(input) {
24
- this.isActivated = input.activate;
25
- if (!this.isActivated) {
26
- this.dispose();
27
- }
28
- else {
29
- if (!this.viralToolMeasureScene.getObjectByName('measure-object')) {
30
- this.measureObject.name = 'measure-object';
31
- this.viralToolMeasureScene.add(this.measureObject);
32
- }
33
- if (!this.viralToolMeasureScene.getObjectByName('temp-measure')) {
34
- this.tempMeasure.name = 'temp-measure';
35
- this.viralToolMeasureScene.add(this.tempMeasure);
36
- }
37
- }
38
- }
39
- onMouseMove(mousePoint) {
40
- if (mousePoint) {
41
- let result = this.viralTools.viralViewerApi.viralCamera.clientToWorld();
42
- if (result && result.length > 0) {
43
- let coordinate = result[0].point;
44
- if (this.point1 && !this.point2) {
45
- this.tempPoint2 = coordinate;
46
- //sprite 1
47
- if (!this.tempSprite1) {
48
- this.tempSprite1 = this.defaultSprite.clone();
49
- this.tempSprite1.position.copy(this.point1);
50
- this.tempMeasure.add(this.tempSprite1);
51
- }
52
- else {
53
- this.tempSprite1.position.copy(this.point1);
54
- }
55
- //sprite 2
56
- if (!this.tempSprite2) {
57
- this.tempSprite2 = this.defaultSprite.clone();
58
- this.tempSprite2.position.copy(this.tempPoint2);
59
- this.tempMeasure.add(this.tempSprite2);
60
- }
61
- else {
62
- this.tempSprite2.position.copy(this.tempPoint2);
63
- }
64
- //line
65
- if (!this.tempLine) {
66
- this.tempLine = this.makeLine(this.point1, this.tempPoint2);
67
- this.tempMeasure.add(this.tempLine);
68
- }
69
- else {
70
- // this.tempLine = this.makeLine(this.point1, this.tempPoint2);
71
- // this.tempLine.matrixWorldNeedsUpdate = true;
72
- const positions = this.tempLine.geometry.attributes.position;
73
- positions.setXYZ(0, this.point1.x, this.point1.y, this.point1.z);
74
- positions.setXYZ(1, this.tempPoint2.x, this.tempPoint2.y, this.tempPoint2.z);
75
- positions.needsUpdate = true;
76
- }
77
- //distance sprite
78
- // let distanceSprite = this.makeDistanceSprite(this.point1, this.tempPoint2);
79
- // this.tempMeasure.add(distanceSprite);
80
- //rerender
81
- this.viralTools.viralViewerApi.viralRenderer.render();
82
- }
83
- }
84
- }
85
- }
86
- onMouseClick(mousePoint) {
87
- if (mousePoint) {
88
- let result = this.viralTools.viralViewerApi.viralCamera.clientToWorld();
89
- if (result && result.length > 0) {
90
- let coordinate = result[0].point;
91
- if (!this.point1 && !this.point2) {
92
- this.point1 = coordinate;
93
- let sprite1 = this.defaultSprite.clone();
94
- sprite1.position.copy(this.point1);
95
- this.tempMeasure.add(sprite1);
96
- }
97
- else if (this.point1 && !this.point2) {
98
- this.point2 = coordinate;
99
- __1.THREEUtil.clearChildren(this.tempMeasure);
100
- //sprite 1
101
- let sprite1 = this.defaultSprite.clone();
102
- sprite1.position.copy(this.point1);
103
- this.measureObject.add(sprite1);
104
- //sprite 2
105
- let sprite2 = this.defaultSprite.clone();
106
- sprite2.position.copy(this.point2);
107
- this.measureObject.add(sprite2);
108
- //line
109
- let line = this.makeLine(this.point1, this.point2);
110
- this.measureObject.add(line);
111
- //distance sprite
112
- let distanceSprite = this.makeDistanceSprite(this.point1, this.point2);
113
- this.measureObject.add(distanceSprite);
114
- //rerender
115
- this.viralTools.viralViewerApi.viralRenderer.render();
116
- }
117
- else if (this.point1 && this.point2) {
118
- this.resetPickedPoints();
119
- this.point1 = coordinate;
120
- let sprite1 = this.defaultSprite.clone();
121
- sprite1.position.copy(this.point1);
122
- this.tempMeasure.add(sprite1);
123
- }
124
- }
125
- }
126
- }
127
- resetPickedPoints() {
128
- this.point1 = null;
129
- this.point2 = null;
130
- }
131
- makeSprite() {
132
- function makeCircleImage() {
133
- let canvas = document.createElement('canvas');
134
- let ctx = canvas.getContext('2d');
135
- let size = 32;
136
- canvas.width = size;
137
- canvas.height = size;
138
- let r = size * 0.8 / 2;
139
- let blur = size - r;
140
- if (ctx) {
141
- ctx.shadowBlur = 5;
142
- ctx.shadowColor = '#555';
143
- ctx.fillStyle = '#fff';
144
- ctx.beginPath();
145
- ctx.arc(size / 2, size / 2, r, 0, Math.PI * 2);
146
- ctx.closePath();
147
- ctx.fill();
148
- ctx.shadowBlur = 0;
149
- ctx.fillStyle = colors_1.LightTheme.primary;
150
- ctx.beginPath();
151
- ctx.arc(size / 2, size / 2, r * 0.5, 0, Math.PI * 2);
152
- ctx.closePath();
153
- ctx.fill();
154
- }
155
- return canvas;
156
- }
157
- let circleTexture = new three_1.CanvasTexture(makeCircleImage());
158
- let circleMaterial = new three_1.SpriteMaterial({
159
- map: circleTexture,
160
- sizeAttenuation: false,
161
- });
162
- let circleSprite = new three_1.Sprite(circleMaterial);
163
- circleSprite.scale.setScalar(0.08);
164
- return circleSprite;
165
- }
166
- makeLine(position1, position2) {
167
- let lineMaterial = new three_1.LineBasicMaterial({
168
- color: __1.THREEUtil.hexToThreejsColor(colors_1.LightTheme.primary),
169
- linewidth: 20,
170
- });
171
- const points = [position1, position2];
172
- const geometry = new three_1.BufferGeometry().setFromPoints(points);
173
- let line = new three_1.Line(geometry, lineMaterial);
174
- return line;
175
- }
176
- makeDistanceSprite(position1, position2) {
177
- function roundRect(ctx, x, y, w, h, r) {
178
- ctx.beginPath();
179
- ctx.moveTo(x + r, y);
180
- ctx.lineTo(x + w - r, y);
181
- ctx.quadraticCurveTo(x + w, y, x + w, y + r);
182
- ctx.lineTo(x + w, y + h - r);
183
- ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
184
- ctx.lineTo(x + r, y + h);
185
- ctx.quadraticCurveTo(x, y + h, x, y + h - r);
186
- ctx.lineTo(x, y + r);
187
- ctx.quadraticCurveTo(x, y, x + r, y);
188
- ctx.closePath();
189
- ctx.fill();
190
- }
191
- let canvas = document.createElement('canvas');
192
- let ctx = canvas.getContext('2d');
193
- let fontsize = 32;
194
- if (ctx) {
195
- ctx.font = 'bolder ' + fontsize + 'px "Open Sans", Arial';
196
- let length = Math.round(position1.distanceTo(position2));
197
- let text = '~ ' + length;
198
- let size = ctx.measureText(text);
199
- let paddingLeft = 20;
200
- let paddingTop = 10;
201
- let margin = 10;
202
- canvas.width = size.width + paddingLeft * 2 + margin * 2;
203
- canvas.height = fontsize + paddingTop * 2 + margin * 2;
204
- ctx.shadowBlur = 10;
205
- ctx.shadowColor = '#555';
206
- ctx.fillStyle = colors_1.LightTheme.primary;
207
- roundRect(ctx, margin, margin, canvas.width - margin * 2, canvas.height - margin * 2, 10);
208
- ctx.shadowBlur = 0;
209
- ctx.fillStyle = '#fff';
210
- ctx.textAlign = 'left';
211
- ctx.textBaseline = 'top';
212
- ctx.font = 'bolder ' + fontsize + 'px "Open Sans", Arial';
213
- ctx.fillText(text, paddingLeft + margin, paddingTop + margin);
214
- }
215
- let texture = new three_1.CanvasTexture(canvas);
216
- let sprite = new three_1.Sprite(new three_1.SpriteMaterial({
217
- map: texture,
218
- sizeAttenuation: false,
219
- }));
220
- sprite.scale.set(0.002 * canvas.width * 0.5, 0.0025 * canvas.height * 0.5, 1);
221
- let positionPoint = __1.THREEUtil.middlePoint(position1, position2);
222
- sprite.position.copy(positionPoint);
223
- return sprite;
224
- }
225
- dispose() {
226
- this.resetPickedPoints();
227
- __1.THREEUtil.clearChildren(this.measureObject);
228
- __1.THREEUtil.clearChildren(this.tempMeasure);
229
- this.viralTools.viralViewerApi.viralRenderer.render();
230
- }
231
- onKeyPress(evt) {
232
- if (evt.code == "Escape") {
233
- __1.THREEUtil.clearChildren(this.tempMeasure);
234
- this.point1 = null;
235
- this.point2 = null;
236
- this.tempPoint2 = null;
237
- //rerender
238
- this.viralTools.viralViewerApi.viralRenderer.render();
239
- }
240
- }
241
- }
242
- exports.ViralToolMeasure = ViralToolMeasure;
243
- //# sourceMappingURL=viral-tool-measure.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"viral-tool-measure.js","sourceRoot":"","sources":["../../../../src/components/tools/tools/viral-tool-measure.ts"],"names":[],"mappings":";;;AAAA,iCAAgJ;AAGhJ,kDAAmD;AACnD,gCAAqC;AAKrC,MAAa,gBAAgB;IAezB,YAAmB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAdlC,0BAAqB,GAAG,IAAI,aAAK,EAAE,CAAC;QACpC,gBAAW,GAAG,KAAK,CAAC;QACpB,aAAQ,GAAmB,EAAE,CAAC;QAC7B,WAAM,GAAmB,IAAI,CAAC;QAC9B,WAAM,GAAmB,IAAI,CAAC;QAC9B,eAAU,GAAmB,IAAI,CAAC;QAElC,kBAAa,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,kBAAa,GAAG,IAAI,YAAI,EAAE,CAAC;QAC3B,gBAAW,GAAG,IAAI,YAAI,EAAE,CAAC;QAEzB,gBAAW,GAAkB,IAAI,CAAC;QAClC,aAAQ,GAAgB,IAAI,CAAC;QAC7B,gBAAW,GAAkB,IAAI,CAAC;IAI1C,CAAC;IACM,QAAQ,CAAC,KAAsB;QAClC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAA;QACjC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACnB,IAAI,CAAC,OA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E,CAAC;QACzB,aAAS,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5C,aAAS,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1C,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC;IAEM,UAAU,CAAC,GAAkB;QAChC,IAAI,GAAG,CAAC,IAAI,IAAI,QAAQ,EAAE;YACtB,aAAS,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC1C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,UAAU;YACV,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;SACzD;IACL,CAAC;CAGJ;AAzQD,4CAyQC"}
@@ -1,7 +0,0 @@
1
- import { ViralViewerTool } from "../../../types";
2
- import { ViralTools } from "../viral-tools";
3
- export declare class ViralToolSunlight {
4
- viralTools: ViralTools;
5
- constructor(viralTools: ViralTools);
6
- activate(input: ViralViewerTool): void;
7
- }
@@ -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,C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CAAC,CAAC;wBACxC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;qBACvE;oBACD,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;iBACvD;gBACD,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;aACnE;iBAAM;gBACL,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;gBACzB,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,CAAC,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;AAClE,mEAA8D;AAC9D,qEAAgE;AAEhE,MAAa,UAAU;IAkGrB,YAAmB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;QA5F1C,UAAK,GAAG;YACb;gBACE,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE;oBACL;wBACE,GAAG,EAAE,cAAc,mBAAU,CAAC,OAAO,8PAA8P;wBACnS,KAAK,EAAE,CAAC;wBACR,QAAQ,EAAE,IAAI;wBACd,eAAe,EAAE,KAAK;wBACtB,IAAI,EAAE,OAAO;wBACb,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;qBACjB;oBACD;wBACE,GAAG,EAAE,cAAc,mBAAU,CAAC,OAAO,20BAA20B;wBACh3B,KAAK,EAAE,CAAC;wBACR,QAAQ,EAAE,KAAK;wBACf,eAAe,EAAE,KAAK;wBACtB,IAAI,EAAE,cAAc;wBACpB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;qBACjB;iBACF;aACF;YACD;gBACE,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE;oBACL;wBACE,GAAG,EAAE,cAAc,mBAAU,CAAC,OAAO,qZAAqZ;wBAC1b,KAAK,EAAE,CAAC;wBACR,QAAQ,EAAE,KAAK;wBACf,eAAe,EAAE,KAAK;wBACtB,IAAI,EAA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