@sapui5/sap.ui.vk 1.140.0 → 1.142.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 (222) 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 +1 -1
  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 +34 -34
  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 +1 -1
  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 +352 -141
  75. package/src/sap/ui/vk/ecad/LayersPanel.js +1 -1
  76. package/src/sap/ui/vk/i18n/messagebundle_ar.properties +0 -2
  77. package/src/sap/ui/vk/i18n/messagebundle_bg.properties +0 -2
  78. package/src/sap/ui/vk/i18n/messagebundle_ca.properties +0 -2
  79. package/src/sap/ui/vk/i18n/messagebundle_cnr.properties +0 -2
  80. package/src/sap/ui/vk/i18n/messagebundle_cs.properties +0 -2
  81. package/src/sap/ui/vk/i18n/messagebundle_cy.properties +0 -2
  82. package/src/sap/ui/vk/i18n/messagebundle_da.properties +0 -2
  83. package/src/sap/ui/vk/i18n/messagebundle_de.properties +0 -2
  84. package/src/sap/ui/vk/i18n/messagebundle_el.properties +0 -2
  85. package/src/sap/ui/vk/i18n/messagebundle_en.properties +0 -2
  86. package/src/sap/ui/vk/i18n/messagebundle_en_GB.properties +0 -2
  87. package/src/sap/ui/vk/i18n/messagebundle_es.properties +0 -2
  88. package/src/sap/ui/vk/i18n/messagebundle_es_MX.properties +0 -2
  89. package/src/sap/ui/vk/i18n/messagebundle_et.properties +0 -2
  90. package/src/sap/ui/vk/i18n/messagebundle_fi.properties +0 -2
  91. package/src/sap/ui/vk/i18n/messagebundle_fr.properties +0 -2
  92. package/src/sap/ui/vk/i18n/messagebundle_fr_CA.properties +0 -2
  93. package/src/sap/ui/vk/i18n/messagebundle_hi.properties +0 -2
  94. package/src/sap/ui/vk/i18n/messagebundle_hr.properties +0 -2
  95. package/src/sap/ui/vk/i18n/messagebundle_hu.properties +0 -2
  96. package/src/sap/ui/vk/i18n/messagebundle_id.properties +0 -2
  97. package/src/sap/ui/vk/i18n/messagebundle_it.properties +0 -2
  98. package/src/sap/ui/vk/i18n/messagebundle_iw.properties +1 -3
  99. package/src/sap/ui/vk/i18n/messagebundle_ja.properties +0 -2
  100. package/src/sap/ui/vk/i18n/messagebundle_kk.properties +0 -2
  101. package/src/sap/ui/vk/i18n/messagebundle_ko.properties +0 -2
  102. package/src/sap/ui/vk/i18n/messagebundle_lt.properties +0 -2
  103. package/src/sap/ui/vk/i18n/messagebundle_lv.properties +0 -2
  104. package/src/sap/ui/vk/i18n/messagebundle_mk.properties +0 -2
  105. package/src/sap/ui/vk/i18n/messagebundle_ms.properties +0 -2
  106. package/src/sap/ui/vk/i18n/messagebundle_nl.properties +0 -2
  107. package/src/sap/ui/vk/i18n/messagebundle_no.properties +0 -2
  108. package/src/sap/ui/vk/i18n/messagebundle_pl.properties +0 -2
  109. package/src/sap/ui/vk/i18n/messagebundle_pt.properties +0 -2
  110. package/src/sap/ui/vk/i18n/messagebundle_pt_PT.properties +0 -2
  111. package/src/sap/ui/vk/i18n/messagebundle_ro.properties +0 -2
  112. package/src/sap/ui/vk/i18n/messagebundle_ru.properties +0 -2
  113. package/src/sap/ui/vk/i18n/messagebundle_sh.properties +0 -2
  114. package/src/sap/ui/vk/i18n/messagebundle_sk.properties +0 -2
  115. package/src/sap/ui/vk/i18n/messagebundle_sl.properties +0 -2
  116. package/src/sap/ui/vk/i18n/messagebundle_sr.properties +0 -2
  117. package/src/sap/ui/vk/i18n/messagebundle_sv.properties +0 -2
  118. package/src/sap/ui/vk/i18n/messagebundle_th.properties +0 -2
  119. package/src/sap/ui/vk/i18n/messagebundle_tr.properties +0 -2
  120. package/src/sap/ui/vk/i18n/messagebundle_uk.properties +0 -2
  121. package/src/sap/ui/vk/i18n/messagebundle_vi.properties +0 -2
  122. package/src/sap/ui/vk/i18n/messagebundle_zh_CN.properties +0 -2
  123. package/src/sap/ui/vk/i18n/messagebundle_zh_TW.properties +0 -2
  124. package/src/sap/ui/vk/library.js +2 -2
  125. package/src/sap/ui/vk/matai/MataiLoaderWorker.js +29 -7
  126. package/src/sap/ui/vk/measurements/Angle.js +1 -1
  127. package/src/sap/ui/vk/measurements/Area.js +1 -1
  128. package/src/sap/ui/vk/measurements/Distance.js +1 -1
  129. package/src/sap/ui/vk/measurements/Edge.js +1 -1
  130. package/src/sap/ui/vk/measurements/Face.js +1 -1
  131. package/src/sap/ui/vk/measurements/Feature.js +1 -1
  132. package/src/sap/ui/vk/measurements/Vertex.js +1 -1
  133. package/src/sap/ui/vk/pdf/ContentManager.js +85 -13
  134. package/src/sap/ui/vk/pdf/Viewport.js +1 -1
  135. package/src/sap/ui/vk/svg/BaseNodeProxy.js +1 -1
  136. package/src/sap/ui/vk/svg/ContentDeliveryService.js +1 -1
  137. package/src/sap/ui/vk/svg/ContentManager.js +2 -1
  138. package/src/sap/ui/vk/svg/Element.js +162 -23
  139. package/src/sap/ui/vk/svg/Ellipse.js +4 -0
  140. package/src/sap/ui/vk/svg/HotspotHelper.js +30 -17
  141. package/src/sap/ui/vk/svg/MiniMap.js +63 -1
  142. package/src/sap/ui/vk/svg/NodeHierarchy.js +17 -1
  143. package/src/sap/ui/vk/svg/NodeProxy.js +1 -1
  144. package/src/sap/ui/vk/svg/OrthographicCamera.js +1 -1
  145. package/src/sap/ui/vk/svg/Scene.js +1 -1
  146. package/src/sap/ui/vk/svg/SceneBuilder.js +62 -5
  147. package/src/sap/ui/vk/svg/Text.js +72 -30
  148. package/src/sap/ui/vk/svg/ViewStateManager.js +2 -2
  149. package/src/sap/ui/vk/svg/Viewport.js +178 -32
  150. package/src/sap/ui/vk/svg/ViewportRenderer.js +82 -0
  151. package/src/sap/ui/vk/thirdparty/pdf.js +18003 -13388
  152. package/src/sap/ui/vk/thirdparty/pdf.worker.js +38149 -36166
  153. package/src/sap/ui/vk/threejs/AnimationHelper.js +1 -1
  154. package/src/sap/ui/vk/threejs/BaseNodeProxy.js +1 -1
  155. package/src/sap/ui/vk/threejs/Billboard.js +16 -15
  156. package/src/sap/ui/vk/threejs/Callout.js +1 -1
  157. package/src/sap/ui/vk/threejs/ContentDeliveryService.js +1 -1
  158. package/src/sap/ui/vk/threejs/ContentManager.js +1 -1
  159. package/src/sap/ui/vk/threejs/DetailView.js +1 -1
  160. package/src/sap/ui/vk/threejs/HighlightPlayer.js +1 -1
  161. package/src/sap/ui/vk/threejs/Material.js +1 -1
  162. package/src/sap/ui/vk/threejs/NodeHierarchy.js +1 -1
  163. package/src/sap/ui/vk/threejs/NodeProxy.js +1 -1
  164. package/src/sap/ui/vk/threejs/OrthographicCamera.js +1 -1
  165. package/src/sap/ui/vk/threejs/PerspectiveCamera.js +1 -1
  166. package/src/sap/ui/vk/threejs/PointCloudGroup.js +1 -1
  167. package/src/sap/ui/vk/threejs/Scene.js +1 -1
  168. package/src/sap/ui/vk/threejs/SceneBuilder.js +16 -5
  169. package/src/sap/ui/vk/threejs/Texture.js +1 -1
  170. package/src/sap/ui/vk/threejs/Thrustline.js +1 -1
  171. package/src/sap/ui/vk/threejs/ViewStateManager.js +3 -3
  172. package/src/sap/ui/vk/threejs/Viewport.js +8 -9
  173. package/src/sap/ui/vk/tools/AnchorPointTool.js +1 -1
  174. package/src/sap/ui/vk/tools/AnchorPointToolGizmo.js +1 -1
  175. package/src/sap/ui/vk/tools/AxisAngleRotationTool.js +1 -1
  176. package/src/sap/ui/vk/tools/AxisAngleRotationToolGizmo.js +1 -1
  177. package/src/sap/ui/vk/tools/CreateEllipseTool.js +1 -1
  178. package/src/sap/ui/vk/tools/CreateEllipseToolGizmo.js +1 -1
  179. package/src/sap/ui/vk/tools/CreateParametricGizmo.js +1 -1
  180. package/src/sap/ui/vk/tools/CreatePathTool.js +1 -1
  181. package/src/sap/ui/vk/tools/CreatePathToolGizmo.js +1 -1
  182. package/src/sap/ui/vk/tools/CreateRectangleTool.js +1 -1
  183. package/src/sap/ui/vk/tools/CreateRectangleToolGizmo.js +1 -1
  184. package/src/sap/ui/vk/tools/CreateTextTool.js +1 -1
  185. package/src/sap/ui/vk/tools/CreateTextToolGizmo.js +1 -1
  186. package/src/sap/ui/vk/tools/CrossSectionTool.js +1 -1
  187. package/src/sap/ui/vk/tools/CrossSectionToolGizmo.js +1 -1
  188. package/src/sap/ui/vk/tools/DuplicateSvgElementTool.js +1 -1
  189. package/src/sap/ui/vk/tools/DuplicateSvgElementToolGizmo.js +1 -1
  190. package/src/sap/ui/vk/tools/ExplodeTool.js +1 -1
  191. package/src/sap/ui/vk/tools/ExplodeToolGizmo.js +1 -1
  192. package/src/sap/ui/vk/tools/Gizmo.js +1 -1
  193. package/src/sap/ui/vk/tools/HitTestTool.js +1 -1
  194. package/src/sap/ui/vk/tools/MoveTool.js +1 -1
  195. package/src/sap/ui/vk/tools/MoveToolGizmo.js +1 -1
  196. package/src/sap/ui/vk/tools/PointCloudSelectionTool.js +1 -1
  197. package/src/sap/ui/vk/tools/PointCloudSelectionToolGizmo.js +1 -1
  198. package/src/sap/ui/vk/tools/RectSelectTool.js +1 -1
  199. package/src/sap/ui/vk/tools/RedlineTool.js +1 -1
  200. package/src/sap/ui/vk/tools/RedlineToolGizmo.js +1 -1
  201. package/src/sap/ui/vk/tools/RotateOrbitTool.js +1 -1
  202. package/src/sap/ui/vk/tools/RotateTool.js +1 -1
  203. package/src/sap/ui/vk/tools/RotateToolGizmo.js +1 -1
  204. package/src/sap/ui/vk/tools/RotateTurntableTool.js +1 -1
  205. package/src/sap/ui/vk/tools/ScaleTool.js +1 -1
  206. package/src/sap/ui/vk/tools/ScaleToolGizmo.js +1 -1
  207. package/src/sap/ui/vk/tools/SceneOrientationTool.js +1 -1
  208. package/src/sap/ui/vk/tools/SceneOrientationToolGizmo.js +1 -1
  209. package/src/sap/ui/vk/tools/Tool.js +1 -1
  210. package/src/sap/ui/vk/tools/TooltipTool.js +1 -1
  211. package/src/sap/ui/vk/tools/TooltipToolGizmo.js +1 -1
  212. package/src/sap/ui/vk/tools/TransformSvgElementTool.js +1 -1
  213. package/src/sap/ui/vk/tools/TransformSvgElementToolGizmo.js +3 -3
  214. package/src/sap/ui/vk/tools/TransformSvgElementToolHandler.js +1 -1
  215. package/src/sap/ui/vk/totara/Command.js +1 -0
  216. package/src/sap/ui/vk/totara/SceneContext.js +23 -1
  217. package/src/sap/ui/vk/totara/TotaraLoader.js +1 -0
  218. package/src/sap/ui/vk/totara/TotaraLoaderWorker.js +16 -0
  219. package/src/sap/ui/vk/totara/TotaraUtils.js +3 -1
  220. package/src/sap/ui/vk/ve/dvl.wasm +0 -0
  221. package/src/sap/ui/vk/ve/matai.js +2 -2
  222. package/src/sap/ui/vk/ve/matai.wasm +0 -0
@@ -66,7 +66,7 @@ sap.ui.define([
66
66
  *
67
67
  * @private
68
68
  * @author SAP SE
69
- * @version 1.140.0
69
+ * @version 1.142.0
70
70
  */
71
71
  var SceneBuilder = function(rootNode, contentResource, resolve, reject) {
72
72
  this._rootNode = rootNode;
@@ -122,14 +122,42 @@ sap.ui.define([
122
122
  */
123
123
  SceneBuilder.prototype.setScene = function(info) {
124
124
  this._yIndex = 1; // VDS4 file geometry data
125
- this._rootNode.matrix[3] = info.upAxis === 2 ? -1 : 1; // (0 = +X, 1 = -X, 2 = +Y, 3 = -Y, 4 = +Z, 5 = -Z)
126
- var camera = this._cameras.get(info.cameraId);
125
+ this._rootNode.matrix[3] = info.upAxis === 2 || info.upAxis === 4 ? -1 : 1; // (0 = +X, 1 = -X, 2 = +Y, 3 = -Y, 4 = +Z, 5 = -Z)
126
+ const camera = this._cameras.get(info.cameraId);
127
+ const outputSettings = info.outputSettings;
128
+ if (outputSettings && camera) {
129
+ // update line width in materials if coordinate space is in device/paper units
130
+ const outputDPI = 72; // ignore outputSettings.dpi as VEA ignores DPI setting and always uses 72 DPI
131
+ const mmToInch = 1 / 25.4; // 1 inch = 25.4 mm
132
+ const pointToPixel = 4 / 3; // 1 inch = 72 points(common for older screens) = 96 pixels(standard web displays), so 1 point = 96 / 72 pixels = 4 / 3 pixels
133
+ const mmToPixels = mmToInch * outputDPI * pointToPixel; // convert mm to pixels (mm -> inches -> points -> pixels)
134
+ const outputSize = Math.min(outputSettings.width, outputSettings.height) * mmToPixels;
135
+ const mediumViewportSize = 1024; // medium viewport size in pixels
136
+
137
+ this._materialMap.forEach(function(material) {
138
+ if (material.lineStyle.widthCoordinateSpace === 3) { // sap::ve::core::Material::CoordinateSpace::NormalizedViewport
139
+ // 2D viewport space (x and y values range from -1.0 to 1.0, the origin representing the center of view)
140
+ material.lineWidth = material.lineStyle.width * mediumViewportSize * 0.5; // 1024 is a medium viewport size in pixels
141
+ material.lineStyle.widthCoordinateSpace = 0; // convert to screen space
142
+ } else if (material.lineStyle.widthCoordinateSpace === 4) { // sap::ve::core::Material::CoordinateSpace::Device (device/paper units)
143
+ if (!info.showPaperSpace) {
144
+ // this mode has a weird behavior in VE Author, the line thickness is measured in weird units that are converted
145
+ // to pixels (doesn't depend on the zoom factor), but it depends on the viewport size
146
+ material.lineWidth = material.lineStyle.width * mediumViewportSize / outputSize;
147
+ material.lineStyle.widthCoordinateSpace = 0; // convert to screen space
148
+ }
149
+ // material.lineWidth = material.lineStyle.width / (outputSize * camera._initialZoom);
150
+ }
151
+ });
152
+ }
153
+
127
154
  Log.info("setScene", JSON.stringify(info), camera);
128
155
  this._resolve?.({
129
156
  node: this._rootNode,
130
- camera: camera,
157
+ camera,
131
158
  backgroundTopColor: info.backgroundTopColor,
132
159
  backgroundBottomColor: info.backgroundBottomColor,
160
+ outputSettings,
133
161
  contentResource: this._contentResource,
134
162
  builder: this
135
163
  });
@@ -691,6 +719,7 @@ sap.ui.define([
691
719
  * @param {any} nodeInfo The node information object containing the following properties <br/>
692
720
  * <code>sid</code>: String. The id of node.
693
721
  * <code>parametricId</code>: String. The id of object's parametric representation.
722
+ * <code>dynamicContentId</code>: String. The id of object's dynamic content representation.
694
723
  * <code>name</code>: String. The name of the node. Optional.<br/>
695
724
  * <code>visible</code>: Boolean. True if the node is visible. Default true. Optional<br/>
696
725
  * <code>visualisable</code>: Boolean. False if the node is skipped. Default true. Optional<br/>
@@ -737,12 +766,14 @@ sap.ui.define([
737
766
 
738
767
  if (nodeInfo.parametricId) {
739
768
  userData.parametricId = nodeInfo.parametricId;
769
+ } else if (nodeInfo.dynamicContentId) {
770
+ userData.dynamicContentId = nodeInfo.dynamicContentId;
740
771
  } else if (nodeInfo.meshId) {
741
772
  this._setMeshNode(node, nodeInfo.meshId);
742
773
  }
743
774
 
744
775
  userData.treeNode = nodeInfo;
745
- node.setVisible(1, nodeInfo.visible ? nodeInfo.visible : true);
776
+ node.setVisible(1, nodeInfo.visible ?? true);
746
777
 
747
778
  if (nodeInfo.visualisable === false) {
748
779
  userData.skipIt = true; // Don't display this node in scene tree
@@ -778,6 +809,8 @@ sap.ui.define([
778
809
 
779
810
  if (nodeInfo.contentType === "HOTSPOT") {
780
811
  node._vkSetNodeContentType(NodeContentType.Hotspot);
812
+ } else if (nodeInfo.contentType === "DYNAMIC_CONTENT") {
813
+ node._vkSetNodeContentType(NodeContentType.DynamicContent);
781
814
  } else if (nodeInfo.contentType === "ANNOTATION") {
782
815
  node._vkSetNodeContentType(NodeContentType.Annotation);
783
816
  } else if (nodeInfo.contentType === "SVG") {
@@ -994,6 +1027,28 @@ sap.ui.define([
994
1027
  }
995
1028
  };
996
1029
 
1030
+ /**
1031
+ * Set dynamic content (represented as "parametric rectange") to scene node
1032
+ * @param {string} nodeId Identifier of the node which will have dynamic content assigned
1033
+ * @param {any} dynamicContent The dynamic content object
1034
+ * @param {any} sceneId The scene identifier
1035
+ * @public
1036
+ */
1037
+ SceneBuilder.prototype.setDynamicContent = function(nodeId, dynamicContent, sceneId) {
1038
+ this._resetCurrentScene(sceneId);
1039
+ const node = this._nodes.get(nodeId);
1040
+ if (node) {
1041
+ node.userData.templateId = dynamicContent.templateId;
1042
+ const parametricContent = {
1043
+ type: "rectangle",
1044
+ width: 1,
1045
+ height: 1
1046
+ };
1047
+ const rectangle = this._createObject(parametricContent, node);
1048
+ rectangle.fill = rectangle.stroke = [0, 0, 0, 0];
1049
+ }
1050
+ };
1051
+
997
1052
  function polarToCartesian(cx, cy, rx, ry, angle) {
998
1053
  return [cx + rx * Math.cos(angle), cy + ry * Math.sin(angle)];
999
1054
  }
@@ -1083,6 +1138,8 @@ sap.ui.define([
1083
1138
  }
1084
1139
  node.add(shape);
1085
1140
  }
1141
+
1142
+ return shape;
1086
1143
  };
1087
1144
 
1088
1145
  SceneBuilder.prototype.createImageNote = function(annotation, sceneId) {
@@ -17,6 +17,11 @@ sap.ui.define([
17
17
  ) {
18
18
  "use strict";
19
19
 
20
+ // Parametric text content types (sap::ve::core::ParametricType)
21
+ const ptParametricTextData = 10;
22
+ const ptParametricTextSpan = 11;
23
+ const ptParametricTextPath = 12;
24
+
20
25
  var Text = function(parameters) {
21
26
  parameters = parameters || {};
22
27
  Element.call(this, parameters);
@@ -28,12 +33,11 @@ sap.ui.define([
28
33
  this.style.size = this.style.size || "1em";
29
34
  this.x = parameters.x || 0;
30
35
  this.y = parameters.y || 0;
31
- if (parameters.dx) {
32
- this.dx = parameters.dx;
33
- }
34
- if (parameters.dy) {
35
- this.dy = parameters.dy;
36
- }
36
+ ["dx", "dy", "textAnchor", "alignmentBaseline", "pivot", "anchor"].forEach((prop) => {
37
+ if (parameters[prop] != null) {
38
+ this[prop] = parameters[prop];
39
+ }
40
+ });
37
41
 
38
42
  // If not specified then set default colours for text objects
39
43
  this.fillStyle = parameters.fillStyle || { colour: [0, 0, 0, 1] };
@@ -139,6 +143,12 @@ sap.ui.define([
139
143
  if (this.dy) {
140
144
  setAttributeFunc("dy", this.dy);
141
145
  }
146
+ if (this.textAnchor) {
147
+ setAttributeFunc("text-anchor", this.textAnchor);
148
+ }
149
+ if (this.alignmentBaseline) {
150
+ setAttributeFunc("alignment-baseline", this.alignmentBaseline);
151
+ }
142
152
  setStyle(this.style, setAttributeFunc, true);
143
153
  };
144
154
 
@@ -165,12 +175,12 @@ sap.ui.define([
165
175
  for (var i = 0, l = content.length; i < l; i++) {
166
176
  var c = content[i];
167
177
  switch (c.type) {
168
- case 10: // ptParametricTextData
178
+ case ptParametricTextData:
169
179
  case undefined:
170
180
  case "text":
171
181
  rm.text(c.text);
172
182
  break;
173
- case 11: // ptParametricTextSpan
183
+ case ptParametricTextSpan:
174
184
  case "span":
175
185
  rm.openStart("tspan");
176
186
  setContentAttributes(c, setAttributeFunc);
@@ -184,7 +194,7 @@ sap.ui.define([
184
194
  renderContent(c.content, rm);
185
195
  rm.close("tspan");
186
196
  break;
187
- case 12: // ptParametricTextPath
197
+ case ptParametricTextPath:
188
198
  case "path":
189
199
  rm.openStart("textPath");
190
200
  setContentAttributes(c, setAttributeFunc);
@@ -232,12 +242,12 @@ sap.ui.define([
232
242
  for (var i = 0, l = content.length; i < l; i++) {
233
243
  var c = content[i];
234
244
  switch (c.type) {
235
- case 10: // ptParametricTextData
245
+ case ptParametricTextData:
236
246
  case undefined:
237
247
  case "text":
238
248
  parentDomRef.append(c.text);
239
249
  break;
240
- case 11: // ptParametricTextSpan
250
+ case ptParametricTextSpan:
241
251
  case "span":
242
252
  domRef = document.createElementNS(Element._svgNamespace, "tspan");
243
253
  setAttributeFunc = domRef.setAttribute.bind(domRef);
@@ -251,7 +261,7 @@ sap.ui.define([
251
261
  createContent(c.content, domRef);
252
262
  parentDomRef.append(domRef);
253
263
  break;
254
- case 12: // ptParametricTextPath
264
+ case ptParametricTextPath:
255
265
  case "path":
256
266
  domRef = document.createElementNS(Element._svgNamespace, "textPath");
257
267
  setAttributeFunc = domRef.setAttribute.bind(domRef);
@@ -289,17 +299,21 @@ sap.ui.define([
289
299
  };
290
300
 
291
301
  function toPixels(size) {
302
+ let value;
292
303
  switch (typeof size) {
293
- case "number": return size;
304
+ case "number": value = size; break;
294
305
  case "string":
295
306
  if (size.endsWith("pt")) {
296
- return parseFloat(size) * 4 / 3;
307
+ value = parseFloat(size) * 4 / 3;
297
308
  } else if (size.endsWith("em")) {
298
- return parseFloat(size) * 16;
309
+ value = parseFloat(size) * 16;
310
+ } else {
311
+ value = parseFloat(size);
299
312
  }
300
- return parseFloat(size);
301
- default: return 0;
313
+ break;
314
+ default: value = 0; break;
302
315
  }
316
+ return typeof value === "number" && isFinite(value) ? value : 0;
303
317
  }
304
318
 
305
319
  function getContent(p) {
@@ -308,12 +322,12 @@ sap.ui.define([
308
322
  var node = p.childNodes[i];
309
323
  if (node.data !== undefined) {
310
324
  content.push({
311
- type: 10,
325
+ type: ptParametricTextData,
312
326
  text: node.data
313
327
  });
314
328
  } else if (node.childNodes.length > 0) {
315
329
  var tspan = {
316
- type: 11,
330
+ type: ptParametricTextSpan,
317
331
  content: getContent(node)
318
332
  };
319
333
  var nodeStyle = node.style;
@@ -363,6 +377,7 @@ sap.ui.define([
363
377
  }
364
378
 
365
379
  Text.prototype.setHtmlTextContent = function(htmlText) {
380
+ // console.log("setHtmlTextContent", htmlText);
366
381
  var htmlElem = document.createElement("html");
367
382
  htmlElem.innerHTML = htmlText;
368
383
  var content = [];
@@ -379,8 +394,8 @@ sap.ui.define([
379
394
  y += i > 0 ? maxFontSize : 0;
380
395
  }
381
396
  content.push({
382
- type: 11,
383
- x: (node.style.paddingLeft || 0) + this.x,
397
+ type: ptParametricTextSpan,
398
+ x: toPixels(node.style.paddingLeft) + this.x,
384
399
  y: y,
385
400
  content: getContent(node)
386
401
  });
@@ -389,7 +404,7 @@ sap.ui.define([
389
404
  }
390
405
  } else if (node.data) {// text node
391
406
  content.push({
392
- type: 10,
407
+ type: ptParametricTextData,
393
408
  text: node.data
394
409
  });
395
410
  }
@@ -406,14 +421,14 @@ sap.ui.define([
406
421
  for (var i = 0; i < content.length; i++) {
407
422
  var c = content[i];
408
423
  switch (c.type) {
409
- case 10:
424
+ case ptParametricTextData:
410
425
  case undefined:
411
426
  case "text":
412
427
  value += c.text;
413
428
  break;
414
- case 11:
429
+ case ptParametricTextSpan:
415
430
  case "span":
416
- case 12:
431
+ case ptParametricTextPath:
417
432
  case "path":
418
433
  var style = c.style;
419
434
  if (!inlineContent || c.y !== undefined || c.dy !== undefined) {
@@ -485,12 +500,12 @@ sap.ui.define([
485
500
  switch (c.type) {
486
501
  case undefined:
487
502
  case "text":
488
- content.push({ type: 10, text: c.text });
503
+ content.push({ type: ptParametricTextData, text: c.text });
489
504
  break;
490
505
  default:
491
506
  case "span":
492
507
  case "path":
493
- var tspan = { type: c.type === "path" ? 12 : 11 };
508
+ var tspan = { type: c.type === "path" ? ptParametricTextPath : ptParametricTextSpan };
494
509
  if (c.x !== undefined) {
495
510
  tspan.x = c.x;
496
511
  }
@@ -524,13 +539,13 @@ sap.ui.define([
524
539
  for (var i = 0; i < content.length; i++) {
525
540
  var c = content[i];
526
541
  switch (c.type) {
527
- case 10:
542
+ case ptParametricTextData:
528
543
  case undefined:
529
544
  children.push({ text: c.text });
530
545
  break;
531
- case 11:
546
+ case ptParametricTextSpan:
532
547
  case "span":
533
- case 12:
548
+ case ptParametricTextPath:
534
549
  case "path":
535
550
  var span = { type: "span" };
536
551
  if (c.x !== undefined) {
@@ -620,5 +635,32 @@ sap.ui.define([
620
635
  return this;
621
636
  };
622
637
 
638
+ Element.prototype.setCustomText = function(options) {
639
+ if (options == null || (options.text == null && options.htmlText == null)) {
640
+ this.customText = null;
641
+ return this;
642
+ }
643
+
644
+ const customText = this.customText = new Text({
645
+ text: options.text,
646
+ pivot: options.pivot ?? [0.5, 0.5],
647
+ anchor: options.anchor ?? [0.5, 0.5],
648
+ style: {
649
+ size: options.size ?? "0px",
650
+ fontFace: options.fontFamily ?? options.fontFace ?? "Arial",
651
+ fontStyle: options.fontStyle,
652
+ fontWeight: options.fontWeight,
653
+ textDecoration: options.textDecoration,
654
+ fill: options.fill ?? "black"
655
+ }
656
+ });
657
+ if (options.htmlText) {
658
+ customText.setHtmlTextContent(options.htmlText);
659
+ }
660
+ customText.userData.customText = true; // mark the custom text element for special hit test handling
661
+ return this;
662
+ };
663
+
664
+
623
665
  return Text;
624
666
  });
@@ -49,7 +49,7 @@ sap.ui.define([
49
49
  * @param {object} [mSettings] Initial settings for the new ViewStateManager object.
50
50
  * @public
51
51
  * @author SAP SE
52
- * @version 1.140.0
52
+ * @version 1.142.0
53
53
  * @extends sap.ui.vk.ViewStateManagerBase
54
54
  * @alias sap.ui.vk.svg.ViewStateManager
55
55
  * @since 1.80.0
@@ -442,7 +442,7 @@ sap.ui.define([
442
442
  var selected = parentSelected || this._selectedNodes.has(nodeRef);
443
443
 
444
444
  nodeRef.setSelected(this._mask, selected, this._highlightColorABGR);
445
- if (nodeRef.nodeContentType !== NodeContentType.Hotspot) {// recursively update highlight color for regular nodes
445
+ if (nodeRef.nodeContentType !== NodeContentType.Hotspot && nodeRef.nodeContentType !== NodeContentType.DynamicContent) {// recursively update highlight color for regular nodes
446
446
  var children = nodeRef.children;
447
447
  for (var i = 0, l = children.length; i < l; i++) {
448
448
  this._updateHighlightColor(children[i], selected);
@@ -76,23 +76,13 @@ sap.ui.define([
76
76
  *
77
77
  * @public
78
78
  * @author SAP SE
79
- * @version 1.140.0
79
+ * @version 1.142.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;