@itwin/imodel-components-react 3.5.0-dev.18 → 3.5.0-dev.19

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 (343) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts +28 -28
  3. package/lib/cjs/imodel-components-react/UiIModelComponents.js +79 -79
  4. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  5. package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  6. package/lib/cjs/imodel-components-react/color/AlphaSlider.js +186 -186
  7. package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
  8. package/lib/cjs/imodel-components-react/color/AlphaSlider.scss +63 -63
  9. package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
  10. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +107 -107
  11. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  12. package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +91 -91
  13. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  14. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +74 -74
  15. package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  16. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  17. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js +145 -145
  18. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  19. package/lib/cjs/imodel-components-react/color/ColorPickerPanel.scss +93 -93
  20. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  21. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +137 -137
  22. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  23. package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +64 -64
  24. package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +22 -22
  25. package/lib/cjs/imodel-components-react/color/HueSlider.js +199 -199
  26. package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
  27. package/lib/cjs/imodel-components-react/color/HueSlider.scss +61 -61
  28. package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  29. package/lib/cjs/imodel-components-react/color/SaturationPicker.js +213 -213
  30. package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
  31. package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +35 -35
  32. package/lib/cjs/imodel-components-react/color/Swatch.d.ts +22 -22
  33. package/lib/cjs/imodel-components-react/color/Swatch.js +60 -60
  34. package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
  35. package/lib/cjs/imodel-components-react/color/Swatch.scss +23 -23
  36. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  37. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js +23 -23
  38. package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  39. package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  40. package/lib/cjs/imodel-components-react/editors/ColorEditor.js +151 -151
  41. package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
  42. package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +18 -18
  43. package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  44. package/lib/cjs/imodel-components-react/editors/WeightEditor.js +160 -160
  45. package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
  46. package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +16 -16
  47. package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  48. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +96 -96
  49. package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  50. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  51. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +265 -265
  52. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  53. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
  54. package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  55. package/lib/cjs/imodel-components-react/lineweight/Swatch.js +85 -85
  56. package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
  57. package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +48 -48
  58. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
  59. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +159 -159
  60. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  61. package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +52 -52
  62. package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  63. package/lib/cjs/imodel-components-react/navigationaids/Cube.js +127 -127
  64. package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
  65. package/lib/cjs/imodel-components-react/navigationaids/Cube.scss +19 -19
  66. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +174 -174
  67. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +634 -634
  68. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  69. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +180 -180
  70. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  71. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +647 -647
  72. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  73. package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +133 -133
  74. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  75. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +99 -99
  76. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  77. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +64 -64
  78. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  79. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +53 -53
  80. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  81. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  82. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +83 -83
  83. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  84. package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  85. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +86 -86
  86. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  87. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  88. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +109 -109
  89. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  90. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  91. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +133 -133
  92. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  93. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  94. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +184 -184
  95. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  96. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  97. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +154 -154
  98. package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  99. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  100. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +59 -59
  101. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  102. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  103. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +47 -47
  104. package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  105. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  106. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +54 -54
  107. package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  108. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  109. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +48 -48
  110. package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  111. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  112. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +50 -50
  113. package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  114. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  115. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +58 -58
  116. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  117. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  118. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +47 -47
  119. package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  120. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  121. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +56 -56
  122. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  123. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  124. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +95 -95
  125. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  126. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  127. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js +119 -119
  128. package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  129. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  130. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js +143 -143
  131. package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  132. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  133. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js +69 -69
  134. package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  135. package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  136. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +81 -81
  137. package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  138. package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
  139. package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  140. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +91 -91
  141. package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  142. package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +25 -25
  143. package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  144. package/lib/cjs/imodel-components-react/timeline/Scrubber.js +191 -191
  145. package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
  146. package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +106 -106
  147. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  148. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +424 -424
  149. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  150. package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +357 -357
  151. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  152. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js +54 -54
  153. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  154. package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  155. package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
  156. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
  157. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +358 -358
  158. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  159. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +163 -163
  160. package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +174 -174
  161. package/lib/cjs/imodel-components-react/timeline/interfaces.js +45 -45
  162. package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
  163. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  164. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +274 -274
  165. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  166. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  167. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +105 -105
  168. package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  169. package/lib/cjs/imodel-components-react.d.ts +82 -82
  170. package/lib/cjs/imodel-components-react.js +101 -101
  171. package/lib/cjs/imodel-components-react.js.map +1 -1
  172. package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +28 -28
  173. package/lib/esm/imodel-components-react/UiIModelComponents.js +75 -75
  174. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  175. package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +36 -36
  176. package/lib/esm/imodel-components-react/color/AlphaSlider.js +160 -160
  177. package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
  178. package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
  179. package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
  180. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +82 -82
  181. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  182. package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +91 -91
  183. package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
  184. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +51 -51
  185. package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
  186. package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
  187. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js +122 -122
  188. package/lib/esm/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
  189. package/lib/esm/imodel-components-react/color/ColorPickerPanel.scss +93 -93
  190. package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
  191. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +112 -112
  192. package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
  193. package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +64 -64
  194. package/lib/esm/imodel-components-react/color/HueSlider.d.ts +22 -22
  195. package/lib/esm/imodel-components-react/color/HueSlider.js +173 -173
  196. package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
  197. package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
  198. package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +20 -20
  199. package/lib/esm/imodel-components-react/color/SaturationPicker.js +187 -187
  200. package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
  201. package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
  202. package/lib/esm/imodel-components-react/color/Swatch.d.ts +22 -22
  203. package/lib/esm/imodel-components-react/color/Swatch.js +34 -34
  204. package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
  205. package/lib/esm/imodel-components-react/color/Swatch.scss +23 -23
  206. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
  207. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js +19 -19
  208. package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
  209. package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts +44 -44
  210. package/lib/esm/imodel-components-react/editors/ColorEditor.js +124 -124
  211. package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
  212. package/lib/esm/imodel-components-react/editors/ColorEditor.scss +18 -18
  213. package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts +47 -47
  214. package/lib/esm/imodel-components-react/editors/WeightEditor.js +133 -133
  215. package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
  216. package/lib/esm/imodel-components-react/editors/WeightEditor.scss +16 -16
  217. package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts +25 -25
  218. package/lib/esm/imodel-components-react/inputs/QuantityInput.js +70 -70
  219. package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
  220. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
  221. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +240 -240
  222. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  223. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
  224. package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts +33 -33
  225. package/lib/esm/imodel-components-react/lineweight/Swatch.js +59 -59
  226. package/lib/esm/imodel-components-react/lineweight/Swatch.js.map +1 -1
  227. package/lib/esm/imodel-components-react/lineweight/Swatch.scss +48 -48
  228. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.d.ts +60 -60
  229. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +133 -133
  230. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
  231. package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +52 -52
  232. package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts +45 -45
  233. package/lib/esm/imodel-components-react/navigationaids/Cube.js +100 -100
  234. package/lib/esm/imodel-components-react/navigationaids/Cube.js.map +1 -1
  235. package/lib/esm/imodel-components-react/navigationaids/Cube.scss +19 -19
  236. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +174 -174
  237. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +606 -606
  238. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  239. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +180 -180
  240. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
  241. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +620 -620
  242. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
  243. package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +133 -133
  244. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
  245. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +76 -76
  246. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  247. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +64 -64
  248. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
  249. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +30 -30
  250. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  251. package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
  252. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +60 -60
  253. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  254. package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
  255. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +63 -63
  256. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  257. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
  258. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +83 -83
  259. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  260. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
  261. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +110 -110
  262. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  263. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
  264. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +158 -158
  265. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  266. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
  267. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +131 -131
  268. package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
  269. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
  270. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +36 -36
  271. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
  272. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
  273. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +24 -24
  274. package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
  275. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
  276. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +31 -31
  277. package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
  278. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
  279. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +25 -25
  280. package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
  281. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
  282. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +27 -27
  283. package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
  284. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
  285. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +35 -35
  286. package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
  287. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
  288. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +24 -24
  289. package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
  290. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
  291. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +33 -33
  292. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
  293. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
  294. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +69 -69
  295. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  296. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
  297. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js +96 -96
  298. package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
  299. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
  300. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js +139 -139
  301. package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
  302. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
  303. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js +65 -65
  304. package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
  305. package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
  306. package/lib/esm/imodel-components-react/timeline/InlineEdit.js +55 -55
  307. package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
  308. package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
  309. package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
  310. package/lib/esm/imodel-components-react/timeline/PlayerButton.js +64 -64
  311. package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
  312. package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +25 -25
  313. package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +54 -54
  314. package/lib/esm/imodel-components-react/timeline/Scrubber.js +164 -164
  315. package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
  316. package/lib/esm/imodel-components-react/timeline/Scrubber.scss +106 -106
  317. package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
  318. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +398 -398
  319. package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
  320. package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +357 -357
  321. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
  322. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js +28 -28
  323. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
  324. package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
  325. package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
  326. package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
  327. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +332 -332
  328. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  329. package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +163 -163
  330. package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +174 -174
  331. package/lib/esm/imodel-components-react/timeline/interfaces.js +42 -42
  332. package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
  333. package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
  334. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +251 -251
  335. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  336. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
  337. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +95 -95
  338. package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
  339. package/lib/esm/imodel-components-react.d.ts +82 -82
  340. package/lib/esm/imodel-components-react.js +87 -87
  341. package/lib/esm/imodel-components-react.js.map +1 -1
  342. package/lib/public/locales/en/UiIModelComponents.json +139 -139
  343. package/package.json +19 -19
@@ -1,648 +1,648 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module NavigationAids
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.DrawingNavigationCanvas = exports.DrawingNavigationAid = exports.MapMode = void 0;
33
- require("./DrawingNavigationAid.scss");
34
- const classnames_1 = __importDefault(require("classnames"));
35
- const React = __importStar(require("react"));
36
- const ReactDOM = __importStar(require("react-dom"));
37
- const core_geometry_1 = require("@itwin/core-geometry");
38
- const core_frontend_1 = require("@itwin/core-frontend");
39
- const appui_abstract_1 = require("@itwin/appui-abstract");
40
- const UiIModelComponents_1 = require("../UiIModelComponents");
41
- const ViewportComponentEvents_1 = require("../viewport/ViewportComponentEvents");
42
- // cSpell:ignore Quaternion Quaternions unrotate
43
- /* eslint-disable jsx-a11y/click-events-have-key-events */
44
- /**
45
- * Enum for mode that minimap is currently in
46
- * @internal
47
- */
48
- var MapMode;
49
- (function (MapMode) {
50
- MapMode["Opened"] = "map-opened";
51
- MapMode["Closed"] = "map-closed";
52
- })(MapMode = exports.MapMode || (exports.MapMode = {}));
53
- /**
54
- * A Drawing Navigation Aid.
55
- * @public
56
- */
57
- class DrawingNavigationAid extends React.Component {
58
- constructor(props) {
59
- super(props);
60
- this._rootElement = React.createRef();
61
- this._viewContainerElement = React.createRef();
62
- this._viewElement = React.createRef();
63
- this._rootOffset = DOMRect.fromRect({ x: 0, y: 0, width: 0, height: 0 });
64
- this._mounted = false;
65
- this._isViewport3D = () => {
66
- return this.state.view !== undefined && this.state.view.is3d();
67
- };
68
- this._animation = () => {
69
- const t = Date.now();
70
- const delta = this._lastTime ? t - this._lastTime : 16;
71
- this._lastTime = t;
72
- if (this.state.animation !== 1) {
73
- const animation = Math.min(1, this.state.animation + delta / (1000 * (this.props.animationTime || 0.4)));
74
- this._updateFrustum();
75
- // istanbul ignore next
76
- if (this._mounted) {
77
- this.setState({ animation }, () => {
78
- this._animationFrame = setTimeout(this._animation, 16.667);
79
- });
80
- }
81
- }
82
- else {
83
- this._lastTime = undefined;
84
- this._animationEnd();
85
- }
86
- };
87
- this._animationEnd = () => {
88
- const hasViewportMoved = !this.state.origin.isAlmostEqual(this.state.startOrigin) ||
89
- !this.state.rotation.isAlmostEqual(this.state.startRotation);
90
- const startMapOrigin = core_geometry_1.Point3d.createFrom(this.state.mapOrigin);
91
- const startMapExtents = core_geometry_1.Vector3d.createFrom(this.state.mapExtents);
92
- const startDrawingZoom = this.state.drawingZoom;
93
- const startOrigin = this.state.origin;
94
- const startRotation = this.state.rotation;
95
- // istanbul ignore next
96
- if (this._mounted) {
97
- this.setState({ startMapOrigin, startDrawingZoom, startOrigin, startRotation, startMapExtents }, () => {
98
- // istanbul ignore else
99
- if (this.props.onAnimationEnd)
100
- this.props.onAnimationEnd();
101
- if (hasViewportMoved)
102
- this._updateFrustum(true);
103
- });
104
- }
105
- };
106
- this._panAnimation = () => {
107
- const t = Date.now();
108
- if (this._lastPanTime === undefined)
109
- this._lastPanTime = t - 16.667;
110
- const delta = t - this._lastPanTime;
111
- this._lastPanTime = t;
112
- // istanbul ignore else
113
- if (!this.state.panningDirection.isAlmostZero && this.state.isMoving) {
114
- const { panningDirection } = this.state;
115
- const offset = panningDirection.scale(delta / 1000 / this.state.drawingZoom);
116
- const mapOrigin = this.state.mapOrigin.plus(offset);
117
- const origin = this.state.origin.plus(offset);
118
- this._updateFrustum();
119
- // istanbul ignore next
120
- if (this._mounted) {
121
- this.setState({ mapOrigin, origin, panningDirection }, () => {
122
- this._animationFrame = setTimeout(this._panAnimation, 16.667);
123
- });
124
- }
125
- }
126
- else {
127
- this._lastPanTime = undefined;
128
- this._updateFrustum(true);
129
- }
130
- };
131
- // Synchronize with rotation coming from the Viewport
132
- this._handleViewRotationChangeEvent = (args) => {
133
- // istanbul ignore else
134
- if (!this.state.isMoving && !this.state.isPanning && this.props.viewport === args.viewport) {
135
- const extents = args.viewport.view.getExtents().clone();
136
- const rotation = args.viewport.view.getRotation().clone();
137
- const halfExtents = extents.scale(.5);
138
- const offset = this.state.rotateMinimapWithView || this._isViewport3D() ? rotation.multiplyTransposeVector(halfExtents) : halfExtents;
139
- const origin = args.viewport.view.getOrigin().plus(offset);
140
- const deltaZoom = (this.state.extents.x - extents.x) / this.state.extents.x;
141
- let drawingZoom = this.state.drawingZoom / (1 - deltaZoom);
142
- const deltaOrigin = origin.minus(this.state.origin);
143
- let mapOrigin = this.state.mapOrigin.plus(deltaOrigin);
144
- mapOrigin = mapOrigin.plus(core_geometry_1.Vector3d.createFrom(origin.minus(mapOrigin)).scale(deltaZoom));
145
- if (this.state.viewId !== args.viewport.view.id) {
146
- const rect = this.state.rotateMinimapWithView || this._isViewport3D() ? extents : DrawingNavigationAid.findRotatedWindowDimensions(extents, rotation);
147
- const maxRectDim = Math.max(rect.y, rect.x);
148
- const maxExtentDim = Math.max(this.state.mapExtents.x, this.state.mapExtents.y);
149
- drawingZoom = maxExtentDim / (3 * maxRectDim);
150
- mapOrigin = origin.clone();
151
- this._viewport = args.viewport;
152
- this.setState({ viewId: args.viewport.view.id, view: args.viewport.view.clone() });
153
- }
154
- // istanbul ignore next
155
- if (this._mounted) {
156
- this.setState({
157
- startOrigin: origin, origin, extents,
158
- startRotation: rotation, rotation,
159
- startMapOrigin: mapOrigin, mapOrigin,
160
- startDrawingZoom: drawingZoom, drawingZoom,
161
- });
162
- }
163
- }
164
- };
165
- this._updateFrustum = (complete = false) => {
166
- const halfExtents = this.state.extents.scale(.5);
167
- const offset = this.state.rotateMinimapWithView || this._isViewport3D() ? this.state.rotation.multiplyTransposeVector(halfExtents) : halfExtents;
168
- const origin = this.state.origin.minus(offset);
169
- ViewportComponentEvents_1.ViewportComponentEvents.setDrawingViewportState(origin, this.state.rotation, complete);
170
- };
171
- this._toggleRotationMode = () => {
172
- const rotateMinimapWithView = !this.state.rotateMinimapWithView;
173
- this.setState({ rotateMinimapWithView }, () => {
174
- if (this._viewport)
175
- this._handleViewRotationChangeEvent({ viewport: this._viewport });
176
- });
177
- };
178
- this._handleKeyUp = (event) => {
179
- // istanbul ignore else
180
- if (event.key === appui_abstract_1.SpecialKey.Escape && this.state.mode === MapMode.Opened) {
181
- this._closeLargeMap();
182
- }
183
- };
184
- this._lastClientXY = core_geometry_1.Point2d.createZero();
185
- this._handleMouseDown = (event) => {
186
- // Used only to determine if mouse was moved between mousedown and mouseup
187
- const mouseStart = core_geometry_1.Point2d.create(event.clientX, event.clientY);
188
- this.setState({ mouseStart });
189
- this._lastClientXY = core_geometry_1.Point2d.create(event.clientX, event.clientY);
190
- };
191
- this._handleDrawingMouseDown = (event) => {
192
- if (this.state.mode === MapMode.Opened) {
193
- event.preventDefault();
194
- this.setState({ isPanning: true });
195
- }
196
- };
197
- this._handleWindowMouseDown = (event) => {
198
- event.preventDefault();
199
- this.setState({ isMoving: true });
200
- };
201
- this._handleMouseDrag = (event) => {
202
- const mouse = core_geometry_1.Point2d.create(event.clientX, event.clientY);
203
- const movement = mouse.minus(this._lastClientXY);
204
- if (this.state.isMoving) {
205
- // add scaled mouse movement
206
- this._processWindowDrag(movement);
207
- }
208
- else {
209
- // istanbul ignore else
210
- if (this.state.isPanning && this.state.mode === MapMode.Opened) {
211
- const vect = core_geometry_1.Vector3d.create(movement.x / this.state.drawingZoom, -movement.y / this.state.drawingZoom, 0);
212
- const offset = this.state.rotateMinimapWithView || this._isViewport3D() ? this.state.rotation.multiplyTransposeVector(vect) : vect;
213
- const mapOrigin = this.state.mapOrigin.minus(offset);
214
- this.setState({ startMapOrigin: mapOrigin, mapOrigin });
215
- }
216
- }
217
- this._lastClientXY = mouse;
218
- };
219
- this._handleMouseDragEnd = (event) => {
220
- const mouse = core_geometry_1.Point2d.create(event.clientX, event.clientY);
221
- if (mouse.isAlmostEqual(this.state.mouseStart) &&
222
- this.state.mode === MapMode.Closed &&
223
- (event.target === this._viewContainerElement.current || event.target === this._viewElement.current)) {
224
- this._openLargeMap();
225
- }
226
- else if (this.state.isMoving) {
227
- this._processWindowEndDrag();
228
- }
229
- else if (this.state.isPanning) {
230
- // istanbul ignore else
231
- if (this.state.mode === MapMode.Opened) {
232
- event.stopPropagation();
233
- this.setState({ isPanning: false });
234
- }
235
- }
236
- else if ((!(event.target instanceof Node) || this._rootElement.current && !this._rootElement.current.contains(event.target)) && mouse.isAlmostEqual(this.state.mouseStart)) {
237
- this._closeLargeMap();
238
- }
239
- this._lastClientXY = core_geometry_1.Point2d.create(event.clientX, event.clientY);
240
- };
241
- // istanbul ignore next - unable to test touch
242
- this._handleWindowTouchStart = (event) => {
243
- if (1 !== event.targetTouches.length)
244
- return;
245
- window.addEventListener("touchmove", this._onTouchMove, false);
246
- window.addEventListener("touchend", this._onTouchEnd, false);
247
- const mouseStart = core_geometry_1.Point2d.create(event.targetTouches[0].clientX, event.targetTouches[0].clientY);
248
- this.setState({ mouseStart });
249
- this._lastClientXY = mouseStart.clone();
250
- this.setState({ isMoving: true });
251
- };
252
- // istanbul ignore next - unable to test touch
253
- this._onTouchMove = (event) => {
254
- if (1 !== event.targetTouches.length)
255
- return;
256
- const mouse = core_geometry_1.Point2d.create(event.targetTouches[0].clientX, event.targetTouches[0].clientY);
257
- const movement = mouse.minus(this._lastClientXY);
258
- // add scaled mouse movement
259
- this._processWindowDrag(movement);
260
- this._lastClientXY = mouse;
261
- };
262
- // istanbul ignore next - unable to test touch
263
- this._onTouchEnd = (event) => {
264
- if (0 !== event.targetTouches.length)
265
- return;
266
- this._processWindowEndDrag();
267
- if (0 !== event.changedTouches.length)
268
- this._lastClientXY = core_geometry_1.Point2d.create(event.changedTouches[0].clientX, event.changedTouches[0].clientY); // Doesn't seem necessary...but _handleMouseDragEnd sets it...
269
- window.removeEventListener("touchmove", this._onTouchMove);
270
- window.removeEventListener("touchend", this._onTouchEnd);
271
- };
272
- this._getClosedMapSize = () => {
273
- if (this.props.closeSize === undefined)
274
- return DrawingNavigationAid.getDefaultClosedMapSize();
275
- return this.props.closeSize;
276
- };
277
- this._getOpenedMapSize = () => {
278
- if (this.props.openSize === undefined)
279
- return DrawingNavigationAid.getDefaultOpenedMapSize(this._rootOffset.right, this._rootOffset.top);
280
- return this.props.openSize;
281
- };
282
- this._openLargeMap = () => {
283
- // istanbul ignore else
284
- if (this.state.mode === MapMode.Closed && this.state.animation === 1.0) {
285
- // istanbul ignore else
286
- if (this._rootElement.current) {
287
- const rect = this._rootElement.current.getBoundingClientRect();
288
- this._rootOffset = rect;
289
- }
290
- const startMapExtents = core_geometry_1.Vector3d.createFrom(this.state.mapExtents);
291
- const mapExtents = this._getOpenedMapSize();
292
- this.setState({
293
- mode: MapMode.Opened,
294
- isMoving: false, isPanning: false,
295
- mapExtents, startMapExtents,
296
- animation: 0,
297
- }, () => {
298
- this._animationFrame = setTimeout(this._animation);
299
- });
300
- }
301
- };
302
- this._closeLargeMap = () => {
303
- // istanbul ignore else
304
- if (this.state.mode === MapMode.Opened && this.state.animation === 1.0) {
305
- const startMapOrigin = this.state.mapOrigin;
306
- const mapOrigin = this.state.origin.clone();
307
- const startMapExtents = core_geometry_1.Vector3d.createFrom(this.state.mapExtents);
308
- const mapExtents = this._getClosedMapSize();
309
- const rect = this.state.rotateMinimapWithView || this._isViewport3D() ? this.state.extents : DrawingNavigationAid.findRotatedWindowDimensions(this.state.extents, this.state.rotation);
310
- const maxRectDim = Math.max(rect.y, rect.x);
311
- const maxExtentDim = Math.max(mapExtents.x, mapExtents.y);
312
- const drawingZoom = maxExtentDim / (3 * maxRectDim);
313
- const startDrawingZoom = this.state.drawingZoom;
314
- this.setState({
315
- mode: MapMode.Closed,
316
- startMapOrigin, mapOrigin,
317
- startDrawingZoom, drawingZoom,
318
- isMoving: false, isPanning: false,
319
- startMapExtents, mapExtents,
320
- panningDirection: core_geometry_1.Vector3d.createZero(),
321
- animation: 0,
322
- }, () => {
323
- this._animationFrame = setTimeout(this._animation, 16.667);
324
- });
325
- }
326
- };
327
- this._getPanVector = () => {
328
- const is3D = this._isViewport3D();
329
- const rect = this.state.rotateMinimapWithView || is3D ? this.state.extents : DrawingNavigationAid.findRotatedWindowDimensions(this.state.extents, this.state.rotation);
330
- const mapExtents = this.state.mapExtents.scale(1 / this.state.drawingZoom);
331
- const maxMagnitude = 80; // maximum acceleration
332
- const magnitudeTravel = 30; // How far, in pixels, that magnitude increases from 0 to max acceleration
333
- const diff = core_geometry_1.Vector3d.createFrom(this.state.origin.minus(this.state.mapOrigin));
334
- const diffVector = this.state.rotateMinimapWithView || is3D ? this.state.rotation.multiplyVector(diff) : diff;
335
- // capture any values
336
- const magnitudeVector = core_geometry_1.Vector3d.create(Math.max(0, Math.abs(diffVector.x) - (mapExtents.x - rect.x) / 2), Math.max(0, Math.abs(diffVector.y) - (mapExtents.y - rect.y) / 2));
337
- if (magnitudeVector.isAlmostZero)
338
- return core_geometry_1.Vector3d.createZero();
339
- const magnitude = Math.min(magnitudeVector.magnitude() * this.state.drawingZoom, magnitudeTravel) / magnitudeTravel * maxMagnitude;
340
- const vect = core_geometry_1.Vector3d.createFrom(this.state.origin.minus(this.state.mapOrigin)); // vect will never be zero or magnitude would also be zero
341
- const norm = vect.normalize();
342
- return norm.scale(magnitude); // norm is only undefined when vect is zero, in which it would have returned at magnitudeVector.isAlmostZero
343
- };
344
- this._handleWheel = (event) => {
345
- // istanbul ignore else
346
- if (this.state.mode === MapMode.Opened && this.state.animation === 1) {
347
- const { mapOrigin, drawingZoom } = this.state;
348
- const mapSize = this._getOpenedMapSize();
349
- const mouseX = event.clientX - this._rootOffset.right + mapSize.x / 2;
350
- const mouseY = event.clientY - this._rootOffset.top - mapSize.y / 2;
351
- const is3D = this._isViewport3D();
352
- if (event.deltaY < 0) {
353
- const zoom = drawingZoom * 1.1;
354
- const vect = core_geometry_1.Vector3d.create(mouseX * 0.1 / zoom, -mouseY * 0.1 / zoom, 0);
355
- const offset = this.state.rotateMinimapWithView || is3D ? this.state.rotation.multiplyTransposeVector(vect) : vect;
356
- const m = mapOrigin.plus(offset);
357
- this.setState({ mapOrigin: m, drawingZoom: zoom });
358
- }
359
- if (event.deltaY > 0) {
360
- const zoom = drawingZoom / 1.1;
361
- const vect = core_geometry_1.Vector3d.create(mouseX * 0.1 / drawingZoom, -mouseY * 0.1 / drawingZoom, 0);
362
- const offset = this.state.rotateMinimapWithView || is3D ? this.state.rotation.multiplyTransposeVector(vect) : vect;
363
- const m = mapOrigin.minus(offset);
364
- this.setState({ mapOrigin: m, drawingZoom: zoom });
365
- }
366
- }
367
- };
368
- this._handleZoomIn = () => {
369
- const zoom = this.state.drawingZoom * 1.4;
370
- this.setState({ drawingZoom: zoom });
371
- };
372
- this._handleZoomOut = () => {
373
- const zoom = this.state.drawingZoom / 1.4;
374
- this.setState({ drawingZoom: zoom });
375
- };
376
- this._handleUnrotate = () => {
377
- const startRotation = this.state.rotation;
378
- const halfExtents = this.state.extents.scale(.5);
379
- const offset = this.state.rotateMinimapWithView || this._isViewport3D() ? core_geometry_1.Vector3d.createZero() : this.state.rotation.multiplyTransposeVector(halfExtents).minus(halfExtents);
380
- const startOrigin = this.state.origin;
381
- const origin = this.state.origin.plus(offset);
382
- const startMapOrigin = this.state.mapOrigin;
383
- const mapOrigin = this.state.mapOrigin.plus(offset);
384
- this.setState({ animation: 0, startOrigin, origin, startMapOrigin, mapOrigin, startRotation, rotation: core_geometry_1.Matrix3d.createIdentity() }, () => {
385
- this._animationFrame = setTimeout(this._animation, 16.667);
386
- });
387
- };
388
- const mode = props.initialMapMode || MapMode.Closed;
389
- const mapExtents = mode === MapMode.Closed ? this._getClosedMapSize() : this._getOpenedMapSize();
390
- const startMapExtents = mapExtents;
391
- this.state = {
392
- startOrigin: core_geometry_1.Point3d.createZero(),
393
- origin: core_geometry_1.Point3d.createZero(),
394
- extents: core_geometry_1.Vector3d.create(1, 1, 1),
395
- startRotation: core_geometry_1.Matrix3d.createIdentity(),
396
- rotation: core_geometry_1.Matrix3d.createIdentity(),
397
- startMapOrigin: core_geometry_1.Point3d.createZero(),
398
- mapOrigin: core_geometry_1.Point3d.createZero(),
399
- startMapExtents,
400
- mapExtents,
401
- mouseStart: core_geometry_1.Point2d.createZero(),
402
- panningDirection: core_geometry_1.Vector3d.createZero(),
403
- startDrawingZoom: 1.0,
404
- drawingZoom: 1.0,
405
- mode,
406
- animation: 1.0,
407
- viewId: props.initialView !== undefined ? props.initialView.id : "",
408
- view: props.initialView,
409
- isMoving: false,
410
- isPanning: false,
411
- rotateMinimapWithView: props.initialRotateMinimapWithView !== undefined ? props.initialRotateMinimapWithView : false,
412
- };
413
- }
414
- /** @internal */
415
- render() {
416
- const { startOrigin, origin, extents, startRotation, rotation, startMapOrigin, mapOrigin, startMapExtents, mapExtents, startDrawingZoom, drawingZoom, animation, viewId, mode, rotateMinimapWithView, } = this.state;
417
- const a = DrawingNavigationAid._animationFn(animation);
418
- const rot = core_geometry_1.Matrix3d.createFromQuaternion(core_geometry_1.Point4d.interpolateQuaternions(startRotation.toQuaternion(), a, rotation.toQuaternion()));
419
- const or = startOrigin.interpolate(a, origin);
420
- const map = startMapOrigin.interpolate(a, mapOrigin);
421
- const sz = startMapExtents.interpolate(a, mapExtents);
422
- const dz = core_geometry_1.Geometry.interpolate(startDrawingZoom, a, drawingZoom);
423
- const rootStyle = {
424
- width: sz.x, height: sz.y,
425
- ...this.props.style,
426
- };
427
- const is3D = this._isViewport3D();
428
- const tOr = rotateMinimapWithView || is3D ? rotation.multiplyVector(core_geometry_1.Vector3d.createFrom(or)) : core_geometry_1.Vector3d.createFrom(or);
429
- const tMap = rotateMinimapWithView || is3D ? rotation.multiplyVector(core_geometry_1.Vector3d.createFrom(map)) : core_geometry_1.Vector3d.createFrom(map);
430
- const tPosX = (tOr.x - extents.x / 2 - tMap.x) * dz + sz.x / 2;
431
- const tPosY = (-tOr.y - extents.y / 2 + tMap.y) * dz + sz.y / 2;
432
- const viewWindowStyle = {
433
- transform: `translate(${tPosX}px, ${tPosY}px)`,
434
- height: extents.y * dz,
435
- width: extents.x * dz,
436
- };
437
- if (!rotateMinimapWithView && !is3D)
438
- viewWindowStyle.transform =
439
- "matrix3d(" +
440
- `${rot.at(0, 0)}, ${rot.at(1, 0)}, ${rot.at(2, 0)}, 0, ` +
441
- `${rot.at(0, 1)}, ${rot.at(1, 1)}, ${rot.at(2, 1)}, 0, ` +
442
- `${rot.at(0, 2)}, ${rot.at(1, 2)}, ${rot.at(2, 2)}, 0, ` +
443
- `${tPosX}, ${tPosY}, 0, 1)`;
444
- const isAnimating = animation !== 1 && !startMapExtents.isExactEqual(mapExtents);
445
- if (mode === MapMode.Opened || isAnimating) {
446
- rootStyle.position = "fixed";
447
- rootStyle.right = window.innerWidth - this._rootOffset.right;
448
- rootStyle.top = this._rootOffset.top;
449
- }
450
- const halfExtents = extents.scale(.5);
451
- const offset = rotateMinimapWithView || is3D ? core_geometry_1.Vector3d.createZero() : rotation.multiplyTransposeVector(halfExtents).minus(halfExtents);
452
- const unrotateLabel = UiIModelComponents_1.UiIModelComponents.translate("drawing.unrotate");
453
- const e = sz.scale(1 / dz);
454
- const halfMapExtents = e.scale(.5);
455
- const mapOffset = rotateMinimapWithView || is3D ? rotation.multiplyTransposeVector(halfMapExtents) : halfMapExtents;
456
- const viewManager = this.props.viewManagerOverride ? this.props.viewManagerOverride : /* istanbul ignore next */ core_frontend_1.IModelApp.viewManager;
457
- const screenViewport = this.props.screenViewportOverride ? this.props.screenViewportOverride : /* istanbul ignore next */ core_frontend_1.ScreenViewport;
458
- const nodes = (React.createElement("div", { className: (0, classnames_1.default)("components-drawing-navigation-aid", this.props.className), "data-testid": "components-drawing-navigation-aid", ref: this._rootElement, onWheel: this._handleWheel, onMouseDown: this._handleDrawingMouseDown, style: rootStyle, role: "presentation" },
459
- React.createElement(DrawingNavigationCanvas, { view: this.state.view, viewManagerOverride: viewManager, screenViewportOverride: screenViewport, viewId: viewId, origin: map.plus(offset).minus(mapOffset), extents: e, zoom: dz, rotation: rotateMinimapWithView || is3D ? rotation : core_geometry_1.Matrix3d.createIdentity() }),
460
- React.createElement("div", { className: "drawing-container", "data-testid": "drawing-container", ref: this._viewContainerElement },
461
- React.createElement("div", { className: "drawing-view-window", "data-testid": "drawing-view-window", onMouseDown: this._handleWindowMouseDown, onTouchStart: this._handleWindowTouchStart, style: viewWindowStyle, ref: this._viewElement, role: "presentation" }),
462
- !is3D &&
463
- React.createElement("div", { className: (0, classnames_1.default)("toggle-rotate-style", "icon", "icon-rotate-left", { checked: rotateMinimapWithView }), "data-testid": "toggle-rotate-style", style: mode === MapMode.Closed && !isAnimating ? { bottom: 2, left: 2 } : {}, title: UiIModelComponents_1.UiIModelComponents.translate("drawing.rotateStyle"), onClick: this._toggleRotationMode, role: "presentation" }),
464
- !rot.isIdentity &&
465
- React.createElement("div", { className: "unrotate-button", "data-testid": "drawing-unrotate-button", style: mode === MapMode.Closed && !isAnimating ? { top: 2 } : {}, onClick: this._handleUnrotate, role: "button", tabIndex: -1 }, unrotateLabel),
466
- mode === MapMode.Opened && !isAnimating && React.createElement(React.Fragment, null,
467
- React.createElement("div", { className: "close", "data-testid": "drawing-close-button", onClick: this._closeLargeMap, role: "button", tabIndex: -1 },
468
- React.createElement("div", { className: "close-icon icon icon-sort-up" })),
469
- React.createElement("div", { className: "zoom" },
470
- React.createElement("div", { className: "zoom-button icon icon-add", "data-testid": "drawing-zoom-in-button", onClick: this._handleZoomIn, role: "button", tabIndex: -1 }),
471
- React.createElement("div", { className: "zoom-button icon icon-remove-2", "data-testid": "drawing-zoom-out-button", onClick: this._handleZoomOut, role: "button", tabIndex: -1 }))))));
472
- if (mode === MapMode.Closed && (animation === 1.0 || startMapExtents.isExactEqual(mapExtents))) {
473
- return nodes;
474
- }
475
- else {
476
- let drawingPortal = document.querySelector("#components-drawing-portal");
477
- if (!drawingPortal) {
478
- drawingPortal = document.createElement("div");
479
- drawingPortal.id = "components-drawing-portal";
480
- document.body.appendChild(drawingPortal);
481
- }
482
- return ReactDOM.createPortal(nodes, drawingPortal);
483
- }
484
- }
485
- componentDidMount() {
486
- this._mounted = true;
487
- ViewportComponentEvents_1.ViewportComponentEvents.onViewRotationChangeEvent.addListener(this._handleViewRotationChangeEvent);
488
- window.addEventListener("mousedown", this._handleMouseDown);
489
- window.addEventListener("mouseup", this._handleMouseDragEnd);
490
- window.addEventListener("mousemove", this._handleMouseDrag);
491
- window.addEventListener("keyup", this._handleKeyUp);
492
- }
493
- componentWillUnmount() {
494
- ViewportComponentEvents_1.ViewportComponentEvents.onViewRotationChangeEvent.removeListener(this._handleViewRotationChangeEvent);
495
- window.removeEventListener("mousedown", this._handleMouseDown);
496
- window.removeEventListener("mouseup", this._handleMouseDragEnd);
497
- window.removeEventListener("mousemove", this._handleMouseDrag);
498
- window.removeEventListener("keyup", this._handleKeyUp);
499
- clearTimeout(this._animationFrame);
500
- if (this.props.onAnimationEnd)
501
- this.props.onAnimationEnd();
502
- const rt = document.getElementById("components-drawing-portal");
503
- if (rt && rt.parentElement !== null && rt.children.length === 0) {
504
- rt.parentElement.removeChild(rt);
505
- }
506
- this._mounted = false;
507
- }
508
- _processWindowDrag(movement) {
509
- const vect = core_geometry_1.Vector3d.create(movement.x / this.state.drawingZoom, -movement.y / this.state.drawingZoom, 0);
510
- const offset = this.state.rotateMinimapWithView || this._isViewport3D() ? this.state.rotation.multiplyTransposeVector(vect) : vect;
511
- const origin = this.state.origin.plus(offset);
512
- const panningDirection = this._getPanVector();
513
- const wasAlmostZero = this.state.panningDirection.isAlmostZero;
514
- this.setState({ startOrigin: origin, origin, panningDirection, isPanning: false }, () => {
515
- this._updateFrustum();
516
- if (wasAlmostZero && !this.state.panningDirection.isAlmostZero) {
517
- this._animationFrame = setTimeout(this._panAnimation, 16.667);
518
- }
519
- });
520
- }
521
- _processWindowEndDrag() {
522
- this.setState({ isMoving: false });
523
- this._updateFrustum(true);
524
- if (this.state.mode === MapMode.Closed) {
525
- setTimeout(() => {
526
- const startMapOrigin = this.state.mapOrigin;
527
- const mapOrigin = this.state.origin.clone();
528
- // istanbul ignore next
529
- if (this._mounted) {
530
- this.setState({ startMapOrigin, mapOrigin, animation: 0 }, () => {
531
- this._animationFrame = setTimeout(this._animation, 16.667);
532
- });
533
- }
534
- }, 0);
535
- }
536
- }
537
- }
538
- exports.DrawingNavigationAid = DrawingNavigationAid;
539
- DrawingNavigationAid._animationFn = (t) => t < .5 ? 2 * t ** 2 : -1 + (4 - 2 * t) * t;
540
- /** @internal */
541
- DrawingNavigationAid.getDefaultClosedMapSize = () => {
542
- return core_geometry_1.Vector3d.create(96, 96);
543
- };
544
- /** @internal */
545
- DrawingNavigationAid.getDefaultOpenedMapSize = (paddingX = 0, paddingY = 0) => {
546
- return core_geometry_1.Vector3d.create(window.innerWidth / 3 - 2 * (window.innerWidth - paddingX), window.innerHeight / 3 - 2 * paddingY);
547
- };
548
- /** @internal */
549
- DrawingNavigationAid.findRotatedWindowDimensions = (extents, rotation) => {
550
- const cos = rotation.at(0, 0);
551
- const sin = rotation.at(1, 0);
552
- // extents.x/y should be divided in half, but we don't have to do that immediately.
553
- const cosWidth = cos * extents.x;
554
- const sinHeight = sin * extents.y;
555
- const sinWidth = cos * extents.x;
556
- const cosHeight = sin * extents.y;
557
- const a = Math.atan2(sin, cos);
558
- if (a % Math.PI >= 0 && a % Math.PI < Math.PI / 2) {
559
- const y1 = -cosHeight - sinWidth;
560
- const x2 = cosWidth + sinHeight;
561
- const y3 = cosHeight + sinWidth;
562
- const x4 = -cosWidth - sinHeight;
563
- // Instead, divide total difference
564
- return core_geometry_1.Vector3d.create(Math.abs(x2 - x4) / 2, Math.abs(y1 - y3) / 2);
565
- }
566
- else {
567
- const x1 = -cosWidth + sinHeight;
568
- const y2 = -cosHeight + sinWidth;
569
- const x3 = cosWidth - sinHeight;
570
- const y4 = cosHeight - sinWidth;
571
- return core_geometry_1.Vector3d.create(Math.abs(x1 - x3) / 2, Math.abs(y2 - y4) / 2);
572
- }
573
- };
574
- /** @internal */
575
- class DrawingNavigationCanvas extends React.Component {
576
- constructor() {
577
- super(...arguments);
578
- this._canvasElement = React.createRef();
579
- this._update = () => {
580
- // istanbul ignore else
581
- if (this._vp) {
582
- const max = Math.max(this.props.extents.x, this.props.extents.y);
583
- this._vp.view.extentLimits = { max, min: core_geometry_1.Constant.oneMillimeter };
584
- this._vp.view.setOrigin(this.props.origin);
585
- this._vp.view.setRotation(this.props.rotation);
586
- this._vp.view.setExtents(this.props.extents);
587
- this._vp.applyViewState(this._vp.view);
588
- }
589
- };
590
- }
591
- render() {
592
- return (React.createElement("div", { className: "drawing-canvas", "data-testid": "drawing-canvas", ref: this._canvasElement }));
593
- }
594
- componentDidMount() {
595
- if (this._canvasElement.current && this.props.view !== undefined) {
596
- const viewManager = this.props.viewManagerOverride ? this.props.viewManagerOverride : /* istanbul ignore next */ core_frontend_1.IModelApp.viewManager;
597
- /* istanbul ignore next */
598
- const screenViewport = this.props.screenViewportOverride ? this.props.screenViewportOverride : /* istanbul ignore next */ core_frontend_1.ScreenViewport;
599
- const previousView = viewManager.selectedView;
600
- this._vp = screenViewport.create(this._canvasElement.current, this.props.view);
601
- this.customizeViewport(this._vp);
602
- viewManager.addViewport(this._vp);
603
- void viewManager.setSelectedView(previousView); // switch to original viewport
604
- this._update();
605
- }
606
- }
607
- customizeViewport(vp) {
608
- /* istanbul ignore next */
609
- if (vp.logo.style)
610
- vp.logo.style.display = "none";
611
- /* istanbul ignore next */
612
- if (vp.viewFlags.acsTriad)
613
- vp.viewFlags = vp.viewFlags.with("acsTriad", false);
614
- }
615
- componentDidUpdate(oldProps) {
616
- const viewManager = this.props.viewManagerOverride ? this.props.viewManagerOverride : /* istanbul ignore next */ core_frontend_1.IModelApp.viewManager;
617
- if (this.props.view !== undefined) {
618
- if (oldProps.view !== this.props.view) {
619
- const screenViewport = this.props.screenViewportOverride ? this.props.screenViewportOverride : /* istanbul ignore next */ core_frontend_1.ScreenViewport;
620
- if (oldProps !== undefined && oldProps.viewId !== "" && oldProps.viewId !== this.props.viewId && this._vp) {
621
- viewManager.dropViewport(this._vp, true);
622
- }
623
- // istanbul ignore else
624
- if (this._canvasElement.current &&
625
- (this.props.canvasSizeOverride ||
626
- ( /* istanbul ignore next */this._canvasElement.current.clientWidth !== 0 && /* istanbul ignore next */ this._canvasElement.current.clientHeight !== 0))) {
627
- const previousView = viewManager.selectedView;
628
- this._vp = screenViewport.create(this._canvasElement.current, this.props.view.clone());
629
- this.customizeViewport(this._vp);
630
- viewManager.addViewport(this._vp);
631
- void viewManager.setSelectedView(previousView); // switch to original viewport
632
- this._update();
633
- }
634
- }
635
- else if (!this.props.origin.isExactEqual(oldProps.origin) || !this.props.extents.isExactEqual(oldProps.extents) || this.props.zoom !== oldProps.zoom || !this.props.rotation.isExactEqual(oldProps.rotation)) {
636
- this._update();
637
- }
638
- }
639
- }
640
- componentWillUnmount() {
641
- if (this._vp) {
642
- const viewManager = this.props.viewManagerOverride ? this.props.viewManagerOverride : /* istanbul ignore next */ core_frontend_1.IModelApp.viewManager;
643
- viewManager.dropViewport(this._vp, true);
644
- }
645
- }
646
- }
647
- exports.DrawingNavigationCanvas = DrawingNavigationCanvas;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module NavigationAids
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ var __importDefault = (this && this.__importDefault) || function (mod) {
29
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.DrawingNavigationCanvas = exports.DrawingNavigationAid = exports.MapMode = void 0;
33
+ require("./DrawingNavigationAid.scss");
34
+ const classnames_1 = __importDefault(require("classnames"));
35
+ const React = __importStar(require("react"));
36
+ const ReactDOM = __importStar(require("react-dom"));
37
+ const core_geometry_1 = require("@itwin/core-geometry");
38
+ const core_frontend_1 = require("@itwin/core-frontend");
39
+ const appui_abstract_1 = require("@itwin/appui-abstract");
40
+ const UiIModelComponents_1 = require("../UiIModelComponents");
41
+ const ViewportComponentEvents_1 = require("../viewport/ViewportComponentEvents");
42
+ // cSpell:ignore Quaternion Quaternions unrotate
43
+ /* eslint-disable jsx-a11y/click-events-have-key-events */
44
+ /**
45
+ * Enum for mode that minimap is currently in
46
+ * @internal
47
+ */
48
+ var MapMode;
49
+ (function (MapMode) {
50
+ MapMode["Opened"] = "map-opened";
51
+ MapMode["Closed"] = "map-closed";
52
+ })(MapMode = exports.MapMode || (exports.MapMode = {}));
53
+ /**
54
+ * A Drawing Navigation Aid.
55
+ * @public
56
+ */
57
+ class DrawingNavigationAid extends React.Component {
58
+ constructor(props) {
59
+ super(props);
60
+ this._rootElement = React.createRef();
61
+ this._viewContainerElement = React.createRef();
62
+ this._viewElement = React.createRef();
63
+ this._rootOffset = DOMRect.fromRect({ x: 0, y: 0, width: 0, height: 0 });
64
+ this._mounted = false;
65
+ this._isViewport3D = () => {
66
+ return this.state.view !== undefined && this.state.view.is3d();
67
+ };
68
+ this._animation = () => {
69
+ const t = Date.now();
70
+ const delta = this._lastTime ? t - this._lastTime : 16;
71
+ this._lastTime = t;
72
+ if (this.state.animation !== 1) {
73
+ const animation = Math.min(1, this.state.animation + delta / (1000 * (this.props.animationTime || 0.4)));
74
+ this._updateFrustum();
75
+ // istanbul ignore next
76
+ if (this._mounted) {
77
+ this.setState({ animation }, () => {
78
+ this._animationFrame = setTimeout(this._animation, 16.667);
79
+ });
80
+ }
81
+ }
82
+ else {
83
+ this._lastTime = undefined;
84
+ this._animationEnd();
85
+ }
86
+ };
87
+ this._animationEnd = () => {
88
+ const hasViewportMoved = !this.state.origin.isAlmostEqual(this.state.startOrigin) ||
89
+ !this.state.rotation.isAlmostEqual(this.state.startRotation);
90
+ const startMapOrigin = core_geometry_1.Point3d.createFrom(this.state.mapOrigin);
91
+ const startMapExtents = core_geometry_1.Vector3d.createFrom(this.state.mapExtents);
92
+ const startDrawingZoom = this.state.drawingZoom;
93
+ const startOrigin = this.state.origin;
94
+ const startRotation = this.state.rotation;
95
+ // istanbul ignore next
96
+ if (this._mounted) {
97
+ this.setState({ startMapOrigin, startDrawingZoom, startOrigin, startRotation, startMapExtents }, () => {
98
+ // istanbul ignore else
99
+ if (this.props.onAnimationEnd)
100
+ this.props.onAnimationEnd();
101
+ if (hasViewportMoved)
102
+ this._updateFrustum(true);
103
+ });
104
+ }
105
+ };
106
+ this._panAnimation = () => {
107
+ const t = Date.now();
108
+ if (this._lastPanTime === undefined)
109
+ this._lastPanTime = t - 16.667;
110
+ const delta = t - this._lastPanTime;
111
+ this._lastPanTime = t;
112
+ // istanbul ignore else
113
+ if (!this.state.panningDirection.isAlmostZero && this.state.isMoving) {
114
+ const { panningDirection } = this.state;
115
+ const offset = panningDirection.scale(delta / 1000 / this.state.drawingZoom);
116
+ const mapOrigin = this.state.mapOrigin.plus(offset);
117
+ const origin = this.state.origin.plus(offset);
118
+ this._updateFrustum();
119
+ // istanbul ignore next
120
+ if (this._mounted) {
121
+ this.setState({ mapOrigin, origin, panningDirection }, () => {
122
+ this._animationFrame = setTimeout(this._panAnimation, 16.667);
123
+ });
124
+ }
125
+ }
126
+ else {
127
+ this._lastPanTime = undefined;
128
+ this._updateFrustum(true);
129
+ }
130
+ };
131
+ // Synchronize with rotation coming from the Viewport
132
+ this._handleViewRotationChangeEvent = (args) => {
133
+ // istanbul ignore else
134
+ if (!this.state.isMoving && !this.state.isPanning && this.props.viewport === args.viewport) {
135
+ const extents = args.viewport.view.getExtents().clone();
136
+ const rotation = args.viewport.view.getRotation().clone();
137
+ const halfExtents = extents.scale(.5);
138
+ const offset = this.state.rotateMinimapWithView || this._isViewport3D() ? rotation.multiplyTransposeVector(halfExtents) : halfExtents;
139
+ const origin = args.viewport.view.getOrigin().plus(offset);
140
+ const deltaZoom = (this.state.extents.x - extents.x) / this.state.extents.x;
141
+ let drawingZoom = this.state.drawingZoom / (1 - deltaZoom);
142
+ const deltaOrigin = origin.minus(this.state.origin);
143
+ let mapOrigin = this.state.mapOrigin.plus(deltaOrigin);
144
+ mapOrigin = mapOrigin.plus(core_geometry_1.Vector3d.createFrom(origin.minus(mapOrigin)).scale(deltaZoom));
145
+ if (this.state.viewId !== args.viewport.view.id) {
146
+ const rect = this.state.rotateMinimapWithView || this._isViewport3D() ? extents : DrawingNavigationAid.findRotatedWindowDimensions(extents, rotation);
147
+ const maxRectDim = Math.max(rect.y, rect.x);
148
+ const maxExtentDim = Math.max(this.state.mapExtents.x, this.state.mapExtents.y);
149
+ drawingZoom = maxExtentDim / (3 * maxRectDim);
150
+ mapOrigin = origin.clone();
151
+ this._viewport = args.viewport;
152
+ this.setState({ viewId: args.viewport.view.id, view: args.viewport.view.clone() });
153
+ }
154
+ // istanbul ignore next
155
+ if (this._mounted) {
156
+ this.setState({
157
+ startOrigin: origin, origin, extents,
158
+ startRotation: rotation, rotation,
159
+ startMapOrigin: mapOrigin, mapOrigin,
160
+ startDrawingZoom: drawingZoom, drawingZoom,
161
+ });
162
+ }
163
+ }
164
+ };
165
+ this._updateFrustum = (complete = false) => {
166
+ const halfExtents = this.state.extents.scale(.5);
167
+ const offset = this.state.rotateMinimapWithView || this._isViewport3D() ? this.state.rotation.multiplyTransposeVector(halfExtents) : halfExtents;
168
+ const origin = this.state.origin.minus(offset);
169
+ ViewportComponentEvents_1.ViewportComponentEvents.setDrawingViewportState(origin, this.state.rotation, complete);
170
+ };
171
+ this._toggleRotationMode = () => {
172
+ const rotateMinimapWithView = !this.state.rotateMinimapWithView;
173
+ this.setState({ rotateMinimapWithView }, () => {
174
+ if (this._viewport)
175
+ this._handleViewRotationChangeEvent({ viewport: this._viewport });
176
+ });
177
+ };
178
+ this._handleKeyUp = (event) => {
179
+ // istanbul ignore else
180
+ if (event.key === appui_abstract_1.SpecialKey.Escape && this.state.mode === MapMode.Opened) {
181
+ this._closeLargeMap();
182
+ }
183
+ };
184
+ this._lastClientXY = core_geometry_1.Point2d.createZero();
185
+ this._handleMouseDown = (event) => {
186
+ // Used only to determine if mouse was moved between mousedown and mouseup
187
+ const mouseStart = core_geometry_1.Point2d.create(event.clientX, event.clientY);
188
+ this.setState({ mouseStart });
189
+ this._lastClientXY = core_geometry_1.Point2d.create(event.clientX, event.clientY);
190
+ };
191
+ this._handleDrawingMouseDown = (event) => {
192
+ if (this.state.mode === MapMode.Opened) {
193
+ event.preventDefault();
194
+ this.setState({ isPanning: true });
195
+ }
196
+ };
197
+ this._handleWindowMouseDown = (event) => {
198
+ event.preventDefault();
199
+ this.setState({ isMoving: true });
200
+ };
201
+ this._handleMouseDrag = (event) => {
202
+ const mouse = core_geometry_1.Point2d.create(event.clientX, event.clientY);
203
+ const movement = mouse.minus(this._lastClientXY);
204
+ if (this.state.isMoving) {
205
+ // add scaled mouse movement
206
+ this._processWindowDrag(movement);
207
+ }
208
+ else {
209
+ // istanbul ignore else
210
+ if (this.state.isPanning && this.state.mode === MapMode.Opened) {
211
+ const vect = core_geometry_1.Vector3d.create(movement.x / this.state.drawingZoom, -movement.y / this.state.drawingZoom, 0);
212
+ const offset = this.state.rotateMinimapWithView || this._isViewport3D() ? this.state.rotation.multiplyTransposeVector(vect) : vect;
213
+ const mapOrigin = this.state.mapOrigin.minus(offset);
214
+ this.setState({ startMapOrigin: mapOrigin, mapOrigin });
215
+ }
216
+ }
217
+ this._lastClientXY = mouse;
218
+ };
219
+ this._handleMouseDragEnd = (event) => {
220
+ const mouse = core_geometry_1.Point2d.create(event.clientX, event.clientY);
221
+ if (mouse.isAlmostEqual(this.state.mouseStart) &&
222
+ this.state.mode === MapMode.Closed &&
223
+ (event.target === this._viewContainerElement.current || event.target === this._viewElement.current)) {
224
+ this._openLargeMap();
225
+ }
226
+ else if (this.state.isMoving) {
227
+ this._processWindowEndDrag();
228
+ }
229
+ else if (this.state.isPanning) {
230
+ // istanbul ignore else
231
+ if (this.state.mode === MapMode.Opened) {
232
+ event.stopPropagation();
233
+ this.setState({ isPanning: false });
234
+ }
235
+ }
236
+ else if ((!(event.target instanceof Node) || this._rootElement.current && !this._rootElement.current.contains(event.target)) && mouse.isAlmostEqual(this.state.mouseStart)) {
237
+ this._closeLargeMap();
238
+ }
239
+ this._lastClientXY = core_geometry_1.Point2d.create(event.clientX, event.clientY);
240
+ };
241
+ // istanbul ignore next - unable to test touch
242
+ this._handleWindowTouchStart = (event) => {
243
+ if (1 !== event.targetTouches.length)
244
+ return;
245
+ window.addEventListener("touchmove", this._onTouchMove, false);
246
+ window.addEventListener("touchend", this._onTouchEnd, false);
247
+ const mouseStart = core_geometry_1.Point2d.create(event.targetTouches[0].clientX, event.targetTouches[0].clientY);
248
+ this.setState({ mouseStart });
249
+ this._lastClientXY = mouseStart.clone();
250
+ this.setState({ isMoving: true });
251
+ };
252
+ // istanbul ignore next - unable to test touch
253
+ this._onTouchMove = (event) => {
254
+ if (1 !== event.targetTouches.length)
255
+ return;
256
+ const mouse = core_geometry_1.Point2d.create(event.targetTouches[0].clientX, event.targetTouches[0].clientY);
257
+ const movement = mouse.minus(this._lastClientXY);
258
+ // add scaled mouse movement
259
+ this._processWindowDrag(movement);
260
+ this._lastClientXY = mouse;
261
+ };
262
+ // istanbul ignore next - unable to test touch
263
+ this._onTouchEnd = (event) => {
264
+ if (0 !== event.targetTouches.length)
265
+ return;
266
+ this._processWindowEndDrag();
267
+ if (0 !== event.changedTouches.length)
268
+ this._lastClientXY = core_geometry_1.Point2d.create(event.changedTouches[0].clientX, event.changedTouches[0].clientY); // Doesn't seem necessary...but _handleMouseDragEnd sets it...
269
+ window.removeEventListener("touchmove", this._onTouchMove);
270
+ window.removeEventListener("touchend", this._onTouchEnd);
271
+ };
272
+ this._getClosedMapSize = () => {
273
+ if (this.props.closeSize === undefined)
274
+ return DrawingNavigationAid.getDefaultClosedMapSize();
275
+ return this.props.closeSize;
276
+ };
277
+ this._getOpenedMapSize = () => {
278
+ if (this.props.openSize === undefined)
279
+ return DrawingNavigationAid.getDefaultOpenedMapSize(this._rootOffset.right, this._rootOffset.top);
280
+ return this.props.openSize;
281
+ };
282
+ this._openLargeMap = () => {
283
+ // istanbul ignore else
284
+ if (this.state.mode === MapMode.Closed && this.state.animation === 1.0) {
285
+ // istanbul ignore else
286
+ if (this._rootElement.current) {
287
+ const rect = this._rootElement.current.getBoundingClientRect();
288
+ this._rootOffset = rect;
289
+ }
290
+ const startMapExtents = core_geometry_1.Vector3d.createFrom(this.state.mapExtents);
291
+ const mapExtents = this._getOpenedMapSize();
292
+ this.setState({
293
+ mode: MapMode.Opened,
294
+ isMoving: false, isPanning: false,
295
+ mapExtents, startMapExtents,
296
+ animation: 0,
297
+ }, () => {
298
+ this._animationFrame = setTimeout(this._animation);
299
+ });
300
+ }
301
+ };
302
+ this._closeLargeMap = () => {
303
+ // istanbul ignore else
304
+ if (this.state.mode === MapMode.Opened && this.state.animation === 1.0) {
305
+ const startMapOrigin = this.state.mapOrigin;
306
+ const mapOrigin = this.state.origin.clone();
307
+ const startMapExtents = core_geometry_1.Vector3d.createFrom(this.state.mapExtents);
308
+ const mapExtents = this._getClosedMapSize();
309
+ const rect = this.state.rotateMinimapWithView || this._isViewport3D() ? this.state.extents : DrawingNavigationAid.findRotatedWindowDimensions(this.state.extents, this.state.rotation);
310
+ const maxRectDim = Math.max(rect.y, rect.x);
311
+ const maxExtentDim = Math.max(mapExtents.x, mapExtents.y);
312
+ const drawingZoom = maxExtentDim / (3 * maxRectDim);
313
+ const startDrawingZoom = this.state.drawingZoom;
314
+ this.setState({
315
+ mode: MapMode.Closed,
316
+ startMapOrigin, mapOrigin,
317
+ startDrawingZoom, drawingZoom,
318
+ isMoving: false, isPanning: false,
319
+ startMapExtents, mapExtents,
320
+ panningDirection: core_geometry_1.Vector3d.createZero(),
321
+ animation: 0,
322
+ }, () => {
323
+ this._animationFrame = setTimeout(this._animation, 16.667);
324
+ });
325
+ }
326
+ };
327
+ this._getPanVector = () => {
328
+ const is3D = this._isViewport3D();
329
+ const rect = this.state.rotateMinimapWithView || is3D ? this.state.extents : DrawingNavigationAid.findRotatedWindowDimensions(this.state.extents, this.state.rotation);
330
+ const mapExtents = this.state.mapExtents.scale(1 / this.state.drawingZoom);
331
+ const maxMagnitude = 80; // maximum acceleration
332
+ const magnitudeTravel = 30; // How far, in pixels, that magnitude increases from 0 to max acceleration
333
+ const diff = core_geometry_1.Vector3d.createFrom(this.state.origin.minus(this.state.mapOrigin));
334
+ const diffVector = this.state.rotateMinimapWithView || is3D ? this.state.rotation.multiplyVector(diff) : diff;
335
+ // capture any values
336
+ const magnitudeVector = core_geometry_1.Vector3d.create(Math.max(0, Math.abs(diffVector.x) - (mapExtents.x - rect.x) / 2), Math.max(0, Math.abs(diffVector.y) - (mapExtents.y - rect.y) / 2));
337
+ if (magnitudeVector.isAlmostZero)
338
+ return core_geometry_1.Vector3d.createZero();
339
+ const magnitude = Math.min(magnitudeVector.magnitude() * this.state.drawingZoom, magnitudeTravel) / magnitudeTravel * maxMagnitude;
340
+ const vect = core_geometry_1.Vector3d.createFrom(this.state.origin.minus(this.state.mapOrigin)); // vect will never be zero or magnitude would also be zero
341
+ const norm = vect.normalize();
342
+ return norm.scale(magnitude); // norm is only undefined when vect is zero, in which it would have returned at magnitudeVector.isAlmostZero
343
+ };
344
+ this._handleWheel = (event) => {
345
+ // istanbul ignore else
346
+ if (this.state.mode === MapMode.Opened && this.state.animation === 1) {
347
+ const { mapOrigin, drawingZoom } = this.state;
348
+ const mapSize = this._getOpenedMapSize();
349
+ const mouseX = event.clientX - this._rootOffset.right + mapSize.x / 2;
350
+ const mouseY = event.clientY - this._rootOffset.top - mapSize.y / 2;
351
+ const is3D = this._isViewport3D();
352
+ if (event.deltaY < 0) {
353
+ const zoom = drawingZoom * 1.1;
354
+ const vect = core_geometry_1.Vector3d.create(mouseX * 0.1 / zoom, -mouseY * 0.1 / zoom, 0);
355
+ const offset = this.state.rotateMinimapWithView || is3D ? this.state.rotation.multiplyTransposeVector(vect) : vect;
356
+ const m = mapOrigin.plus(offset);
357
+ this.setState({ mapOrigin: m, drawingZoom: zoom });
358
+ }
359
+ if (event.deltaY > 0) {
360
+ const zoom = drawingZoom / 1.1;
361
+ const vect = core_geometry_1.Vector3d.create(mouseX * 0.1 / drawingZoom, -mouseY * 0.1 / drawingZoom, 0);
362
+ const offset = this.state.rotateMinimapWithView || is3D ? this.state.rotation.multiplyTransposeVector(vect) : vect;
363
+ const m = mapOrigin.minus(offset);
364
+ this.setState({ mapOrigin: m, drawingZoom: zoom });
365
+ }
366
+ }
367
+ };
368
+ this._handleZoomIn = () => {
369
+ const zoom = this.state.drawingZoom * 1.4;
370
+ this.setState({ drawingZoom: zoom });
371
+ };
372
+ this._handleZoomOut = () => {
373
+ const zoom = this.state.drawingZoom / 1.4;
374
+ this.setState({ drawingZoom: zoom });
375
+ };
376
+ this._handleUnrotate = () => {
377
+ const startRotation = this.state.rotation;
378
+ const halfExtents = this.state.extents.scale(.5);
379
+ const offset = this.state.rotateMinimapWithView || this._isViewport3D() ? core_geometry_1.Vector3d.createZero() : this.state.rotation.multiplyTransposeVector(halfExtents).minus(halfExtents);
380
+ const startOrigin = this.state.origin;
381
+ const origin = this.state.origin.plus(offset);
382
+ const startMapOrigin = this.state.mapOrigin;
383
+ const mapOrigin = this.state.mapOrigin.plus(offset);
384
+ this.setState({ animation: 0, startOrigin, origin, startMapOrigin, mapOrigin, startRotation, rotation: core_geometry_1.Matrix3d.createIdentity() }, () => {
385
+ this._animationFrame = setTimeout(this._animation, 16.667);
386
+ });
387
+ };
388
+ const mode = props.initialMapMode || MapMode.Closed;
389
+ const mapExtents = mode === MapMode.Closed ? this._getClosedMapSize() : this._getOpenedMapSize();
390
+ const startMapExtents = mapExtents;
391
+ this.state = {
392
+ startOrigin: core_geometry_1.Point3d.createZero(),
393
+ origin: core_geometry_1.Point3d.createZero(),
394
+ extents: core_geometry_1.Vector3d.create(1, 1, 1),
395
+ startRotation: core_geometry_1.Matrix3d.createIdentity(),
396
+ rotation: core_geometry_1.Matrix3d.createIdentity(),
397
+ startMapOrigin: core_geometry_1.Point3d.createZero(),
398
+ mapOrigin: core_geometry_1.Point3d.createZero(),
399
+ startMapExtents,
400
+ mapExtents,
401
+ mouseStart: core_geometry_1.Point2d.createZero(),
402
+ panningDirection: core_geometry_1.Vector3d.createZero(),
403
+ startDrawingZoom: 1.0,
404
+ drawingZoom: 1.0,
405
+ mode,
406
+ animation: 1.0,
407
+ viewId: props.initialView !== undefined ? props.initialView.id : "",
408
+ view: props.initialView,
409
+ isMoving: false,
410
+ isPanning: false,
411
+ rotateMinimapWithView: props.initialRotateMinimapWithView !== undefined ? props.initialRotateMinimapWithView : false,
412
+ };
413
+ }
414
+ /** @internal */
415
+ render() {
416
+ const { startOrigin, origin, extents, startRotation, rotation, startMapOrigin, mapOrigin, startMapExtents, mapExtents, startDrawingZoom, drawingZoom, animation, viewId, mode, rotateMinimapWithView, } = this.state;
417
+ const a = DrawingNavigationAid._animationFn(animation);
418
+ const rot = core_geometry_1.Matrix3d.createFromQuaternion(core_geometry_1.Point4d.interpolateQuaternions(startRotation.toQuaternion(), a, rotation.toQuaternion()));
419
+ const or = startOrigin.interpolate(a, origin);
420
+ const map = startMapOrigin.interpolate(a, mapOrigin);
421
+ const sz = startMapExtents.interpolate(a, mapExtents);
422
+ const dz = core_geometry_1.Geometry.interpolate(startDrawingZoom, a, drawingZoom);
423
+ const rootStyle = {
424
+ width: sz.x, height: sz.y,
425
+ ...this.props.style,
426
+ };
427
+ const is3D = this._isViewport3D();
428
+ const tOr = rotateMinimapWithView || is3D ? rotation.multiplyVector(core_geometry_1.Vector3d.createFrom(or)) : core_geometry_1.Vector3d.createFrom(or);
429
+ const tMap = rotateMinimapWithView || is3D ? rotation.multiplyVector(core_geometry_1.Vector3d.createFrom(map)) : core_geometry_1.Vector3d.createFrom(map);
430
+ const tPosX = (tOr.x - extents.x / 2 - tMap.x) * dz + sz.x / 2;
431
+ const tPosY = (-tOr.y - extents.y / 2 + tMap.y) * dz + sz.y / 2;
432
+ const viewWindowStyle = {
433
+ transform: `translate(${tPosX}px, ${tPosY}px)`,
434
+ height: extents.y * dz,
435
+ width: extents.x * dz,
436
+ };
437
+ if (!rotateMinimapWithView && !is3D)
438
+ viewWindowStyle.transform =
439
+ "matrix3d(" +
440
+ `${rot.at(0, 0)}, ${rot.at(1, 0)}, ${rot.at(2, 0)}, 0, ` +
441
+ `${rot.at(0, 1)}, ${rot.at(1, 1)}, ${rot.at(2, 1)}, 0, ` +
442
+ `${rot.at(0, 2)}, ${rot.at(1, 2)}, ${rot.at(2, 2)}, 0, ` +
443
+ `${tPosX}, ${tPosY}, 0, 1)`;
444
+ const isAnimating = animation !== 1 && !startMapExtents.isExactEqual(mapExtents);
445
+ if (mode === MapMode.Opened || isAnimating) {
446
+ rootStyle.position = "fixed";
447
+ rootStyle.right = window.innerWidth - this._rootOffset.right;
448
+ rootStyle.top = this._rootOffset.top;
449
+ }
450
+ const halfExtents = extents.scale(.5);
451
+ const offset = rotateMinimapWithView || is3D ? core_geometry_1.Vector3d.createZero() : rotation.multiplyTransposeVector(halfExtents).minus(halfExtents);
452
+ const unrotateLabel = UiIModelComponents_1.UiIModelComponents.translate("drawing.unrotate");
453
+ const e = sz.scale(1 / dz);
454
+ const halfMapExtents = e.scale(.5);
455
+ const mapOffset = rotateMinimapWithView || is3D ? rotation.multiplyTransposeVector(halfMapExtents) : halfMapExtents;
456
+ const viewManager = this.props.viewManagerOverride ? this.props.viewManagerOverride : /* istanbul ignore next */ core_frontend_1.IModelApp.viewManager;
457
+ const screenViewport = this.props.screenViewportOverride ? this.props.screenViewportOverride : /* istanbul ignore next */ core_frontend_1.ScreenViewport;
458
+ const nodes = (React.createElement("div", { className: (0, classnames_1.default)("components-drawing-navigation-aid", this.props.className), "data-testid": "components-drawing-navigation-aid", ref: this._rootElement, onWheel: this._handleWheel, onMouseDown: this._handleDrawingMouseDown, style: rootStyle, role: "presentation" },
459
+ React.createElement(DrawingNavigationCanvas, { view: this.state.view, viewManagerOverride: viewManager, screenViewportOverride: screenViewport, viewId: viewId, origin: map.plus(offset).minus(mapOffset), extents: e, zoom: dz, rotation: rotateMinimapWithView || is3D ? rotation : core_geometry_1.Matrix3d.createIdentity() }),
460
+ React.createElement("div", { className: "drawing-container", "data-testid": "drawing-container", ref: this._viewContainerElement },
461
+ React.createElement("div", { className: "drawing-view-window", "data-testid": "drawing-view-window", onMouseDown: this._handleWindowMouseDown, onTouchStart: this._handleWindowTouchStart, style: viewWindowStyle, ref: this._viewElement, role: "presentation" }),
462
+ !is3D &&
463
+ React.createElement("div", { className: (0, classnames_1.default)("toggle-rotate-style", "icon", "icon-rotate-left", { checked: rotateMinimapWithView }), "data-testid": "toggle-rotate-style", style: mode === MapMode.Closed && !isAnimating ? { bottom: 2, left: 2 } : {}, title: UiIModelComponents_1.UiIModelComponents.translate("drawing.rotateStyle"), onClick: this._toggleRotationMode, role: "presentation" }),
464
+ !rot.isIdentity &&
465
+ React.createElement("div", { className: "unrotate-button", "data-testid": "drawing-unrotate-button", style: mode === MapMode.Closed && !isAnimating ? { top: 2 } : {}, onClick: this._handleUnrotate, role: "button", tabIndex: -1 }, unrotateLabel),
466
+ mode === MapMode.Opened && !isAnimating && React.createElement(React.Fragment, null,
467
+ React.createElement("div", { className: "close", "data-testid": "drawing-close-button", onClick: this._closeLargeMap, role: "button", tabIndex: -1 },
468
+ React.createElement("div", { className: "close-icon icon icon-sort-up" })),
469
+ React.createElement("div", { className: "zoom" },
470
+ React.createElement("div", { className: "zoom-button icon icon-add", "data-testid": "drawing-zoom-in-button", onClick: this._handleZoomIn, role: "button", tabIndex: -1 }),
471
+ React.createElement("div", { className: "zoom-button icon icon-remove-2", "data-testid": "drawing-zoom-out-button", onClick: this._handleZoomOut, role: "button", tabIndex: -1 }))))));
472
+ if (mode === MapMode.Closed && (animation === 1.0 || startMapExtents.isExactEqual(mapExtents))) {
473
+ return nodes;
474
+ }
475
+ else {
476
+ let drawingPortal = document.querySelector("#components-drawing-portal");
477
+ if (!drawingPortal) {
478
+ drawingPortal = document.createElement("div");
479
+ drawingPortal.id = "components-drawing-portal";
480
+ document.body.appendChild(drawingPortal);
481
+ }
482
+ return ReactDOM.createPortal(nodes, drawingPortal);
483
+ }
484
+ }
485
+ componentDidMount() {
486
+ this._mounted = true;
487
+ ViewportComponentEvents_1.ViewportComponentEvents.onViewRotationChangeEvent.addListener(this._handleViewRotationChangeEvent);
488
+ window.addEventListener("mousedown", this._handleMouseDown);
489
+ window.addEventListener("mouseup", this._handleMouseDragEnd);
490
+ window.addEventListener("mousemove", this._handleMouseDrag);
491
+ window.addEventListener("keyup", this._handleKeyUp);
492
+ }
493
+ componentWillUnmount() {
494
+ ViewportComponentEvents_1.ViewportComponentEvents.onViewRotationChangeEvent.removeListener(this._handleViewRotationChangeEvent);
495
+ window.removeEventListener("mousedown", this._handleMouseDown);
496
+ window.removeEventListener("mouseup", this._handleMouseDragEnd);
497
+ window.removeEventListener("mousemove", this._handleMouseDrag);
498
+ window.removeEventListener("keyup", this._handleKeyUp);
499
+ clearTimeout(this._animationFrame);
500
+ if (this.props.onAnimationEnd)
501
+ this.props.onAnimationEnd();
502
+ const rt = document.getElementById("components-drawing-portal");
503
+ if (rt && rt.parentElement !== null && rt.children.length === 0) {
504
+ rt.parentElement.removeChild(rt);
505
+ }
506
+ this._mounted = false;
507
+ }
508
+ _processWindowDrag(movement) {
509
+ const vect = core_geometry_1.Vector3d.create(movement.x / this.state.drawingZoom, -movement.y / this.state.drawingZoom, 0);
510
+ const offset = this.state.rotateMinimapWithView || this._isViewport3D() ? this.state.rotation.multiplyTransposeVector(vect) : vect;
511
+ const origin = this.state.origin.plus(offset);
512
+ const panningDirection = this._getPanVector();
513
+ const wasAlmostZero = this.state.panningDirection.isAlmostZero;
514
+ this.setState({ startOrigin: origin, origin, panningDirection, isPanning: false }, () => {
515
+ this._updateFrustum();
516
+ if (wasAlmostZero && !this.state.panningDirection.isAlmostZero) {
517
+ this._animationFrame = setTimeout(this._panAnimation, 16.667);
518
+ }
519
+ });
520
+ }
521
+ _processWindowEndDrag() {
522
+ this.setState({ isMoving: false });
523
+ this._updateFrustum(true);
524
+ if (this.state.mode === MapMode.Closed) {
525
+ setTimeout(() => {
526
+ const startMapOrigin = this.state.mapOrigin;
527
+ const mapOrigin = this.state.origin.clone();
528
+ // istanbul ignore next
529
+ if (this._mounted) {
530
+ this.setState({ startMapOrigin, mapOrigin, animation: 0 }, () => {
531
+ this._animationFrame = setTimeout(this._animation, 16.667);
532
+ });
533
+ }
534
+ }, 0);
535
+ }
536
+ }
537
+ }
538
+ exports.DrawingNavigationAid = DrawingNavigationAid;
539
+ DrawingNavigationAid._animationFn = (t) => t < .5 ? 2 * t ** 2 : -1 + (4 - 2 * t) * t;
540
+ /** @internal */
541
+ DrawingNavigationAid.getDefaultClosedMapSize = () => {
542
+ return core_geometry_1.Vector3d.create(96, 96);
543
+ };
544
+ /** @internal */
545
+ DrawingNavigationAid.getDefaultOpenedMapSize = (paddingX = 0, paddingY = 0) => {
546
+ return core_geometry_1.Vector3d.create(window.innerWidth / 3 - 2 * (window.innerWidth - paddingX), window.innerHeight / 3 - 2 * paddingY);
547
+ };
548
+ /** @internal */
549
+ DrawingNavigationAid.findRotatedWindowDimensions = (extents, rotation) => {
550
+ const cos = rotation.at(0, 0);
551
+ const sin = rotation.at(1, 0);
552
+ // extents.x/y should be divided in half, but we don't have to do that immediately.
553
+ const cosWidth = cos * extents.x;
554
+ const sinHeight = sin * extents.y;
555
+ const sinWidth = cos * extents.x;
556
+ const cosHeight = sin * extents.y;
557
+ const a = Math.atan2(sin, cos);
558
+ if (a % Math.PI >= 0 && a % Math.PI < Math.PI / 2) {
559
+ const y1 = -cosHeight - sinWidth;
560
+ const x2 = cosWidth + sinHeight;
561
+ const y3 = cosHeight + sinWidth;
562
+ const x4 = -cosWidth - sinHeight;
563
+ // Instead, divide total difference
564
+ return core_geometry_1.Vector3d.create(Math.abs(x2 - x4) / 2, Math.abs(y1 - y3) / 2);
565
+ }
566
+ else {
567
+ const x1 = -cosWidth + sinHeight;
568
+ const y2 = -cosHeight + sinWidth;
569
+ const x3 = cosWidth - sinHeight;
570
+ const y4 = cosHeight - sinWidth;
571
+ return core_geometry_1.Vector3d.create(Math.abs(x1 - x3) / 2, Math.abs(y2 - y4) / 2);
572
+ }
573
+ };
574
+ /** @internal */
575
+ class DrawingNavigationCanvas extends React.Component {
576
+ constructor() {
577
+ super(...arguments);
578
+ this._canvasElement = React.createRef();
579
+ this._update = () => {
580
+ // istanbul ignore else
581
+ if (this._vp) {
582
+ const max = Math.max(this.props.extents.x, this.props.extents.y);
583
+ this._vp.view.extentLimits = { max, min: core_geometry_1.Constant.oneMillimeter };
584
+ this._vp.view.setOrigin(this.props.origin);
585
+ this._vp.view.setRotation(this.props.rotation);
586
+ this._vp.view.setExtents(this.props.extents);
587
+ this._vp.applyViewState(this._vp.view);
588
+ }
589
+ };
590
+ }
591
+ render() {
592
+ return (React.createElement("div", { className: "drawing-canvas", "data-testid": "drawing-canvas", ref: this._canvasElement }));
593
+ }
594
+ componentDidMount() {
595
+ if (this._canvasElement.current && this.props.view !== undefined) {
596
+ const viewManager = this.props.viewManagerOverride ? this.props.viewManagerOverride : /* istanbul ignore next */ core_frontend_1.IModelApp.viewManager;
597
+ /* istanbul ignore next */
598
+ const screenViewport = this.props.screenViewportOverride ? this.props.screenViewportOverride : /* istanbul ignore next */ core_frontend_1.ScreenViewport;
599
+ const previousView = viewManager.selectedView;
600
+ this._vp = screenViewport.create(this._canvasElement.current, this.props.view);
601
+ this.customizeViewport(this._vp);
602
+ viewManager.addViewport(this._vp);
603
+ void viewManager.setSelectedView(previousView); // switch to original viewport
604
+ this._update();
605
+ }
606
+ }
607
+ customizeViewport(vp) {
608
+ /* istanbul ignore next */
609
+ if (vp.logo.style)
610
+ vp.logo.style.display = "none";
611
+ /* istanbul ignore next */
612
+ if (vp.viewFlags.acsTriad)
613
+ vp.viewFlags = vp.viewFlags.with("acsTriad", false);
614
+ }
615
+ componentDidUpdate(oldProps) {
616
+ const viewManager = this.props.viewManagerOverride ? this.props.viewManagerOverride : /* istanbul ignore next */ core_frontend_1.IModelApp.viewManager;
617
+ if (this.props.view !== undefined) {
618
+ if (oldProps.view !== this.props.view) {
619
+ const screenViewport = this.props.screenViewportOverride ? this.props.screenViewportOverride : /* istanbul ignore next */ core_frontend_1.ScreenViewport;
620
+ if (oldProps !== undefined && oldProps.viewId !== "" && oldProps.viewId !== this.props.viewId && this._vp) {
621
+ viewManager.dropViewport(this._vp, true);
622
+ }
623
+ // istanbul ignore else
624
+ if (this._canvasElement.current &&
625
+ (this.props.canvasSizeOverride ||
626
+ ( /* istanbul ignore next */this._canvasElement.current.clientWidth !== 0 && /* istanbul ignore next */ this._canvasElement.current.clientHeight !== 0))) {
627
+ const previousView = viewManager.selectedView;
628
+ this._vp = screenViewport.create(this._canvasElement.current, this.props.view.clone());
629
+ this.customizeViewport(this._vp);
630
+ viewManager.addViewport(this._vp);
631
+ void viewManager.setSelectedView(previousView); // switch to original viewport
632
+ this._update();
633
+ }
634
+ }
635
+ else if (!this.props.origin.isExactEqual(oldProps.origin) || !this.props.extents.isExactEqual(oldProps.extents) || this.props.zoom !== oldProps.zoom || !this.props.rotation.isExactEqual(oldProps.rotation)) {
636
+ this._update();
637
+ }
638
+ }
639
+ }
640
+ componentWillUnmount() {
641
+ if (this._vp) {
642
+ const viewManager = this.props.viewManagerOverride ? this.props.viewManagerOverride : /* istanbul ignore next */ core_frontend_1.IModelApp.viewManager;
643
+ viewManager.dropViewport(this._vp, true);
644
+ }
645
+ }
646
+ }
647
+ exports.DrawingNavigationCanvas = DrawingNavigationCanvas;
648
648
  //# sourceMappingURL=DrawingNavigationAid.js.map