@sapui5/sap.ui.vk 1.139.0 → 1.141.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/package.json +1 -1
  2. package/src/sap/ui/vk/.library +1 -1
  3. package/src/sap/ui/vk/AnimationPlayback.js +1 -1
  4. package/src/sap/ui/vk/AnimationPlayer.js +1 -1
  5. package/src/sap/ui/vk/AnimationSequence.js +1 -1
  6. package/src/sap/ui/vk/AnimationTimeSlider.js +1 -1
  7. package/src/sap/ui/vk/AnimationTrack.js +1 -1
  8. package/src/sap/ui/vk/Annotation.js +3 -3
  9. package/src/sap/ui/vk/BaseNodeProxy.js +1 -1
  10. package/src/sap/ui/vk/Camera.js +1 -1
  11. package/src/sap/ui/vk/ContentConnector.js +1 -1
  12. package/src/sap/ui/vk/ContentManager.js +1 -1
  13. package/src/sap/ui/vk/ContentResource.js +1 -1
  14. package/src/sap/ui/vk/Core.js +1 -1
  15. package/src/sap/ui/vk/DownloadManager.js +1 -1
  16. package/src/sap/ui/vk/DrawerToolbar.js +1 -1
  17. package/src/sap/ui/vk/DvlException.js +1 -1
  18. package/src/sap/ui/vk/FlexibleControl.js +1 -1
  19. package/src/sap/ui/vk/FlexibleControlLayoutData.js +1 -1
  20. package/src/sap/ui/vk/Highlight.js +1 -1
  21. package/src/sap/ui/vk/ImageContentManager.js +1 -1
  22. package/src/sap/ui/vk/JointUtils.js +1 -1
  23. package/src/sap/ui/vk/LayerProxy.js +1 -1
  24. package/src/sap/ui/vk/Loco.js +1 -1
  25. package/src/sap/ui/vk/Material.js +1 -1
  26. package/src/sap/ui/vk/NativeViewport.js +1 -1
  27. package/src/sap/ui/vk/NodeContentType.js +6 -1
  28. package/src/sap/ui/vk/NodeHierarchy.js +1 -1
  29. package/src/sap/ui/vk/NodeProxy.js +1 -1
  30. package/src/sap/ui/vk/NodeUtils.js +1 -1
  31. package/src/sap/ui/vk/Notifications.js +1 -1
  32. package/src/sap/ui/vk/ObjectType.js +2 -1
  33. package/src/sap/ui/vk/OrthographicCamera.js +1 -1
  34. package/src/sap/ui/vk/PerspectiveCamera.js +1 -1
  35. package/src/sap/ui/vk/ProgressIndicator.js +1 -1
  36. package/src/sap/ui/vk/RedlineCollaboration.js +1 -1
  37. package/src/sap/ui/vk/RedlineConversation.js +1 -1
  38. package/src/sap/ui/vk/RedlineDesign.js +1 -1
  39. package/src/sap/ui/vk/RedlineElement.js +1 -1
  40. package/src/sap/ui/vk/RedlineElementComment.js +1 -1
  41. package/src/sap/ui/vk/RedlineElementEllipse.js +1 -1
  42. package/src/sap/ui/vk/RedlineElementFreehand.js +1 -1
  43. package/src/sap/ui/vk/RedlineElementLine.js +1 -1
  44. package/src/sap/ui/vk/RedlineElementRectangle.js +1 -1
  45. package/src/sap/ui/vk/RedlineElementText.js +1 -1
  46. package/src/sap/ui/vk/RedlineSurface.js +1 -1
  47. package/src/sap/ui/vk/SafeArea.js +1 -1
  48. package/src/sap/ui/vk/Scene.js +1 -1
  49. package/src/sap/ui/vk/SceneTree.js +1 -1
  50. package/src/sap/ui/vk/StepNavigation.js +1 -1
  51. package/src/sap/ui/vk/Texture.js +1 -1
  52. package/src/sap/ui/vk/ToggleMenuButton.js +1 -1
  53. package/src/sap/ui/vk/ToggleMenuItem.js +1 -1
  54. package/src/sap/ui/vk/Toolbar.js +1 -1
  55. package/src/sap/ui/vk/View.js +1 -1
  56. package/src/sap/ui/vk/ViewGallery.js +1 -1
  57. package/src/sap/ui/vk/ViewGalleryThumbnail.js +1 -1
  58. package/src/sap/ui/vk/ViewGroup.js +1 -1
  59. package/src/sap/ui/vk/ViewManager.js +1 -1
  60. package/src/sap/ui/vk/ViewStateManager.js +1 -1
  61. package/src/sap/ui/vk/ViewStateManagerBase.js +1 -1
  62. package/src/sap/ui/vk/Viewer.js +12 -2
  63. package/src/sap/ui/vk/Viewport.js +43 -1
  64. package/src/sap/ui/vk/ViewportBase.js +24 -1
  65. package/src/sap/ui/vk/dvl/BaseNodeProxy.js +1 -1
  66. package/src/sap/ui/vk/dvl/ContentManager.js +1 -1
  67. package/src/sap/ui/vk/dvl/GraphicsCore.js +1 -1
  68. package/src/sap/ui/vk/dvl/LayerProxy.js +1 -1
  69. package/src/sap/ui/vk/dvl/NodeHierarchy.js +1 -1
  70. package/src/sap/ui/vk/dvl/NodeProxy.js +1 -1
  71. package/src/sap/ui/vk/dvl/Scene.js +1 -1
  72. package/src/sap/ui/vk/dvl/ViewStateManager.js +1 -1
  73. package/src/sap/ui/vk/dvl/Viewport.js +2 -2
  74. package/src/sap/ui/vk/ecad/ElementsPanel.js +636 -375
  75. package/src/sap/ui/vk/ecad/LayersPanel.js +88 -75
  76. package/src/sap/ui/vk/i18n/messagebundle.properties +0 -4
  77. package/src/sap/ui/vk/i18n/messagebundle_ar.properties +2 -3
  78. package/src/sap/ui/vk/i18n/messagebundle_bg.properties +2 -3
  79. package/src/sap/ui/vk/i18n/messagebundle_ca.properties +2 -3
  80. package/src/sap/ui/vk/i18n/messagebundle_cnr.properties +2 -3
  81. package/src/sap/ui/vk/i18n/messagebundle_cs.properties +2 -3
  82. package/src/sap/ui/vk/i18n/messagebundle_cy.properties +2 -3
  83. package/src/sap/ui/vk/i18n/messagebundle_da.properties +2 -3
  84. package/src/sap/ui/vk/i18n/messagebundle_de.properties +4 -5
  85. package/src/sap/ui/vk/i18n/messagebundle_el.properties +2 -3
  86. package/src/sap/ui/vk/i18n/messagebundle_en.properties +2 -3
  87. package/src/sap/ui/vk/i18n/messagebundle_en_GB.properties +2 -3
  88. package/src/sap/ui/vk/i18n/messagebundle_en_US_saprigi.properties +1 -3
  89. package/src/sap/ui/vk/i18n/messagebundle_es.properties +2 -3
  90. package/src/sap/ui/vk/i18n/messagebundle_es_MX.properties +2 -3
  91. package/src/sap/ui/vk/i18n/messagebundle_et.properties +2 -3
  92. package/src/sap/ui/vk/i18n/messagebundle_fi.properties +2 -3
  93. package/src/sap/ui/vk/i18n/messagebundle_fr.properties +2 -3
  94. package/src/sap/ui/vk/i18n/messagebundle_fr_CA.properties +2 -3
  95. package/src/sap/ui/vk/i18n/messagebundle_hi.properties +2 -3
  96. package/src/sap/ui/vk/i18n/messagebundle_hr.properties +2 -3
  97. package/src/sap/ui/vk/i18n/messagebundle_hu.properties +2 -3
  98. package/src/sap/ui/vk/i18n/messagebundle_id.properties +3 -4
  99. package/src/sap/ui/vk/i18n/messagebundle_it.properties +2 -3
  100. package/src/sap/ui/vk/i18n/messagebundle_iw.properties +2 -3
  101. package/src/sap/ui/vk/i18n/messagebundle_ja.properties +4 -5
  102. package/src/sap/ui/vk/i18n/messagebundle_kk.properties +2 -3
  103. package/src/sap/ui/vk/i18n/messagebundle_ko.properties +2 -3
  104. package/src/sap/ui/vk/i18n/messagebundle_lt.properties +2 -3
  105. package/src/sap/ui/vk/i18n/messagebundle_lv.properties +2 -3
  106. package/src/sap/ui/vk/i18n/messagebundle_mk.properties +2 -3
  107. package/src/sap/ui/vk/i18n/messagebundle_ms.properties +2 -3
  108. package/src/sap/ui/vk/i18n/messagebundle_nl.properties +2 -3
  109. package/src/sap/ui/vk/i18n/messagebundle_no.properties +3 -4
  110. package/src/sap/ui/vk/i18n/messagebundle_pl.properties +2 -3
  111. package/src/sap/ui/vk/i18n/messagebundle_pt.properties +2 -3
  112. package/src/sap/ui/vk/i18n/messagebundle_pt_PT.properties +2 -3
  113. package/src/sap/ui/vk/i18n/messagebundle_ro.properties +2 -3
  114. package/src/sap/ui/vk/i18n/messagebundle_ru.properties +2 -3
  115. package/src/sap/ui/vk/i18n/messagebundle_sh.properties +2 -3
  116. package/src/sap/ui/vk/i18n/messagebundle_sk.properties +2 -3
  117. package/src/sap/ui/vk/i18n/messagebundle_sl.properties +2 -3
  118. package/src/sap/ui/vk/i18n/messagebundle_sr.properties +2 -3
  119. package/src/sap/ui/vk/i18n/messagebundle_sv.properties +2 -3
  120. package/src/sap/ui/vk/i18n/messagebundle_th.properties +2 -3
  121. package/src/sap/ui/vk/i18n/messagebundle_tr.properties +2 -3
  122. package/src/sap/ui/vk/i18n/messagebundle_uk.properties +2 -3
  123. package/src/sap/ui/vk/i18n/messagebundle_vi.properties +3 -4
  124. package/src/sap/ui/vk/i18n/messagebundle_zh_CN.properties +2 -3
  125. package/src/sap/ui/vk/i18n/messagebundle_zh_TW.properties +2 -3
  126. package/src/sap/ui/vk/library.js +2 -2
  127. package/src/sap/ui/vk/measurements/Angle.js +1 -1
  128. package/src/sap/ui/vk/measurements/Area.js +1 -1
  129. package/src/sap/ui/vk/measurements/Distance.js +1 -1
  130. package/src/sap/ui/vk/measurements/Edge.js +1 -1
  131. package/src/sap/ui/vk/measurements/Face.js +1 -1
  132. package/src/sap/ui/vk/measurements/Feature.js +1 -1
  133. package/src/sap/ui/vk/measurements/Vertex.js +1 -1
  134. package/src/sap/ui/vk/pdf/ContentManager.js +85 -13
  135. package/src/sap/ui/vk/pdf/Viewport.js +1 -1
  136. package/src/sap/ui/vk/svg/BaseNodeProxy.js +1 -1
  137. package/src/sap/ui/vk/svg/ContentDeliveryService.js +1 -1
  138. package/src/sap/ui/vk/svg/ContentManager.js +2 -1
  139. package/src/sap/ui/vk/svg/Element.js +162 -23
  140. package/src/sap/ui/vk/svg/Ellipse.js +4 -0
  141. package/src/sap/ui/vk/svg/HotspotHelper.js +30 -17
  142. package/src/sap/ui/vk/svg/MiniMap.js +63 -1
  143. package/src/sap/ui/vk/svg/NodeHierarchy.js +17 -1
  144. package/src/sap/ui/vk/svg/NodeProxy.js +1 -1
  145. package/src/sap/ui/vk/svg/OrthographicCamera.js +1 -1
  146. package/src/sap/ui/vk/svg/Scene.js +1 -1
  147. package/src/sap/ui/vk/svg/SceneBuilder.js +57 -5
  148. package/src/sap/ui/vk/svg/Text.js +72 -30
  149. package/src/sap/ui/vk/svg/ViewStateManager.js +2 -2
  150. package/src/sap/ui/vk/svg/Viewport.js +178 -32
  151. package/src/sap/ui/vk/svg/ViewportRenderer.js +82 -0
  152. package/src/sap/ui/vk/thirdparty/BufferGeometryUtils.js +86 -27
  153. package/src/sap/ui/vk/thirdparty/pdf.js +18003 -13388
  154. package/src/sap/ui/vk/thirdparty/pdf.worker.js +38149 -36166
  155. package/src/sap/ui/vk/thirdparty/three.js +48127 -25854
  156. package/src/sap/ui/vk/threejs/AnimationHelper.js +1 -1
  157. package/src/sap/ui/vk/threejs/BaseNodeProxy.js +1 -1
  158. package/src/sap/ui/vk/threejs/Billboard.js +1 -1
  159. package/src/sap/ui/vk/threejs/Callout.js +1 -1
  160. package/src/sap/ui/vk/threejs/ContentDeliveryService.js +1 -1
  161. package/src/sap/ui/vk/threejs/ContentManager.js +1 -1
  162. package/src/sap/ui/vk/threejs/DetailView.js +1 -1
  163. package/src/sap/ui/vk/threejs/HighlightPlayer.js +1 -1
  164. package/src/sap/ui/vk/threejs/Material.js +1 -1
  165. package/src/sap/ui/vk/threejs/NodeHierarchy.js +1 -1
  166. package/src/sap/ui/vk/threejs/NodeProxy.js +1 -1
  167. package/src/sap/ui/vk/threejs/OrthographicCamera.js +1 -1
  168. package/src/sap/ui/vk/threejs/PerspectiveCamera.js +1 -1
  169. package/src/sap/ui/vk/threejs/PointCloudGroup.js +1 -1
  170. package/src/sap/ui/vk/threejs/Scene.js +1 -1
  171. package/src/sap/ui/vk/threejs/SceneBuilder.js +12 -1
  172. package/src/sap/ui/vk/threejs/Texture.js +1 -1
  173. package/src/sap/ui/vk/threejs/Thrustline.js +1 -1
  174. package/src/sap/ui/vk/threejs/ViewStateManager.js +7 -8
  175. package/src/sap/ui/vk/threejs/Viewport.js +7 -5
  176. package/src/sap/ui/vk/tools/AnchorPointTool.js +1 -1
  177. package/src/sap/ui/vk/tools/AnchorPointToolGizmo.js +1 -1
  178. package/src/sap/ui/vk/tools/AxisAngleRotationTool.js +1 -1
  179. package/src/sap/ui/vk/tools/AxisAngleRotationToolGizmo.js +1 -1
  180. package/src/sap/ui/vk/tools/CreateEllipseTool.js +1 -1
  181. package/src/sap/ui/vk/tools/CreateEllipseToolGizmo.js +1 -1
  182. package/src/sap/ui/vk/tools/CreateParametricGizmo.js +1 -1
  183. package/src/sap/ui/vk/tools/CreatePathTool.js +1 -1
  184. package/src/sap/ui/vk/tools/CreatePathToolGizmo.js +1 -1
  185. package/src/sap/ui/vk/tools/CreateRectangleTool.js +1 -1
  186. package/src/sap/ui/vk/tools/CreateRectangleToolGizmo.js +1 -1
  187. package/src/sap/ui/vk/tools/CreateTextTool.js +1 -1
  188. package/src/sap/ui/vk/tools/CreateTextToolGizmo.js +1 -1
  189. package/src/sap/ui/vk/tools/CrossSectionTool.js +1 -1
  190. package/src/sap/ui/vk/tools/CrossSectionToolGizmo.js +1 -1
  191. package/src/sap/ui/vk/tools/DuplicateSvgElementTool.js +1 -1
  192. package/src/sap/ui/vk/tools/DuplicateSvgElementToolGizmo.js +1 -1
  193. package/src/sap/ui/vk/tools/ExplodeTool.js +1 -1
  194. package/src/sap/ui/vk/tools/ExplodeToolGizmo.js +1 -1
  195. package/src/sap/ui/vk/tools/Gizmo.js +4 -3
  196. package/src/sap/ui/vk/tools/HitTestTool.js +1 -1
  197. package/src/sap/ui/vk/tools/MoveTool.js +1 -1
  198. package/src/sap/ui/vk/tools/MoveToolGizmo.js +1 -1
  199. package/src/sap/ui/vk/tools/PointCloudSelectionTool.js +1 -1
  200. package/src/sap/ui/vk/tools/PointCloudSelectionToolGizmo.js +1 -1
  201. package/src/sap/ui/vk/tools/RectSelectTool.js +1 -1
  202. package/src/sap/ui/vk/tools/RedlineTool.js +1 -1
  203. package/src/sap/ui/vk/tools/RedlineToolGizmo.js +1 -1
  204. package/src/sap/ui/vk/tools/RotateOrbitTool.js +1 -1
  205. package/src/sap/ui/vk/tools/RotateTool.js +1 -1
  206. package/src/sap/ui/vk/tools/RotateToolGizmo.js +1 -1
  207. package/src/sap/ui/vk/tools/RotateTurntableTool.js +1 -1
  208. package/src/sap/ui/vk/tools/ScaleTool.js +1 -1
  209. package/src/sap/ui/vk/tools/ScaleToolGizmo.js +1 -1
  210. package/src/sap/ui/vk/tools/SceneOrientationTool.js +1 -1
  211. package/src/sap/ui/vk/tools/SceneOrientationToolGizmo.js +1 -1
  212. package/src/sap/ui/vk/tools/Tool.js +1 -1
  213. package/src/sap/ui/vk/tools/TooltipTool.js +1 -1
  214. package/src/sap/ui/vk/tools/TooltipToolGizmo.js +1 -1
  215. package/src/sap/ui/vk/tools/TransformSvgElementTool.js +1 -1
  216. package/src/sap/ui/vk/tools/TransformSvgElementToolGizmo.js +3 -3
  217. package/src/sap/ui/vk/tools/TransformSvgElementToolHandler.js +1 -1
  218. package/src/sap/ui/vk/totara/Command.js +1 -0
  219. package/src/sap/ui/vk/totara/SceneContext.js +26 -2
  220. package/src/sap/ui/vk/totara/TotaraLoader.js +1 -0
  221. package/src/sap/ui/vk/totara/TotaraLoaderWorker.js +16 -0
  222. package/src/sap/ui/vk/totara/TotaraUtils.js +3 -1
  223. package/src/sap/ui/vk/ve/dvl.wasm +0 -0
@@ -76,23 +76,13 @@ sap.ui.define([
76
76
  *
77
77
  * @public
78
78
  * @author SAP SE
79
- * @version 1.139.0
79
+ * @version 1.141.0
80
80
  * @extends sap.ui.vk.ViewportBase
81
81
  * @alias sap.ui.vk.svg.Viewport
82
82
  */
83
83
  var Viewport = ViewportBase.extend("sap.ui.vk.svg.Viewport", /** @lends sap.ui.vk.svg.Viewport.prototype */ {
84
84
  metadata: {
85
85
  library: "sap.ui.vk",
86
- // properties: {
87
- // zoomInLimit: {
88
- // type: "float",
89
- // defaultValue: 500
90
- // },
91
- // zoomOutLimit: {
92
- // type: "float",
93
- // defaultValue: 0.25
94
- // }
95
- // },
96
86
  aggregations: {
97
87
  miniMap: {
98
88
  type: "sap.m.Dialog",
@@ -245,9 +235,11 @@ sap.ui.define([
245
235
  miniMapDialog.attachBeforeOpen(function() { miniMapDialog.oPopup.setModal(false); }); // dialog should not be modal
246
236
  miniMapDialog._calcPosition = () => {
247
237
  const rect = this.getDomRef()?.getBoundingClientRect() ?? { top: 0, right: 0 }; // viewport's bounding rect
238
+ const miniMapRect = miniMapDialog.getDomRef()?.getBoundingClientRect() ?? { width: 0, height: 0 }; // mini map dialog's bounding rect
239
+ const lockPos = miniMap._lockPosition;
248
240
  return {
249
- top: rect.top + 16 + "px",
250
- left: rect.right - miniMap._width - 16 - 4 + "px"
241
+ top: (lockPos.y >= 0 ? rect.top + lockPos.y : Math.max(rect.bottom + lockPos.y - miniMapRect.height, rect.top)) + "px",
242
+ left: (lockPos.x >= 0 ? rect.left + lockPos.x : Math.max(rect.right + lockPos.x - miniMapRect.width, rect.left)) + "px"
251
243
  };
252
244
  };
253
245
  miniMap.attachSizeChanged((event) => {
@@ -309,6 +301,97 @@ sap.ui.define([
309
301
  }
310
302
  };
311
303
 
304
+ Viewport.prototype._updateCustomText = function() {
305
+ const root = this._scene.getRootElement();
306
+
307
+ // collect all font sizes in the scene
308
+ const fontSizes = [];
309
+ root.traverse(function(node) {
310
+ if (node.type === "Text") {
311
+ const fontSizeCSS = node.style.size;
312
+ const fontSize = parseFloat(fontSizeCSS);
313
+ if (fontSize > 0) {
314
+ let unitScale = 1;
315
+ if (typeof fontSizeCSS === "string") {
316
+ if (fontSizeCSS.endsWith("em")) {
317
+ unitScale = 16; // assuming 1em = 16px
318
+ } else if (fontSizeCSS.endsWith("pt")) {
319
+ unitScale = 1.333; // assuming 1pt = 1.333px
320
+ }
321
+ }
322
+
323
+ const m = node._matrixWorld();
324
+ fontSizes.push(fontSize * unitScale * Math.sqrt(m[2] * m[2] + m[3] * m[3]));
325
+ }
326
+ }
327
+ });
328
+
329
+ let fontSize;
330
+ if (fontSizes.length > 0) {// take median font size
331
+ fontSizes.sort();
332
+ fontSize = fontSizes[fontSizes.length >> 1];
333
+ } else {
334
+ const bbox = root.domRef.getBBox();
335
+ fontSize = Math.max(bbox.width, bbox.height) * 0.01;
336
+ }
337
+ fontSize = Math.round(fontSize * 100) / 100; // round to 2 decimal places
338
+
339
+ root.traverse(function(node) {
340
+ if (node.customText?.style.size === "0px") { // "0px" is a special case, it means "default font size"
341
+ node.customText.style.size = fontSize + "px";
342
+ }
343
+ });
344
+ };
345
+
346
+ Viewport.prototype._updateCustomTextFilters = function() {
347
+ const domRef = this._scene?.getRootElement()?.domRef;
348
+ if (domRef) {
349
+ const blurStdDeviation = this.getHotspotCustomTextHaloWidth();
350
+ const dilateRadius = blurStdDeviation * 0.1; // 10% of blur std deviation
351
+ const outlineWidth = this.getHotspotCustomTextOutlineWidth();
352
+ const expand = Math.max(blurStdDeviation + dilateRadius, outlineWidth * 2);
353
+ const color = cssColorToColor(this.getHotspotCustomTextOutlineColor());
354
+ for (const filter of domRef.parentNode.getElementsByTagName("filter")) {
355
+ if (filter.id.endsWith("-custom-text")) {
356
+ if (sap.ui.Device.browser.firefox) {
357
+ filter.setAttribute("x", "-25%");
358
+ filter.setAttribute("y", "-100%");
359
+ filter.setAttribute("width", "150%");
360
+ filter.setAttribute("height", "300%");
361
+ } else {
362
+ filter.setAttribute("x", -expand + "px");
363
+ filter.setAttribute("y", -expand + "px");
364
+ filter.setAttribute("width", `calc(100% + ${expand * 2}px)`);
365
+ filter.setAttribute("height", `calc(100% + ${expand * 2}px)`);
366
+ }
367
+ filter.childNodes[0].setAttribute("radius", dilateRadius); // set morphology dilate radius
368
+ filter.childNodes[2].setAttribute("stdDeviation", blurStdDeviation); // set gaussian blur std deviation
369
+ filter.childNodes[3].setAttribute("radius", outlineWidth); // set morphology dilate radius
370
+ filter.childNodes[5].setAttribute("stdDeviation", outlineWidth); // set gaussian blur std deviation
371
+ filter.childNodes[4].setAttribute("values", `0 0 0 0 ${color.red / 255}, 0 0 0 0 ${color.green / 255}, 0 0 0 0 ${color.blue / 255}, 0 0 0 ${color.alpha} 0`);
372
+ }
373
+ }
374
+ }
375
+ };
376
+
377
+ Viewport.prototype.setHotspotCustomTextOutlineColor = function(cssColor) {
378
+ this.setProperty("hotspotCustomTextOutlineColor", cssColor, true);
379
+ this._updateCustomTextFilters();
380
+ return this;
381
+ };
382
+
383
+ Viewport.prototype.setHotspotCustomTextOutlineWidth = function(width) {
384
+ this.setProperty("hotspotCustomTextOutlineWidth", width, true);
385
+ this._updateCustomTextFilters();
386
+ return this;
387
+ };
388
+
389
+ Viewport.prototype.setHotspotCustomTextHaloWidth = function(width) {
390
+ this.setProperty("hotspotCustomTextHaloWidth", width, true);
391
+ this._updateCustomTextFilters();
392
+ return this;
393
+ };
394
+
312
395
  Viewport.prototype.onAfterRendering = function() {
313
396
  this._resizeListenerId = ResizeHandler.register(this, this._handleResize.bind(this));
314
397
 
@@ -319,6 +402,8 @@ sap.ui.define([
319
402
  var root = this._scene.getRootElement();
320
403
  root._setDomRef(document.getElementById(root.uid));
321
404
  this._svgElement = root.domRef.parentNode;
405
+
406
+ this._updateCustomText();
322
407
  }
323
408
 
324
409
  this._handleResize({
@@ -523,28 +608,47 @@ sap.ui.define([
523
608
 
524
609
  var rootElement = this._scene.getRootElement();
525
610
  var viewportRect = this.getDomRef().getBoundingClientRect();
611
+ x += viewportRect.x;
612
+ y += viewportRect.y;
526
613
 
527
- var hitTest = function(x, y) {
528
- var htmlElement;
529
- if (ignoreHotspots) {
530
- var htmlElements = document.elementsFromPoint(x + viewportRect.x, y + viewportRect.y);
531
- for (var i = 0; i < htmlElements.length; i++) {
532
- htmlElement = htmlElements[i];
533
- var hit = htmlElement != null && htmlElement.id ? rootElement.getElementById(htmlElement.id) : null;
534
- if (!hit) {
535
- return null;
536
- }
537
- var elem = hit._getSceneTreeElement();
538
- if (elem && elem._vkGetNodeContentType() !== NodeContentType.Hotspot) {
539
- return hit;
540
- }
614
+ function getHit(htmlElement) {
615
+ while (htmlElement && !htmlElement.id) {
616
+ htmlElement = htmlElement.parentElement; // go up the DOM tree to find an element with id
617
+ }
618
+ if (!htmlElement) {
619
+ return null; // element not found
620
+ }
621
+
622
+ const hit = rootElement.getElementById(htmlElement.id);
623
+ const elem = hit?._getSceneTreeElement();
624
+ if (!elem) {
625
+ return null; // element not found in the scene
626
+ }
627
+
628
+ if ((ignoreHotspots && elem._vkGetNodeContentType() === NodeContentType.Hotspot) ||
629
+ hit.userData.customText) {
630
+ return undefined; // ignore hotspots if the "ignoreHotspots" flag is set and ignore custom text elements
631
+ }
632
+
633
+ return hit;
634
+ }
635
+
636
+ function hitTest(x, y) {
637
+ const htmlElement = document.elementFromPoint(x, y);
638
+ const hit = getHit(htmlElement);
639
+ if (hit !== undefined) {
640
+ return hit;
641
+ }
642
+
643
+ for (const htmlElement of document.elementsFromPoint(x, y)) {
644
+ const hit = getHit(htmlElement);
645
+ if (hit !== undefined) {
646
+ return hit;
541
647
  }
542
- return null;
543
- } else {
544
- htmlElement = document.elementFromPoint(x + viewportRect.x, y + viewportRect.y);
545
- return htmlElement !== null && htmlElement.id ? rootElement.getElementById(htmlElement.id) : null;
546
648
  }
547
- };
649
+
650
+ return null; // no hit found
651
+ }
548
652
 
549
653
  var hit = hitTest(x, y);
550
654
  if (withTolerance) {
@@ -1288,6 +1392,15 @@ sap.ui.define([
1288
1392
  activeHotspotChanged = true;
1289
1393
  }
1290
1394
 
1395
+ if (this._dynamicContentElement && this._dynamicContentElement !== elem) {
1396
+ this.fireHotspotLeave({ nodeRef: this._dynamicContentElement });
1397
+ if (!this.getShowAllDynamicContents()) {
1398
+ this._dynamicContentElement.setHotspotColor(vsm._mask, null);
1399
+ }
1400
+ this._dynamicContentElement = null;
1401
+ activeHotspotChanged = true;
1402
+ }
1403
+
1291
1404
  if (elem && elem._vkGetNodeContentType() === NodeContentType.Hotspot) {
1292
1405
  this._hotspotElement = elem;
1293
1406
  if (!this.getShowAllHotspots()) {
@@ -1297,6 +1410,15 @@ sap.ui.define([
1297
1410
  activeHotspotChanged = true;
1298
1411
  }
1299
1412
 
1413
+ if (elem && elem._vkGetNodeContentType() === NodeContentType.DynamicContent) {
1414
+ this._dynamicContentElement = elem;
1415
+ if (!this.getShowAllDynamicContents()) {
1416
+ elem.setHotspotColor(vsm._mask, this.getHotspotColorABGR());
1417
+ }
1418
+ this.fireHotspotEnter({ nodeRef: elem });
1419
+ activeHotspotChanged = true;
1420
+ }
1421
+
1300
1422
  if (activeHotspotChanged) {
1301
1423
  this._invalidateRasterImage();
1302
1424
  }
@@ -1645,6 +1767,30 @@ sap.ui.define([
1645
1767
  return this;
1646
1768
  };
1647
1769
 
1770
+ Viewport.prototype.setShowAllDynamicContents = function(value) {
1771
+ this.setProperty("showAllDynamicContents", value, true);
1772
+ const vsm = this._getViewStateManagerSVG();
1773
+ if (vsm) {
1774
+ const vsmMask = vsm._mask;
1775
+ const nodes = vsm.getNodeHierarchy().getDynamicContentNodeRefs();
1776
+ const dynamicContentElement = this._dynamicContentElement;
1777
+ const color = this.getShowAllHotspotsTintColor();
1778
+ nodes.forEach(function(node) {
1779
+ if (value) {
1780
+ node.setHotspotColor(vsmMask, color);
1781
+ } else if (node === dynamicContentElement) {
1782
+ node.setHotspotColor(vsmMask, this.getHotspotColorABGR());
1783
+ } else {
1784
+ node.setHotspotColor(vsmMask, null);
1785
+ }
1786
+ }, this);
1787
+
1788
+ if (nodes.length > 0) {
1789
+ this.invalidate();
1790
+ }
1791
+ }
1792
+ };
1793
+
1648
1794
  Viewport.prototype._getFillStyleId = function(element) {
1649
1795
  if (element.highlightColor || element.tintColor) {
1650
1796
  return null;
@@ -56,6 +56,12 @@ sap.ui.define([
56
56
  var highlightColor = abgrToColor(vsm._highlightColorABGR);
57
57
  var hotspotColor = abgrToColor(viewport.getHotspotColorABGR());
58
58
  var tintColor = cssColorToColor(viewport.getShowAllHotspotsTintColor());
59
+ const customTextBlurStdDeviation = viewport.getHotspotCustomTextHaloWidth();
60
+ const customTextDilateRadius = customTextBlurStdDeviation * 0.1; // 10% of blur std deviation
61
+ const customTextOutlineColor = cssColorToColor(viewport.getHotspotCustomTextOutlineColor());
62
+ const customTextOutlineRadius = viewport.getHotspotCustomTextOutlineWidth();
63
+ const customTextFilterExpand = Math.max(customTextBlurStdDeviation + customTextDilateRadius, customTextOutlineRadius * 2);
64
+
59
65
  hotspotEffects.set(Element._hotspotEffectName(highlightColor), highlightColor);
60
66
  hotspotEffects.set(Element._hotspotEffectName(hotspotColor), hotspotColor);
61
67
  hotspotEffects.set(Element._hotspotEffectName(tintColor), tintColor);
@@ -78,6 +84,82 @@ sap.ui.define([
78
84
  rm.openEnd();
79
85
  rm.close("feColorMatrix");
80
86
  rm.close("filter");
87
+
88
+ rm.openStart("filter");
89
+ rm.attr("id", name + "-custom-text");
90
+ if (sap.ui.Device.browser.firefox) {
91
+ rm.attr("x", "-25%");
92
+ rm.attr("y", "-100%");
93
+ rm.attr("width", "150%");
94
+ rm.attr("height", "300%");
95
+ } else {
96
+ rm.attr("x", -customTextFilterExpand + "px");
97
+ rm.attr("y", -customTextFilterExpand + "px");
98
+ rm.attr("width", `calc(100% + ${customTextFilterExpand * 2}px)`);
99
+ rm.attr("height", `calc(100% + ${customTextFilterExpand * 2}px)`);
100
+ }
101
+ rm.openEnd();
102
+
103
+ rm.openStart("feMorphology");
104
+ rm.attr("in", "SourceAlpha");
105
+ rm.attr("result", "blurOut");
106
+ rm.attr("operator", "dilate");
107
+ rm.attr("radius", customTextDilateRadius);
108
+ rm.openEnd();
109
+ rm.close("feMorphology");
110
+
111
+ rm.openStart("feColorMatrix");
112
+ rm.attr("in", "blurOut");
113
+ rm.attr("result", "blurOut");
114
+ rm.attr("type", "matrix");
115
+ rm.attr("values", "0 0 0 0 " + (color.red / 255) + ", 0 0 0 0 " + (color.green / 255) + ", 0 0 0 0 " + (color.blue / 255) + ", 0 0 0 1 0");
116
+ rm.openEnd();
117
+ rm.close("feColorMatrix");
118
+
119
+ rm.openStart("feGaussianBlur");
120
+ rm.attr("in", "blurOut");
121
+ rm.attr("result", "blurOut");
122
+ rm.attr("stdDeviation", customTextBlurStdDeviation);
123
+ rm.openEnd();
124
+ rm.close("feGaussianBlur");
125
+
126
+ rm.openStart("feMorphology");
127
+ rm.attr("in", "SourceAlpha");
128
+ rm.attr("result", "outline");
129
+ rm.attr("operator", "dilate");
130
+ rm.attr("radius", customTextOutlineRadius);
131
+ rm.openEnd();
132
+ rm.close("feMorphology");
133
+
134
+ rm.openStart("feColorMatrix");
135
+ rm.attr("in", "outline");
136
+ rm.attr("result", "outline");
137
+ rm.attr("type", "matrix");
138
+ rm.attr("values", "0 0 0 0 " + (customTextOutlineColor.red / 255) + ", 0 0 0 0 " + (customTextOutlineColor.green / 255) + ", 0 0 0 0 " + (customTextOutlineColor.blue / 255) + ", 0 0 0 " + customTextOutlineColor.alpha + " 0");
139
+ rm.openEnd();
140
+ rm.close("feColorMatrix");
141
+
142
+ rm.openStart("feGaussianBlur");
143
+ rm.attr("in", "outline");
144
+ rm.attr("result", "outline");
145
+ rm.attr("stdDeviation", customTextOutlineRadius);
146
+ rm.openEnd();
147
+ rm.close("feGaussianBlur");
148
+
149
+ rm.openStart("feBlend");
150
+ rm.attr("in", "blurOut");
151
+ rm.attr("in2", "outline");
152
+ rm.attr("result", "blurOut");
153
+ rm.openEnd();
154
+ rm.close("feBlend");
155
+
156
+ rm.openStart("feBlend");
157
+ rm.attr("in", "SourceGraphic");
158
+ rm.attr("in2", "blurOut");
159
+ rm.openEnd();
160
+ rm.close("feBlend");
161
+
162
+ rm.close("filter");
81
163
  });
82
164
 
83
165
  scene.getRootElement().render(rm, vsm ? vsm._mask : (-1 | 0), viewport);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2010-2023 Three.js Authors
3
+ * Copyright 2010-2025 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
6
 
@@ -14,6 +14,30 @@ sap.ui.define([
14
14
  var Module = (function (exports, three) {
15
15
  'use strict';
16
16
 
17
+ /**
18
+ * @module BufferGeometryUtils
19
+ * @three_import import * as BufferGeometryUtils from 'three/addons/utils/BufferGeometryUtils.js';
20
+ */
21
+
22
+ /**
23
+ * Computes vertex tangents using the MikkTSpace algorithm. MikkTSpace generates the same tangents consistently,
24
+ * and is used in most modelling tools and normal map bakers. Use MikkTSpace for materials with normal maps,
25
+ * because inconsistent tangents may lead to subtle visual issues in the normal map, particularly around mirrored
26
+ * UV seams.
27
+ *
28
+ * In comparison to this method, {@link BufferGeometry#computeTangents} (a custom algorithm) generates tangents that
29
+ * probably will not match the tangents in other software. The custom algorithm is sufficient for general use with a
30
+ * custom material, and may be faster than MikkTSpace.
31
+ *
32
+ * Returns the original BufferGeometry. Indexed geometries will be de-indexed. Requires position, normal, and uv attributes.
33
+ *
34
+ * @param {BufferGeometry} geometry - The geometry to compute tangents for.
35
+ * @param {Object} MikkTSpace - Instance of `examples/jsm/libs/mikktspace.module.js`, or `mikktspace` npm package.
36
+ * Await `MikkTSpace.ready` before use.
37
+ * @param {boolean} [negateSign=true] - Whether to negate the sign component (.w) of each tangent.
38
+ * Required for normal map conventions in some formats, including glTF.
39
+ * @return {BufferGeometry} The updated geometry.
40
+ */
17
41
  function computeMikkTSpaceTangents( geometry, MikkTSpace, negateSign = true ) {
18
42
 
19
43
  if ( ! MikkTSpace || ! MikkTSpace.isReady ) {
@@ -103,9 +127,11 @@ var Module = (function (exports, three) {
103
127
  }
104
128
 
105
129
  /**
106
- * @param {Array<BufferGeometry>} geometries
107
- * @param {Boolean} useGroups
108
- * @return {BufferGeometry}
130
+ * Merges a set of geometries into a single instance. All geometries must have compatible attributes.
131
+ *
132
+ * @param {Array<BufferGeometry>} geometries - The geometries to merge.
133
+ * @param {boolean} [useGroups=false] - Whether to use groups or not.
134
+ * @return {?BufferGeometry} The merged geometry. Returns `null` if the merge does not succeed.
109
135
  */
110
136
  function mergeGeometries( geometries, useGroups = false ) {
111
137
 
@@ -299,8 +325,11 @@ var Module = (function (exports, three) {
299
325
  }
300
326
 
301
327
  /**
302
- * @param {Array<BufferAttribute>} attributes
303
- * @return {BufferAttribute}
328
+ * Merges a set of attributes into a single instance. All attributes must have compatible properties and types.
329
+ * Instances of {@link InterleavedBufferAttribute} are not supported.
330
+ *
331
+ * @param {Array<BufferAttribute>} attributes - The attributes to merge.
332
+ * @return {?BufferAttribute} The merged attribute. Returns `null` if the merge does not succeed.
304
333
  */
305
334
  function mergeAttributes( attributes ) {
306
335
 
@@ -392,8 +421,10 @@ var Module = (function (exports, three) {
392
421
  }
393
422
 
394
423
  /**
395
- * @param {BufferAttribute}
396
- * @return {BufferAttribute}
424
+ * Performs a deep clone of the given buffer attribute.
425
+ *
426
+ * @param {BufferAttribute} attribute - The attribute to clone.
427
+ * @return {BufferAttribute} The cloned attribute.
397
428
  */
398
429
  function deepCloneAttribute( attribute ) {
399
430
 
@@ -414,8 +445,11 @@ var Module = (function (exports, three) {
414
445
  }
415
446
 
416
447
  /**
417
- * @param {Array<BufferAttribute>} attributes
418
- * @return {Array<InterleavedBufferAttribute>}
448
+ * Interleaves a set of attributes and returns a new array of corresponding attributes that share a
449
+ * single {@link InterleavedBuffer} instance. All attributes must have compatible types.
450
+ *
451
+ * @param {Array<BufferAttribute>} attributes - The attributes to interleave.
452
+ * @return {Array<InterleavedBufferAttribute>} An array of interleaved attributes. If interleave does not succeed, the method returns `null`.
419
453
  */
420
454
  function interleaveAttributes( attributes ) {
421
455
 
@@ -478,7 +512,12 @@ var Module = (function (exports, three) {
478
512
 
479
513
  }
480
514
 
481
- // returns a new, non-interleaved version of the provided attribute
515
+ /**
516
+ * Returns a new, non-interleaved version of the given attribute.
517
+ *
518
+ * @param {InterleavedBufferAttribute} attribute - The interleaved attribute.
519
+ * @return {BufferAttribute} The non-interleaved attribute.
520
+ */
482
521
  function deinterleaveAttribute( attribute ) {
483
522
 
484
523
  const cons = attribute.data.array.constructor;
@@ -526,7 +565,11 @@ var Module = (function (exports, three) {
526
565
 
527
566
  }
528
567
 
529
- // deinterleaves all attributes on the geometry
568
+ /**
569
+ * Deinterleaves all attributes on the given geometry.
570
+ *
571
+ * @param {BufferGeometry} geometry - The geometry to deinterleave.
572
+ */
530
573
  function deinterleaveGeometry( geometry ) {
531
574
 
532
575
  const attributes = geometry.attributes;
@@ -570,8 +613,10 @@ var Module = (function (exports, three) {
570
613
  }
571
614
 
572
615
  /**
573
- * @param {BufferGeometry} geometry
574
- * @return {number}
616
+ * Returns the amount of bytes used by all attributes to represent the geometry.
617
+ *
618
+ * @param {BufferGeometry} geometry - The geometry.
619
+ * @return {number} The estimate bytes used.
575
620
  */
576
621
  function estimateBytesUsed( geometry ) {
577
622
 
@@ -593,9 +638,11 @@ var Module = (function (exports, three) {
593
638
  }
594
639
 
595
640
  /**
596
- * @param {BufferGeometry} geometry
597
- * @param {number} tolerance
598
- * @return {BufferGeometry}
641
+ * Returns a new geometry with vertices for which all similar vertex attributes (within tolerance) are merged.
642
+ *
643
+ * @param {BufferGeometry} geometry - The geometry to merge vertices for.
644
+ * @param {number} [tolerance=1e-4] - The tolerance value.
645
+ * @return {BufferGeometry} - The new geometry with merged vertices.
599
646
  */
600
647
  function mergeVertices( geometry, tolerance = 1e-4 ) {
601
648
 
@@ -756,9 +803,12 @@ var Module = (function (exports, three) {
756
803
  }
757
804
 
758
805
  /**
759
- * @param {BufferGeometry} geometry
760
- * @param {number} drawMode
761
- * @return {BufferGeometry}
806
+ * Returns a new indexed geometry based on `TrianglesDrawMode` draw mode.
807
+ * This mode corresponds to the `gl.TRIANGLES` primitive in WebGL.
808
+ *
809
+ * @param {BufferGeometry} geometry - The geometry to convert.
810
+ * @param {number} drawMode - The current draw mode.
811
+ * @return {BufferGeometry} The new geometry using `TrianglesDrawMode`.
762
812
  */
763
813
  function toTrianglesDrawMode( geometry, drawMode ) {
764
814
 
@@ -867,9 +917,13 @@ var Module = (function (exports, three) {
867
917
 
868
918
  /**
869
919
  * Calculates the morphed attributes of a morphed/skinned BufferGeometry.
870
- * Helpful for Raytracing or Decals.
871
- * @param {Mesh | Line | Points} object An instance of Mesh, Line or Points.
872
- * @return {Object} An Object with original position/normal attributes and morphed ones.
920
+ *
921
+ * Helpful for Raytracing or Decals (i.e. a `DecalGeometry` applied to a morphed Object with a `BufferGeometry`
922
+ * will use the original `BufferGeometry`, not the morphed/skinned one, generating an incorrect result.
923
+ * Using this function to create a shadow `Object3`D the `DecalGeometry` can be correctly generated).
924
+ *
925
+ * @param {Mesh|Line|Points} object - The 3D object to compute morph attributes for.
926
+ * @return {Object} An object with original position/normal attributes and morphed ones.
873
927
  */
874
928
  function computeMorphedAttributes( object ) {
875
929
 
@@ -1145,6 +1199,12 @@ var Module = (function (exports, three) {
1145
1199
 
1146
1200
  }
1147
1201
 
1202
+ /**
1203
+ * Merges the {@link BufferGeometry#groups} for the given geometry.
1204
+ *
1205
+ * @param {BufferGeometry} geometry - The geometry to modify.
1206
+ * @return {BufferGeometry} - The updated geometry
1207
+ */
1148
1208
  function mergeGroups( geometry ) {
1149
1209
 
1150
1210
  if ( geometry.groups.length === 0 ) {
@@ -1247,15 +1307,14 @@ var Module = (function (exports, three) {
1247
1307
 
1248
1308
  }
1249
1309
 
1250
-
1251
1310
  /**
1252
1311
  * Modifies the supplied geometry if it is non-indexed, otherwise creates a new,
1253
1312
  * non-indexed geometry. Returns the geometry with smooth normals everywhere except
1254
1313
  * faces that meet at an angle greater than the crease angle.
1255
1314
  *
1256
- * @param {BufferGeometry} geometry
1257
- * @param {number} [creaseAngle]
1258
- * @return {BufferGeometry}
1315
+ * @param {BufferGeometry} geometry - The geometry to modify.
1316
+ * @param {number} [creaseAngle=Math.PI/3] - The crease angle in radians.
1317
+ * @return {BufferGeometry} - The updated geometry
1259
1318
  */
1260
1319
  function toCreasedNormals( geometry, creaseAngle = Math.PI / 3 /* 60 degrees */ ) {
1261
1320