@inweb/client 25.2.2 → 25.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +70 -70
  3. package/dist/client.js +12739 -12352
  4. package/dist/client.js.map +1 -1
  5. package/dist/client.min.js +1 -1
  6. package/dist/client.module.js +588 -157
  7. package/dist/client.module.js.map +1 -1
  8. package/lib/Api/Assembly.d.ts +338 -338
  9. package/lib/Api/ClashTest.d.ts +175 -175
  10. package/lib/Api/Client.d.ts +451 -451
  11. package/lib/Api/ClientEvents.d.ts +28 -28
  12. package/lib/Api/File.d.ts +567 -567
  13. package/lib/Api/HttpClient.d.ts +12 -12
  14. package/lib/Api/IAssembly.d.ts +13 -13
  15. package/lib/Api/IFile.d.ts +45 -45
  16. package/lib/Api/IHttpClient.d.ts +10 -10
  17. package/lib/Api/IUser.d.ts +10 -10
  18. package/lib/Api/Job.d.ts +141 -141
  19. package/lib/Api/Member.d.ts +84 -84
  20. package/lib/Api/Model.d.ts +146 -146
  21. package/lib/Api/Permission.d.ts +92 -92
  22. package/lib/Api/Project.d.ts +246 -246
  23. package/lib/Api/Role.d.ts +81 -81
  24. package/lib/Api/User.d.ts +196 -196
  25. package/lib/Api/impl/FetchError.d.ts +17 -17
  26. package/lib/Api/impl/Utils.d.ts +32 -32
  27. package/lib/Api/impl/http.d.ts +66 -66
  28. package/lib/ConvetMath.d.ts +28 -28
  29. package/lib/Viewer/CanvasEvents.d.ts +1 -1
  30. package/lib/Viewer/Commands/ApplyModelTransform.d.ts +1 -1
  31. package/lib/Viewer/Commands/ClearMarkup.d.ts +1 -1
  32. package/lib/Viewer/Commands/ClearSlices.d.ts +1 -1
  33. package/lib/Viewer/Commands/CreatePreview.d.ts +1 -1
  34. package/lib/Viewer/Commands/Explode.d.ts +1 -1
  35. package/lib/Viewer/Commands/GetDefaultViewPositions.d.ts +1 -1
  36. package/lib/Viewer/Commands/GetModels.d.ts +1 -1
  37. package/lib/Viewer/Commands/GetSelected.d.ts +1 -1
  38. package/lib/Viewer/Commands/HideSelected.d.ts +1 -1
  39. package/lib/Viewer/Commands/IsolateSelected.d.ts +1 -1
  40. package/lib/Viewer/Commands/RegenerateAll.d.ts +1 -1
  41. package/lib/Viewer/Commands/ResetView.d.ts +1 -1
  42. package/lib/Viewer/Commands/SelectModel.d.ts +1 -1
  43. package/lib/Viewer/Commands/SetActiveDragger.d.ts +1 -1
  44. package/lib/Viewer/Commands/SetDefaultViewPosition.d.ts +1 -1
  45. package/lib/Viewer/Commands/SetMarkupColor.d.ts +1 -1
  46. package/lib/Viewer/Commands/SetSelected.d.ts +1 -1
  47. package/lib/Viewer/Commands/ShowAll.d.ts +1 -1
  48. package/lib/Viewer/Commands/Unselect.d.ts +1 -1
  49. package/lib/Viewer/Commands/ZoomToExtents.d.ts +1 -1
  50. package/lib/Viewer/Commands/ZoomToObjects.d.ts +1 -1
  51. package/lib/Viewer/Commands/ZoomToSelected.d.ts +1 -1
  52. package/lib/Viewer/Commands.d.ts +2 -2
  53. package/lib/Viewer/Draggers/Actions/OrbitAction.d.ts +21 -21
  54. package/lib/Viewer/Draggers/Actions/PanAction.d.ts +17 -17
  55. package/lib/Viewer/Draggers/Actions/ZoomAction.d.ts +7 -7
  56. package/lib/Viewer/Draggers/Common/Geometry.d.ts +114 -114
  57. package/lib/Viewer/Draggers/Common/GestureManager.d.ts +40 -40
  58. package/lib/Viewer/Draggers/Common/OdBaseDragger.d.ts +53 -53
  59. package/lib/Viewer/Draggers/Common/OdaGeAction.d.ts +29 -29
  60. package/lib/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.d.ts +30 -30
  61. package/lib/Viewer/Draggers/MeasureLineDragger/MeasureUtils.d.ts +19 -19
  62. package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +23 -23
  63. package/lib/Viewer/Draggers/OdBaseCuttingPlaneDragger.d.ts +26 -26
  64. package/lib/Viewer/Draggers/OdCuttingPlaneXAxisDragger.d.ts +7 -7
  65. package/lib/Viewer/Draggers/OdCuttingPlaneYAxisDragger.d.ts +7 -7
  66. package/lib/Viewer/Draggers/OdCuttingPlaneZAxisDragger.d.ts +7 -7
  67. package/lib/Viewer/Draggers/OdOrbitDragger.d.ts +14 -14
  68. package/lib/Viewer/Draggers/OdPanDragger.d.ts +11 -11
  69. package/lib/Viewer/Draggers/OdZoomDragger.d.ts +11 -11
  70. package/lib/Viewer/Draggers/OdZoomWheelDragger.d.ts +10 -10
  71. package/lib/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.d.ts +18 -18
  72. package/lib/Viewer/Draggers/OdZoomWindowDragger/index.d.ts +13 -13
  73. package/lib/Viewer/Draggers/OdaLineDragger.d.ts +14 -14
  74. package/lib/Viewer/Draggers/OdaTextDragger.d.ts +15 -15
  75. package/lib/Viewer/Draggers/OdaWalkDragger.d.ts +29 -29
  76. package/lib/Viewer/Draggers/OrbitAroundBuildingDragger.d.ts +18 -18
  77. package/lib/Viewer/EventEmitter2.d.ts +53 -53
  78. package/lib/Viewer/ICommands.d.ts +24 -24
  79. package/lib/Viewer/IEventEmitter2.d.ts +12 -12
  80. package/lib/Viewer/IViewer.d.ts +26 -26
  81. package/lib/Viewer/Loaders/BaseLoader.d.ts +10 -10
  82. package/lib/Viewer/Loaders/LoaderFactory.d.ts +9 -9
  83. package/lib/Viewer/Loaders/TCSLoader.d.ts +4 -4
  84. package/lib/Viewer/Loaders/UpdaterController.d.ts +14 -14
  85. package/lib/Viewer/Loaders/VsfXLoader.d.ts +4 -4
  86. package/lib/Viewer/Loaders/VsfXPartialLoader.d.ts +4 -4
  87. package/lib/Viewer/Markup/Api/IMarkupArrow.d.ts +21 -11
  88. package/lib/Viewer/Markup/Api/IMarkupCloud.d.ts +15 -0
  89. package/lib/Viewer/Markup/Api/IMarkupColorable.d.ts +4 -4
  90. package/lib/Viewer/Markup/Api/IMarkupEllipse.d.ts +14 -14
  91. package/lib/Viewer/Markup/Api/IMarkupImage.d.ts +14 -14
  92. package/lib/Viewer/Markup/Api/IMarkupLine.d.ts +18 -10
  93. package/lib/Viewer/Markup/Api/IMarkupObject.d.ts +11 -11
  94. package/lib/Viewer/Markup/Api/IMarkupRectangle.d.ts +14 -14
  95. package/lib/Viewer/Markup/Api/IMarkupText.d.ts +12 -12
  96. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaArrow.d.ts +46 -31
  97. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaCloud.d.ts +36 -0
  98. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.d.ts +40 -39
  99. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaImage.d.ts +36 -35
  100. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaLine.d.ts +35 -31
  101. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.d.ts +38 -37
  102. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaText.d.ts +37 -36
  103. package/lib/Viewer/Markup/IMarkup.d.ts +38 -37
  104. package/lib/Viewer/Markup/Impl/Konva/KonvaMarkup.d.ts +71 -62
  105. package/lib/Viewer/Markup/Impl/Konva/MarkupColor.d.ts +18 -18
  106. package/lib/Viewer/Markup/Impl/Visualize/VisualizeMarkup.d.ts +32 -32
  107. package/lib/Viewer/Markup/MarkupFactory.d.ts +6 -6
  108. package/lib/Viewer/Options.d.ts +227 -227
  109. package/lib/Viewer/OptionsEvents.d.ts +25 -25
  110. package/lib/Viewer/Viewer.d.ts +352 -352
  111. package/lib/Viewer/ViewerCommands.d.ts +22 -22
  112. package/lib/Viewer/ViewerEvents.d.ts +600 -600
  113. package/lib/Viewer/utils.d.ts +3 -3
  114. package/lib/index.d.ts +23 -23
  115. package/package.json +38 -32
  116. package/src/Api/Assembly.ts +678 -678
  117. package/src/Api/ClashTest.ts +290 -290
  118. package/src/Api/Client.ts +816 -816
  119. package/src/Api/ClientEvents.ts +31 -31
  120. package/src/Api/File.ts +962 -962
  121. package/src/Api/HttpClient.ts +73 -73
  122. package/src/Api/IAssembly.ts +37 -37
  123. package/src/Api/IFile.ts +74 -74
  124. package/src/Api/IHttpClient.ts +50 -50
  125. package/src/Api/IUser.ts +33 -33
  126. package/src/Api/Job.ts +253 -253
  127. package/src/Api/Member.ts +161 -161
  128. package/src/Api/Model.ts +259 -259
  129. package/src/Api/Permission.ts +173 -173
  130. package/src/Api/Project.ts +479 -479
  131. package/src/Api/Role.ts +158 -158
  132. package/src/Api/User.ts +357 -357
  133. package/src/Api/impl/FetchError.ts +48 -48
  134. package/src/Api/impl/Utils.ts +367 -367
  135. package/src/Api/impl/http.ts +92 -92
  136. package/src/ConvetMath.ts +372 -372
  137. package/src/Viewer/CanvasEvents.ts +41 -41
  138. package/src/Viewer/Commands/ApplyModelTransform.ts +70 -70
  139. package/src/Viewer/Commands/ClearMarkup.ts +28 -28
  140. package/src/Viewer/Commands/ClearSlices.ts +27 -27
  141. package/src/Viewer/Commands/CreatePreview.ts +33 -33
  142. package/src/Viewer/Commands/Explode.ts +38 -38
  143. package/src/Viewer/Commands/GetDefaultViewPositions.ts +36 -36
  144. package/src/Viewer/Commands/GetModels.ts +43 -43
  145. package/src/Viewer/Commands/GetSelected.ts +58 -58
  146. package/src/Viewer/Commands/HideSelected.ts +37 -37
  147. package/src/Viewer/Commands/IsolateSelected.ts +37 -37
  148. package/src/Viewer/Commands/RegenerateAll.ts +37 -37
  149. package/src/Viewer/Commands/ResetView.ts +43 -43
  150. package/src/Viewer/Commands/SelectModel.ts +52 -52
  151. package/src/Viewer/Commands/SetActiveDragger.ts +29 -29
  152. package/src/Viewer/Commands/SetDefaultViewPosition.ts +50 -50
  153. package/src/Viewer/Commands/SetMarkupColor.ts +29 -29
  154. package/src/Viewer/Commands/SetSelected.ts +47 -47
  155. package/src/Viewer/Commands/ShowAll.ts +37 -37
  156. package/src/Viewer/Commands/Unselect.ts +37 -37
  157. package/src/Viewer/Commands/ZoomToExtents.ts +43 -43
  158. package/src/Viewer/Commands/ZoomToObjects.ts +47 -47
  159. package/src/Viewer/Commands/ZoomToSelected.ts +39 -39
  160. package/src/Viewer/Commands.ts +81 -81
  161. package/src/Viewer/Draggers/Actions/OrbitAction.ts +250 -250
  162. package/src/Viewer/Draggers/Actions/PanAction.ts +102 -102
  163. package/src/Viewer/Draggers/Actions/ZoomAction.ts +45 -45
  164. package/src/Viewer/Draggers/Common/Geometry.ts +152 -152
  165. package/src/Viewer/Draggers/Common/GestureManager.ts +263 -263
  166. package/src/Viewer/Draggers/Common/OdBaseDragger.ts +270 -270
  167. package/src/Viewer/Draggers/Common/OdaGeAction.ts +146 -146
  168. package/src/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.ts +248 -248
  169. package/src/Viewer/Draggers/MeasureLineDragger/MeasureUtils.ts +182 -182
  170. package/src/Viewer/Draggers/MeasureLineDragger/index.ts +166 -166
  171. package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +182 -182
  172. package/src/Viewer/Draggers/OdCuttingPlaneXAxisDragger.ts +53 -53
  173. package/src/Viewer/Draggers/OdCuttingPlaneYAxisDragger.ts +53 -53
  174. package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +53 -53
  175. package/src/Viewer/Draggers/OdOrbitDragger.ts +70 -70
  176. package/src/Viewer/Draggers/OdPanDragger.ts +62 -62
  177. package/src/Viewer/Draggers/OdZoomDragger.ts +59 -59
  178. package/src/Viewer/Draggers/OdZoomWheelDragger.ts +103 -103
  179. package/src/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.ts +123 -123
  180. package/src/Viewer/Draggers/OdZoomWindowDragger/index.ts +75 -75
  181. package/src/Viewer/Draggers/OdaLineDragger.ts +80 -80
  182. package/src/Viewer/Draggers/OdaTextDragger.ts +118 -118
  183. package/src/Viewer/Draggers/OdaWalkDragger.ts +278 -278
  184. package/src/Viewer/Draggers/OrbitAroundBuildingDragger.ts +184 -184
  185. package/src/Viewer/EventEmitter2.ts +116 -116
  186. package/src/Viewer/ICommands.ts +53 -53
  187. package/src/Viewer/IEventEmitter2.ts +36 -36
  188. package/src/Viewer/IViewer.ts +55 -55
  189. package/src/Viewer/Loaders/BaseLoader.ts +40 -40
  190. package/src/Viewer/Loaders/LoaderFactory.ts +44 -44
  191. package/src/Viewer/Loaders/TCSLoader.ts +82 -82
  192. package/src/Viewer/Loaders/UpdaterController.ts +36 -36
  193. package/src/Viewer/Loaders/VsfXLoader.ts +87 -87
  194. package/src/Viewer/Loaders/VsfXPartialLoader.ts +208 -208
  195. package/src/Viewer/Markup/Api/IMarkupArrow.ts +12 -15
  196. package/src/Viewer/Markup/Api/IMarkupCloud.ts +15 -0
  197. package/src/Viewer/Markup/Api/IMarkupColorable.ts +4 -4
  198. package/src/Viewer/Markup/Api/IMarkupEllipse.ts +15 -15
  199. package/src/Viewer/Markup/Api/IMarkupImage.ts +15 -15
  200. package/src/Viewer/Markup/Api/IMarkupLine.ts +20 -10
  201. package/src/Viewer/Markup/Api/IMarkupObject.ts +15 -15
  202. package/src/Viewer/Markup/Api/IMarkupRectangle.ts +15 -15
  203. package/src/Viewer/Markup/Api/IMarkupText.ts +12 -12
  204. package/src/Viewer/Markup/Api/Impl/Konva/KonvaArrow.ts +117 -119
  205. package/src/Viewer/Markup/Api/Impl/Konva/KonvaCloud.ts +208 -0
  206. package/src/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.ts +118 -113
  207. package/src/Viewer/Markup/Api/Impl/Konva/KonvaImage.ts +123 -121
  208. package/src/Viewer/Markup/Api/Impl/Konva/KonvaLine.ts +130 -99
  209. package/src/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.ts +119 -113
  210. package/src/Viewer/Markup/Api/Impl/Konva/KonvaText.ts +110 -104
  211. package/src/Viewer/Markup/IMarkup.ts +40 -39
  212. package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +1208 -872
  213. package/src/Viewer/Markup/Impl/Konva/MarkupColor.ts +39 -39
  214. package/src/Viewer/Markup/Impl/Visualize/VisualizeMarkup.ts +273 -273
  215. package/src/Viewer/Markup/MarkupFactory.ts +32 -32
  216. package/src/Viewer/Options.ts +502 -502
  217. package/src/Viewer/OptionsEvents.ts +28 -28
  218. package/src/Viewer/Viewer.ts +1109 -1109
  219. package/src/Viewer/ViewerCommands.ts +45 -45
  220. package/src/Viewer/ViewerEvents.ts +700 -700
  221. package/src/Viewer/utils.ts +74 -74
  222. package/src/index.ts +48 -48
@@ -2069,7 +2069,7 @@ class Client extends EventEmitter2 {
2069
2069
  return this._httpClient.get("/version").then((response => response.json())).then((data => ({
2070
2070
  ...data,
2071
2071
  server: data.version,
2072
- client: "25.2.2"
2072
+ client: "25.2.5"
2073
2073
  })));
2074
2074
  }
2075
2075
  registerUser(email, password, userName) {
@@ -4617,6 +4617,7 @@ var MarkupMode;
4617
4617
  MarkupMode["Ellipse"] = "Ellipse";
4618
4618
  MarkupMode["Arrow"] = "Arrow";
4619
4619
  MarkupMode["Image"] = "Image";
4620
+ MarkupMode["Cloud"] = "Cloud";
4620
4621
  })(MarkupMode || (MarkupMode = {}));
4621
4622
 
4622
4623
  class MarkupColor {
@@ -4648,12 +4649,22 @@ class MarkupColor {
4648
4649
  }
4649
4650
  }
4650
4651
 
4652
+ var LineType;
4653
+
4654
+ (function(LineType) {
4655
+ LineType[LineType["Unknown"] = 0] = "Unknown";
4656
+ LineType["Solid"] = "solid";
4657
+ LineType["Dot"] = "dot";
4658
+ LineType["Dash"] = "dash";
4659
+ })(LineType || (LineType = {}));
4660
+
4661
+ const LineTypeSpecs = new Map([ [ LineType.Solid, [] ], [ LineType.Dot, [ 30, 30, .001, 30 ] ], [ LineType.Dash, [ 30, 30 ] ] ]);
4662
+
4651
4663
  class KonvaLine {
4652
4664
  constructor(params, ref = null) {
4653
4665
  var _a, _b;
4654
4666
  if (ref) {
4655
4667
  this._ref = ref;
4656
- this._ref.id(this._ref._id.toString());
4657
4668
  return;
4658
4669
  }
4659
4670
  if (!params.points) return;
@@ -4667,7 +4678,8 @@ class KonvaLine {
4667
4678
  lineJoin: "round",
4668
4679
  points: konvaPoints,
4669
4680
  draggable: true,
4670
- strokeScaleEnabled: false
4681
+ strokeScaleEnabled: false,
4682
+ dash: LineTypeSpecs.get(params.type) || []
4671
4683
  });
4672
4684
  this._ref.id(this._ref._id.toString());
4673
4685
  }
@@ -4706,7 +4718,7 @@ class KonvaLine {
4706
4718
  this._ref = null;
4707
4719
  }
4708
4720
  getPoints() {
4709
- return this._ref.attrs.points;
4721
+ return this._ref.points();
4710
4722
  }
4711
4723
  setLineWidth(size) {
4712
4724
  this._ref.strokeWidth(size);
@@ -4714,6 +4726,27 @@ class KonvaLine {
4714
4726
  getLineWidth() {
4715
4727
  return this._ref.strokeWidth();
4716
4728
  }
4729
+ getLineType() {
4730
+ const typeSpecs = this._ref.dash() || [];
4731
+ let type = "solid";
4732
+ switch (typeSpecs) {
4733
+ case LineTypeSpecs.get(LineType.Dot):
4734
+ type = "dot";
4735
+ break;
4736
+
4737
+ case LineTypeSpecs.get(LineType.Dash):
4738
+ type = "dash";
4739
+ break;
4740
+ }
4741
+ return type;
4742
+ }
4743
+ setLineType(type) {
4744
+ const lineType = LineType[type];
4745
+ if (lineType) {
4746
+ const specs = LineTypeSpecs.get(lineType);
4747
+ if (specs) this._ref.dash(specs);
4748
+ }
4749
+ }
4717
4750
  addPoints(points) {
4718
4751
  let newPoints = this._ref.points();
4719
4752
  points.forEach((point => {
@@ -4729,7 +4762,6 @@ class KonvaText {
4729
4762
  this.TEXT_FONT_FAMILY = "Calibri";
4730
4763
  if (ref) {
4731
4764
  this._ref = ref;
4732
- this._ref.id(this._ref._id.toString());
4733
4765
  return;
4734
4766
  }
4735
4767
  if (!params || !params.text) return;
@@ -4808,18 +4840,17 @@ class KonvaRectangle {
4808
4840
  var _a, _b;
4809
4841
  if (ref) {
4810
4842
  this._ref = ref;
4811
- this._ref.id(this._ref._id.toString());
4812
4843
  return;
4813
4844
  }
4814
- if (!params.pos) return;
4845
+ if (!params.position) return;
4815
4846
  this._ref = new Konva.Rect({
4816
4847
  stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
4817
4848
  strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
4818
4849
  globalCompositeOperation: "source-over",
4819
4850
  lineCap: "round",
4820
4851
  lineJoin: "round",
4821
- x: params.pos.x,
4822
- y: params.pos.y,
4852
+ x: params.position.x,
4853
+ y: params.position.y,
4823
4854
  width: params.width,
4824
4855
  height: params.height,
4825
4856
  draggable: true,
@@ -4895,18 +4926,17 @@ class KonvaEllipse {
4895
4926
  var _a, _b;
4896
4927
  if (ref) {
4897
4928
  this._ref = ref;
4898
- this._ref.id(this._ref._id.toString());
4899
4929
  return;
4900
4930
  }
4901
- if (!params.pos) return;
4931
+ if (!params.position) return;
4902
4932
  this._ref = new Konva.Ellipse({
4903
4933
  stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
4904
4934
  strokeWidth: (_b = params.lineWidth) !== null && _b !== void 0 ? _b : 4,
4905
4935
  globalCompositeOperation: "source-over",
4906
4936
  lineCap: "round",
4907
4937
  lineJoin: "round",
4908
- x: params.pos.x,
4909
- y: params.pos.y,
4938
+ x: params.position.x,
4939
+ y: params.position.y,
4910
4940
  radiusX: params.radius.x,
4911
4941
  radiusY: params.radius.y,
4912
4942
  draggable: true,
@@ -4985,23 +5015,20 @@ class KonvaEllipse {
4985
5015
 
4986
5016
  class KonvaArrow {
4987
5017
  constructor(params, ref = null) {
4988
- var _a, _b, _c;
5018
+ var _a, _b;
4989
5019
  if (ref) {
4990
5020
  this._ref = ref;
4991
- this._ref.id(this._ref._id.toString());
4992
5021
  return;
4993
5022
  }
4994
- if (!params.points) return;
5023
+ if (!params.start || !params.end) return;
4995
5024
  this._ref = new Konva.Arrow({
4996
5025
  stroke: (_a = params.color) !== null && _a !== void 0 ? _a : "#ff0000",
4997
5026
  fill: (_b = params.color) !== null && _b !== void 0 ? _b : "#ff0000",
4998
- strokeWidth: (_c = params.lineWidth) !== null && _c !== void 0 ? _c : 4,
5027
+ strokeWidth: 4,
4999
5028
  globalCompositeOperation: "source-over",
5000
5029
  lineCap: "round",
5001
5030
  lineJoin: "round",
5002
- points: params.points,
5003
- pointerWidth: params.pointerWidth,
5004
- pointerLength: params.pointerLength,
5031
+ points: [ params.start.x, params.start.y, params.end.x, params.end.y ],
5005
5032
  draggable: true,
5006
5033
  strokeScaleEnabled: false
5007
5034
  });
@@ -5042,28 +5069,41 @@ class KonvaArrow {
5042
5069
  this._ref = null;
5043
5070
  }
5044
5071
  getPoints() {
5045
- return this._ref.attrs.points;
5072
+ const points = this._ref.points();
5073
+ return [ {
5074
+ x: points[0],
5075
+ y: points[1]
5076
+ }, {
5077
+ x: points[2],
5078
+ y: points[3]
5079
+ } ];
5046
5080
  }
5047
5081
  setPoints(points) {
5048
- this._ref.points(points);
5049
- }
5050
- getPointerWidth() {
5051
- return this._ref.pointerWidth();
5052
- }
5053
- setPointerWidth(w) {
5054
- this._ref.pointerWidth(w);
5082
+ if (points.length === 2) {
5083
+ this._ref.points([ points[0].x, points[0].y, points[1].x, points[1].y ]);
5084
+ }
5055
5085
  }
5056
- getPointerLength() {
5057
- return this._ref.pointerLength();
5086
+ getStartPoint() {
5087
+ const points = this._ref.points();
5088
+ return {
5089
+ x: points[0],
5090
+ y: points[1]
5091
+ };
5058
5092
  }
5059
- setPointerLength(l) {
5060
- this._ref.pointerLength(l);
5093
+ setStartPoint(x, y) {
5094
+ const points = this._ref.points();
5095
+ this._ref.points([ x, y, points[2], points[3] ]);
5061
5096
  }
5062
- getLineWidth() {
5063
- return this._ref.strokeWidth();
5097
+ getEndPoint() {
5098
+ const points = this._ref.points();
5099
+ return {
5100
+ x: points[2],
5101
+ y: points[3]
5102
+ };
5064
5103
  }
5065
- setLineWidth(size) {
5066
- this._ref.strokeWidth(size);
5104
+ setEndPoint(x, y) {
5105
+ const points = this._ref.points();
5106
+ this._ref.points([ points[0], points[1], x, y ]);
5067
5107
  }
5068
5108
  }
5069
5109
 
@@ -5074,7 +5114,6 @@ class KonvaImage {
5074
5114
  if (ref.height() === 0 || ref.width() === 0) return;
5075
5115
  this._ref = ref;
5076
5116
  this._canvasImage = ref.image();
5077
- this._ref.id(this._ref._id.toString());
5078
5117
  this._ratio = this._ref.height() / this._ref.width();
5079
5118
  return;
5080
5119
  }
@@ -5154,6 +5193,181 @@ class KonvaImage {
5154
5193
  }
5155
5194
  }
5156
5195
 
5196
+ class KonvaCloud {
5197
+ constructor(params, ref = null) {
5198
+ var _a, _b, _c, _d;
5199
+ if (ref) {
5200
+ this._ref = ref;
5201
+ return;
5202
+ }
5203
+ if (!params.position || !params.width || !params.height) return;
5204
+ const arcRadius = 16;
5205
+ this._ref = new Konva.Shape({
5206
+ x: params.position.x,
5207
+ y: params.position.y,
5208
+ width: (_a = params.width) !== null && _a !== void 0 ? _a : 200,
5209
+ height: (_b = params.height) !== null && _b !== void 0 ? _b : 200,
5210
+ stroke: (_c = params.color) !== null && _c !== void 0 ? _c : "#ff0000",
5211
+ strokeWidth: (_d = params.lineWidth) !== null && _d !== void 0 ? _d : 5,
5212
+ draggable: true,
5213
+ strokeScaleEnabled: false,
5214
+ globalCompositeOperation: "source-over",
5215
+ sceneFunc: (context, shape) => {
5216
+ function calculateMidpoint(position, width, height) {
5217
+ const midX = position.x + width / 2;
5218
+ const midY = position.y + height / 2;
5219
+ return {
5220
+ x: midX,
5221
+ y: midY
5222
+ };
5223
+ }
5224
+ const points = [ {
5225
+ x: 0,
5226
+ y: 0
5227
+ }, {
5228
+ x: 0 + this._ref.width(),
5229
+ y: 0
5230
+ }, {
5231
+ x: 0 + this._ref.width(),
5232
+ y: 0 + this._ref.height()
5233
+ }, {
5234
+ x: 0,
5235
+ y: 0 + this._ref.height()
5236
+ }, {
5237
+ x: 0,
5238
+ y: 0
5239
+ } ];
5240
+ const midPoint = calculateMidpoint({
5241
+ x: 0,
5242
+ y: 0
5243
+ }, this._ref.width(), this._ref.height());
5244
+ const baseArcLength = 30;
5245
+ context.beginPath();
5246
+ for (let iPoint = 0; iPoint < points.length - 1; iPoint++) {
5247
+ let approxArcLength = baseArcLength;
5248
+ const dx = points[iPoint + 1].x - points[iPoint].x;
5249
+ const dy = points[iPoint + 1].y - points[iPoint].y;
5250
+ const length = Math.sqrt(dx * dx + dy * dy);
5251
+ const arcCount = Math.floor(length / approxArcLength);
5252
+ const lengthMod = length % approxArcLength;
5253
+ approxArcLength = baseArcLength + arcCount / lengthMod;
5254
+ let pX = points[iPoint].x + dx / arcCount / 2;
5255
+ let pY = points[iPoint].y + dy / arcCount / 2;
5256
+ const pEndX = points[iPoint + 1].x;
5257
+ const pEndY = points[iPoint + 1].y;
5258
+ const endAngle = Math.atan((pEndY - pY) / (pEndX - pX));
5259
+ const startAngle = endAngle + Math.PI;
5260
+ const counterClockwise = pX > midPoint.x && pY > midPoint.y;
5261
+ for (let iArc = 0; iArc < arcCount; iArc++) {
5262
+ if (counterClockwise) {
5263
+ context.arc(pX, pY, arcRadius, endAngle, startAngle);
5264
+ } else {
5265
+ context.arc(pX, pY, arcRadius, startAngle, endAngle);
5266
+ }
5267
+ pX += dx / arcCount;
5268
+ pY += dy / arcCount;
5269
+ }
5270
+ }
5271
+ context.closePath();
5272
+ context.fillStrokeShape(shape);
5273
+ }
5274
+ });
5275
+ this._ref.className = "Cloud";
5276
+ this._ref.on("transform", (e => {
5277
+ const attrs = e.target.attrs;
5278
+ const minWidth = 100;
5279
+ const minHeight = 100;
5280
+ const newWidth = this._ref.width() * attrs.scaleX;
5281
+ const newHeight = this._ref.height() * attrs.scaleY;
5282
+ if (newWidth < minWidth || newHeight < minHeight) {
5283
+ this._ref.scale({
5284
+ x: 1,
5285
+ y: 1
5286
+ });
5287
+ return;
5288
+ }
5289
+ if (Math.abs(attrs.scaleX - 1) > 1e-5) {
5290
+ this._ref.width(newWidth);
5291
+ }
5292
+ if (Math.abs(attrs.scaleY - 1) > 1e-5) {
5293
+ this._ref.height(newHeight);
5294
+ }
5295
+ this._ref.scale({
5296
+ x: 1,
5297
+ y: 1
5298
+ });
5299
+ }));
5300
+ this._ref.getSelfRect = () => ({
5301
+ x: 0 - arcRadius,
5302
+ y: 0 - arcRadius,
5303
+ width: this._ref.width() + 2 * arcRadius,
5304
+ height: this._ref.height() + 2 * arcRadius
5305
+ });
5306
+ this._ref.id(this._ref._id.toString());
5307
+ }
5308
+ ref() {
5309
+ return this._ref;
5310
+ }
5311
+ id() {
5312
+ return this._ref.id();
5313
+ }
5314
+ enableMouseEditing(value) {
5315
+ this._ref.draggable(value);
5316
+ }
5317
+ type() {
5318
+ return "cloud";
5319
+ }
5320
+ getColor() {
5321
+ return this._ref.stroke();
5322
+ }
5323
+ setColor(hex) {
5324
+ this._ref.stroke(hex);
5325
+ }
5326
+ getRotation() {
5327
+ return this._ref.rotation();
5328
+ }
5329
+ setRotation(degrees) {
5330
+ this._ref.rotation(degrees);
5331
+ }
5332
+ getZIndex() {
5333
+ return this._ref.zIndex();
5334
+ }
5335
+ setZIndex(zIndex) {
5336
+ this._ref.zIndex(zIndex);
5337
+ }
5338
+ delete() {
5339
+ this._ref.destroy();
5340
+ this._ref = null;
5341
+ }
5342
+ getPosition() {
5343
+ return this._ref.position();
5344
+ }
5345
+ setPosition(x, y) {
5346
+ this._ref.position({
5347
+ x: x,
5348
+ y: y
5349
+ });
5350
+ }
5351
+ getWidth() {
5352
+ return this._ref.width();
5353
+ }
5354
+ setWidth(w) {
5355
+ this._ref.width(w);
5356
+ }
5357
+ getHeigth() {
5358
+ return this._ref.height();
5359
+ }
5360
+ setHeight(h) {
5361
+ this._ref.height(h);
5362
+ }
5363
+ getLineWidth() {
5364
+ return this._ref.strokeWidth();
5365
+ }
5366
+ setLineWidth(size) {
5367
+ this._ref.strokeWidth(size);
5368
+ }
5369
+ }
5370
+
5157
5371
  const MarkupMode2Konva = new Map([ [ MarkupMode.Line, {
5158
5372
  name: "Line",
5159
5373
  initializer: ref => new KonvaLine(null, ref)
@@ -5172,6 +5386,9 @@ const MarkupMode2Konva = new Map([ [ MarkupMode.Line, {
5172
5386
  } ], [ MarkupMode.Image, {
5173
5387
  name: "Image",
5174
5388
  initializer: ref => new KonvaImage(null, ref)
5389
+ } ], [ MarkupMode.Cloud, {
5390
+ name: "Cloud",
5391
+ initializer: ref => new KonvaCloud(null, ref)
5175
5392
  } ] ]);
5176
5393
 
5177
5394
  class KonvaMarkup {
@@ -5306,14 +5523,6 @@ class KonvaMarkup {
5306
5523
  this._viewer.update();
5307
5524
  }
5308
5525
  createViewpoint() {
5309
- function getLogicalPoint3dFromArray(array) {
5310
- return {
5311
- x: array[0],
5312
- y: array[1],
5313
- z: array[2]
5314
- };
5315
- }
5316
- if (!this._isInitialized) return {};
5317
5526
  if (!this._viewer.visualizeJs) return {};
5318
5527
  const visLib = this._viewer.visLib();
5319
5528
  const visViewer = visLib.getViewer();
@@ -5321,20 +5530,25 @@ class KonvaMarkup {
5321
5530
  const viewpoint = {
5322
5531
  lines: [],
5323
5532
  texts: [],
5533
+ arrows: [],
5534
+ clouds: [],
5535
+ ellipses: [],
5536
+ images: [],
5537
+ rectangles: [],
5324
5538
  clipping_planes: []
5325
5539
  };
5326
5540
  viewpoint.orthogonal_camera = {
5327
- view_point: getLogicalPoint3dFromArray(activeView.viewPosition),
5328
- direction: getLogicalPoint3dFromArray(activeView.viewTarget),
5329
- up_vector: getLogicalPoint3dFromArray(activeView.upVector),
5541
+ view_point: this.getPoint3dFromArray(activeView.viewPosition),
5542
+ direction: this.getPoint3dFromArray(activeView.viewTarget),
5543
+ up_vector: this.getPoint3dFromArray(activeView.upVector),
5330
5544
  field_width: activeView.viewFieldWidth,
5331
5545
  field_height: activeView.viewFieldHeight
5332
5546
  };
5333
5547
  for (let i = 0; i < activeView.numCuttingPlanes(); i++) {
5334
5548
  const cuttingPlane = activeView.getCuttingPlane(i);
5335
5549
  const plane = {
5336
- location: getLogicalPoint3dFromArray(cuttingPlane.getOrigin()),
5337
- direction: getLogicalPoint3dFromArray(cuttingPlane.normal())
5550
+ location: this.getPoint3dFromArray(cuttingPlane.getOrigin()),
5551
+ direction: this.getPoint3dFromArray(cuttingPlane.normal())
5338
5552
  };
5339
5553
  viewpoint.clipping_planes.push(plane);
5340
5554
  }
@@ -5344,34 +5558,7 @@ class KonvaMarkup {
5344
5558
  viewpoint.custom_fields = {
5345
5559
  markup_color: this.getMarkupColor()
5346
5560
  };
5347
- const markupLines = this.getMarkupLines();
5348
- if (markupLines && markupLines.length > 0) {
5349
- markupLines === null || markupLines === void 0 ? void 0 : markupLines.forEach((markupLine => {
5350
- const line = {
5351
- points: [],
5352
- color: markupLine.color || "ff0000",
5353
- width: markupLine.width || 3
5354
- };
5355
- for (const point of markupLine.points) {
5356
- line.points.push(getLogicalPoint3dFromArray(point));
5357
- }
5358
- viewpoint.lines.push(line);
5359
- }));
5360
- }
5361
- const markupTexts = this.getMarkupTexts();
5362
- if (markupTexts && markupTexts.length > 0) {
5363
- markupTexts === null || markupTexts === void 0 ? void 0 : markupTexts.forEach((markupText => {
5364
- var _a;
5365
- const text = {
5366
- position: getLogicalPoint3dFromArray(markupText.position),
5367
- text: markupText.text,
5368
- angle: (_a = markupText.rotation) !== null && _a !== void 0 ? _a : 0,
5369
- text_size: markupText.size,
5370
- color: markupText.color
5371
- };
5372
- viewpoint.texts.push(text);
5373
- }));
5374
- }
5561
+ this.fillViewpointShapes(viewpoint);
5375
5562
  viewpoint.description = (new Date).toDateString();
5376
5563
  return viewpoint;
5377
5564
  }
@@ -5407,6 +5594,11 @@ class KonvaMarkup {
5407
5594
  zIndex = 0;
5408
5595
  break;
5409
5596
 
5597
+ case "cloud":
5598
+ object = new KonvaCloud(params);
5599
+ zIndex = 1;
5600
+ break;
5601
+
5410
5602
  default:
5411
5603
  throw new Error("Markup CreateObject - unsupported type has been detected.");
5412
5604
  }
@@ -5435,6 +5627,9 @@ class KonvaMarkup {
5435
5627
  this.konvaLayerFind(MarkupMode.Image).forEach((image => {
5436
5628
  objects.push(new KonvaImage(null, image));
5437
5629
  }));
5630
+ this.konvaLayerFind(MarkupMode.Cloud).forEach((cloud => {
5631
+ objects.push(new KonvaCloud(null, cloud));
5632
+ }));
5438
5633
  return objects;
5439
5634
  }
5440
5635
  getSelectedObjects() {
@@ -5465,6 +5660,10 @@ class KonvaMarkup {
5465
5660
  case "Image":
5466
5661
  objects.push(new KonvaImage(null, obj));
5467
5662
  break;
5663
+
5664
+ case "Cloud":
5665
+ objects.push(new KonvaCloud(null, obj));
5666
+ break;
5468
5667
  }
5469
5668
  }));
5470
5669
  return objects;
@@ -5476,6 +5675,57 @@ class KonvaMarkup {
5476
5675
  clearSelected() {
5477
5676
  this._konvaTransformer.nodes([]);
5478
5677
  }
5678
+ getPoint3dFromArray(array) {
5679
+ return {
5680
+ x: array[0],
5681
+ y: array[1],
5682
+ z: array[2]
5683
+ };
5684
+ }
5685
+ fillViewpointShapes(viewpoint) {
5686
+ const markupLines = this.getMarkupLines();
5687
+ if (markupLines && markupLines.length > 0) {
5688
+ markupLines === null || markupLines === void 0 ? void 0 : markupLines.forEach((line => {
5689
+ viewpoint.lines.push(line);
5690
+ }));
5691
+ }
5692
+ const markupTexts = this.getMarkupTexts();
5693
+ if (markupTexts && markupTexts.length > 0) {
5694
+ markupTexts === null || markupTexts === void 0 ? void 0 : markupTexts.forEach((text => {
5695
+ viewpoint.texts.push(text);
5696
+ }));
5697
+ }
5698
+ const markupRectangles = this.getMarkupRectangles();
5699
+ if (markupRectangles && markupRectangles.length > 0) {
5700
+ markupRectangles === null || markupRectangles === void 0 ? void 0 : markupRectangles.forEach((rectangle => {
5701
+ viewpoint.rectangles.push(rectangle);
5702
+ }));
5703
+ }
5704
+ const markupEllipses = this.getMarkupEllipses();
5705
+ if (markupEllipses && markupEllipses.length > 0) {
5706
+ markupEllipses === null || markupEllipses === void 0 ? void 0 : markupEllipses.forEach((ellipse => {
5707
+ viewpoint.ellipses.push(ellipse);
5708
+ }));
5709
+ }
5710
+ const markupArrows = this.getMarkupArrows();
5711
+ if (markupArrows && markupArrows.length > 0) {
5712
+ markupArrows === null || markupArrows === void 0 ? void 0 : markupArrows.forEach((arrow => {
5713
+ viewpoint.arrows.push(arrow);
5714
+ }));
5715
+ }
5716
+ const markupImages = this.getMarkupImages();
5717
+ if (markupImages && markupImages.length > 0) {
5718
+ markupImages === null || markupImages === void 0 ? void 0 : markupImages.forEach((image => {
5719
+ viewpoint.images.push(image);
5720
+ }));
5721
+ }
5722
+ const markupClouds = this.getMarkupClouds();
5723
+ if (markupClouds && markupClouds.length > 0) {
5724
+ markupClouds === null || markupClouds === void 0 ? void 0 : markupClouds.forEach((cloud => {
5725
+ viewpoint.clouds.push(cloud);
5726
+ }));
5727
+ }
5728
+ }
5479
5729
  addObject(object) {
5480
5730
  this._konvaLayer.add(object.ref());
5481
5731
  }
@@ -5529,7 +5779,18 @@ class KonvaMarkup {
5529
5779
  y: 50
5530
5780
  });
5531
5781
  } else if (this._markupMode === MarkupMode.Arrow) {
5532
- this.addArrow([ pos.x, pos.y, pos.x + 50, pos.y + 50 ], 5, 5);
5782
+ this.addArrow({
5783
+ x: pos.x,
5784
+ y: pos.y
5785
+ }, {
5786
+ x: pos.x + 50,
5787
+ y: pos.y + 50
5788
+ });
5789
+ } else if (this._markupMode === MarkupMode.Cloud) {
5790
+ this.addCloud({
5791
+ x: pos.x,
5792
+ y: pos.y
5793
+ }, 200, 400);
5533
5794
  }
5534
5795
  }));
5535
5796
  stage.on("mouseup touchend", (e => {
@@ -5566,6 +5827,11 @@ class KonvaMarkup {
5566
5827
  } else {
5567
5828
  this.removeTextInput();
5568
5829
  }
5830
+ if (transformer.nodes().filter((x => x.className === "Cloud")).length > 0 || e.target.className === "Cloud") {
5831
+ transformer.rotateEnabled(false);
5832
+ } else {
5833
+ transformer.rotateEnabled(true);
5834
+ }
5569
5835
  const metaPressed = e.evt.shiftKey || e.evt.ctrlKey || e.evt.metaKey;
5570
5836
  const isSelected = transformer.nodes().indexOf(e.target) >= 0;
5571
5837
  if (!metaPressed && !isSelected) {
@@ -5606,7 +5872,7 @@ class KonvaMarkup {
5606
5872
  getMarkupLines() {
5607
5873
  const lines = [];
5608
5874
  this.konvaLayerFind(MarkupMode.Line).forEach((line => {
5609
- const linePoints = line.attrs.points;
5875
+ const linePoints = line.points();
5610
5876
  if (!linePoints) return;
5611
5877
  const worldPoints = [];
5612
5878
  const absoluteTransform = line.getAbsoluteTransform();
@@ -5620,9 +5886,11 @@ class KonvaMarkup {
5620
5886
  }
5621
5887
  const konvaLine = new KonvaLine(null, line);
5622
5888
  lines.push({
5623
- points: worldPoints,
5624
- color: konvaLine.getColor(),
5625
- width: konvaLine.getLineWidth()
5889
+ id: konvaLine.id(),
5890
+ points: worldPoints.map((p => this.getPoint3dFromArray(p))),
5891
+ color: konvaLine.getColor() || "ff0000",
5892
+ type: konvaLine.getLineType() || "solid",
5893
+ width: konvaLine.getLineWidth() || 3
5626
5894
  });
5627
5895
  }));
5628
5896
  return lines;
@@ -5634,36 +5902,174 @@ class KonvaMarkup {
5634
5902
  const projMtrx = this._viewer.visViewer().activeView.projectionMatrix;
5635
5903
  const mtrxNumber = projMtrx.get(1, 1);
5636
5904
  const tol = 1e-6;
5637
- if (!(mtrxNumber < tol && mtrxNumber > -tol)) {
5905
+ if (mtrxNumber > tol || mtrxNumber < -tol) {
5638
5906
  textScale = 1 / mtrxNumber;
5639
5907
  }
5640
5908
  this.konvaLayerFind(MarkupMode.Text).forEach((text => {
5641
5909
  if (!text) return;
5910
+ const position = this._viewer.visViewer().screenToWorld(text.x() * window.devicePixelRatio, text.y() * window.devicePixelRatio);
5911
+ const shape = new KonvaText(null, text);
5642
5912
  texts.push({
5643
- position: this._viewer.visViewer().screenToWorld(text.attrs.x * window.devicePixelRatio, text.attrs.y * window.devicePixelRatio),
5644
- text: text.attrs.text,
5645
- rotation: text.attrs.rotation && Math.abs(text.attrs.rotation) > tol ? text.attrs.rotation : 0,
5646
- size: textSize * textScale,
5647
- color: text.attrs.fill
5913
+ id: shape.id(),
5914
+ position: this.getPoint3dFromArray(position),
5915
+ text: shape.getText(),
5916
+ text_size: textSize * textScale,
5917
+ angle: shape.getRotation(),
5918
+ color: shape.getColor(),
5919
+ font_size: shape.getFontSize()
5648
5920
  });
5649
5921
  }));
5650
5922
  return texts;
5651
5923
  }
5924
+ getMarkupRectangles() {
5925
+ const rectangles = [];
5926
+ this.konvaLayerFind(MarkupMode.Rectangle).forEach((rect => {
5927
+ const position = rect.position();
5928
+ const worldPoint = this._viewer.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
5929
+ const shape = new KonvaRectangle(null, rect);
5930
+ rectangles.push({
5931
+ id: shape.id(),
5932
+ position: this.getPoint3dFromArray(worldPoint),
5933
+ width: shape.getWidth(),
5934
+ height: shape.getHeigth(),
5935
+ line_width: shape.getLineWidth(),
5936
+ color: shape.getColor()
5937
+ });
5938
+ }));
5939
+ return rectangles;
5940
+ }
5941
+ getMarkupEllipses() {
5942
+ const ellipses = [];
5943
+ this.konvaLayerFind(MarkupMode.Ellipse).forEach((ellipse => {
5944
+ const position = ellipse.position();
5945
+ const worldPoint = this._viewer.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
5946
+ const shape = new KonvaEllipse(null, ellipse);
5947
+ ellipses.push({
5948
+ id: shape.id(),
5949
+ position: this.getPoint3dFromArray(worldPoint),
5950
+ radius: {
5951
+ x: ellipse.getRadiusX(),
5952
+ y: ellipse.getRadiusY()
5953
+ },
5954
+ line_width: shape.getLineWidth(),
5955
+ color: shape.getColor()
5956
+ });
5957
+ }));
5958
+ return ellipses;
5959
+ }
5960
+ getMarkupArrows() {
5961
+ const arrows = [];
5962
+ this.konvaLayerFind(MarkupMode.Arrow).forEach((arrow => {
5963
+ const absoluteTransform = arrow.getAbsoluteTransform();
5964
+ const atStartPoint = absoluteTransform.point({
5965
+ x: arrow.points()[0],
5966
+ y: arrow.points()[1]
5967
+ });
5968
+ const worldStartPoint = this._viewer.visViewer().screenToWorld(atStartPoint.x * window.devicePixelRatio, atStartPoint.y * window.devicePixelRatio);
5969
+ const atEndPoint = absoluteTransform.point({
5970
+ x: arrow.points()[2],
5971
+ y: arrow.points()[3]
5972
+ });
5973
+ const worldEndPoint = this._viewer.visViewer().screenToWorld(atEndPoint.x * window.devicePixelRatio, atEndPoint.y * window.devicePixelRatio);
5974
+ const shape = new KonvaArrow(null, arrow);
5975
+ arrows.push({
5976
+ id: shape.id(),
5977
+ start: this.getPoint3dFromArray(worldStartPoint),
5978
+ end: this.getPoint3dFromArray(worldEndPoint),
5979
+ color: shape.getColor()
5980
+ });
5981
+ }));
5982
+ return arrows;
5983
+ }
5984
+ getMarkupImages() {
5985
+ const images = [];
5986
+ this.konvaLayerFind(MarkupMode.Image).forEach((image => {
5987
+ const position = image.position();
5988
+ const worldPoint = this._viewer.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
5989
+ const shape = new KonvaImage(null, image);
5990
+ images.push({
5991
+ id: shape.id(),
5992
+ position: this.getPoint3dFromArray(worldPoint),
5993
+ src: shape.getSrc(),
5994
+ width: shape.getWidth(),
5995
+ height: shape.getHeight()
5996
+ });
5997
+ }));
5998
+ return images;
5999
+ }
6000
+ getMarkupClouds() {
6001
+ const clouds = [];
6002
+ this.konvaLayerFind(MarkupMode.Cloud).forEach((cloud => {
6003
+ const position = cloud.position();
6004
+ const worldPoint = this._viewer.visViewer().screenToWorld(position.x * window.devicePixelRatio, position.y * window.devicePixelRatio);
6005
+ const shape = new KonvaCloud(null, cloud);
6006
+ clouds.push({
6007
+ id: shape.id(),
6008
+ position: this.getPoint3dFromArray(worldPoint),
6009
+ width: shape.getWidth(),
6010
+ height: shape.getHeigth(),
6011
+ line_width: shape.getLineWidth(),
6012
+ color: shape.getColor()
6013
+ });
6014
+ }));
6015
+ return clouds;
6016
+ }
5652
6017
  loadMarkup(viewpoint) {
5653
- const vpLines = viewpoint.lines;
5654
- vpLines === null || vpLines === void 0 ? void 0 : vpLines.forEach((vpLine => {
6018
+ var _a, _b, _c, _d, _e, _f, _g;
6019
+ (_a = viewpoint.lines) === null || _a === void 0 ? void 0 : _a.forEach((vpLine => {
5655
6020
  const linePoints = [];
5656
6021
  vpLine.points.forEach((point => {
5657
6022
  const screenPoint = worldToScreen([ point.x, point.y, point.z ], this._viewer.visualizeJs, this._viewer.visViewer());
5658
6023
  linePoints.push(screenPoint.x);
5659
6024
  linePoints.push(screenPoint.y);
5660
6025
  }));
5661
- this.addLine(linePoints, vpLine.color, vpLine.width);
6026
+ this.addLine(linePoints, vpLine.color, vpLine.type, vpLine.width, vpLine.id);
5662
6027
  }));
5663
- const vpTexts = viewpoint.texts;
5664
- vpTexts === null || vpTexts === void 0 ? void 0 : vpTexts.forEach((vpText => {
6028
+ (_b = viewpoint.texts) === null || _b === void 0 ? void 0 : _b.forEach((vpText => {
5665
6029
  const screenPoint = worldToScreen([ vpText.position.x, vpText.position.y, vpText.position.z ], this._viewer.visualizeJs, this._viewer.visViewer());
5666
- this.addText(vpText.text, screenPoint, vpText.angle, vpText.color);
6030
+ this.addText(vpText.text, screenPoint, vpText.angle, vpText.color, vpText.text_size, vpText.font_size, vpText.id);
6031
+ }));
6032
+ (_c = viewpoint.rectangles) === null || _c === void 0 ? void 0 : _c.forEach((vpRect => {
6033
+ const screenPoint = worldToScreen([ vpRect.position.x, vpRect.position.y, vpRect.position.z ], this._viewer.visualizeJs, this._viewer.visViewer());
6034
+ this.addRectangle({
6035
+ x: screenPoint.x,
6036
+ y: screenPoint.y
6037
+ }, vpRect.width, vpRect.height, vpRect.line_width, vpRect.color, vpRect.id);
6038
+ }));
6039
+ (_d = viewpoint.ellipses) === null || _d === void 0 ? void 0 : _d.forEach((vpEllipse => {
6040
+ const screenPoint = worldToScreen([ vpEllipse.position.x, vpEllipse.position.y, vpEllipse.position.z ], this._viewer.visualizeJs, this._viewer.visViewer());
6041
+ this.addEllipse({
6042
+ x: screenPoint.x,
6043
+ y: screenPoint.y
6044
+ }, {
6045
+ x: vpEllipse.radius.x,
6046
+ y: vpEllipse.radius.y
6047
+ }, vpEllipse.line_width, vpEllipse.color, vpEllipse.id);
6048
+ }));
6049
+ (_e = viewpoint.arrows) === null || _e === void 0 ? void 0 : _e.forEach((vpArrow => {
6050
+ const startPoint = worldToScreen([ vpArrow.start.x, vpArrow.start.y, vpArrow.start.z ], this._viewer.visualizeJs, this._viewer.visViewer());
6051
+ const endPoint = worldToScreen([ vpArrow.end.x, vpArrow.end.y, vpArrow.end.z ], this._viewer.visualizeJs, this._viewer.visViewer());
6052
+ this.addArrow({
6053
+ x: startPoint.x,
6054
+ y: startPoint.y
6055
+ }, {
6056
+ x: endPoint.x,
6057
+ y: endPoint.y
6058
+ }, vpArrow.color, vpArrow.id);
6059
+ }));
6060
+ (_f = viewpoint.clouds) === null || _f === void 0 ? void 0 : _f.forEach((vpCloud => {
6061
+ const screenPoint = worldToScreen([ vpCloud.position.x, vpCloud.position.y, vpCloud.position.z ], this._viewer.visualizeJs, this._viewer.visViewer());
6062
+ this.addCloud({
6063
+ x: screenPoint.x,
6064
+ y: screenPoint.y
6065
+ }, vpCloud.width, vpCloud.height, vpCloud.line_width, vpCloud.color, vpCloud.id);
6066
+ }));
6067
+ (_g = viewpoint.images) === null || _g === void 0 ? void 0 : _g.forEach((vpImage => {
6068
+ const screenPoint = worldToScreen([ vpImage.position.x, vpImage.position.y, vpImage.position.z ], this._viewer.visualizeJs, this._viewer.visViewer());
6069
+ this.addImage({
6070
+ x: screenPoint.x,
6071
+ y: screenPoint.y
6072
+ }, vpImage.src, vpImage.width, vpImage.height, vpImage.id);
5667
6073
  }));
5668
6074
  }
5669
6075
  combineMarkupWithDrawing() {
@@ -5681,7 +6087,7 @@ class KonvaMarkup {
5681
6087
  }), 0, 0);
5682
6088
  return tempCanvas.toDataURL("image/jpeg", .25);
5683
6089
  }
5684
- addLine(linePoints, color, width) {
6090
+ addLine(linePoints, color, type, width, id) {
5685
6091
  if (!linePoints || linePoints.length === 0) return;
5686
6092
  const points = [];
5687
6093
  for (let i = 0; i < linePoints.length; i += 2) {
@@ -5693,7 +6099,9 @@ class KonvaMarkup {
5693
6099
  const konvaLine = new KonvaLine({
5694
6100
  points: points,
5695
6101
  color: color || this._markupColor.HexColor,
5696
- width: width || this.lineWidth
6102
+ type: type || LineType.Solid,
6103
+ width: width || this.lineWidth,
6104
+ id: id
5697
6105
  });
5698
6106
  const obj = konvaLine.ref();
5699
6107
  this._konvaLayer.add(obj);
@@ -5735,20 +6143,31 @@ class KonvaMarkup {
5735
6143
  this._textInputPos = null;
5736
6144
  this._textInputAngle = 0;
5737
6145
  }
5738
- addText(specifiedText, pos, angle, color) {
6146
+ addText(specifiedText, position, angle, color, textSize, fontSize, id) {
5739
6147
  if (specifiedText) {
5740
- const konvaText = new Konva.Text({
5741
- x: pos.x,
5742
- y: pos.y,
6148
+ const tol = 1e-6;
6149
+ if (textSize && textSize > tol && (!fontSize || fontSize < tol)) {
6150
+ const size = .02;
6151
+ let scale = 1;
6152
+ const projMtrx = this._viewer.visViewer().activeView.projectionMatrix;
6153
+ const mtrxNumber = projMtrx.get(1, 1);
6154
+ if (mtrxNumber > tol || mtrxNumber < -tol) {
6155
+ scale = 1 / mtrxNumber;
6156
+ }
6157
+ fontSize = textSize / (scale / size) / 34;
6158
+ }
6159
+ const konvaText = new KonvaText({
6160
+ position: {
6161
+ x: position.x,
6162
+ y: position.y
6163
+ },
5743
6164
  text: specifiedText,
5744
- fontSize: 34,
5745
- fontFamily: this.TEXT_FONT_FAMILY,
5746
- fill: color || this._markupColor.HexColor,
5747
- align: "left",
5748
- draggable: true,
5749
- rotation: angle
6165
+ fontSize: fontSize,
6166
+ color: color || this._markupColor.HexColor,
6167
+ rotation: angle,
6168
+ id: id
5750
6169
  });
5751
- this._konvaLayer.add(konvaText);
6170
+ this._konvaLayer.add(konvaText.ref());
5752
6171
  }
5753
6172
  const trNodes = this._konvaTransformer.nodes();
5754
6173
  if (trNodes.length > 0) {
@@ -5758,59 +6177,71 @@ class KonvaMarkup {
5758
6177
  this.removeTextInput();
5759
6178
  return;
5760
6179
  }
5761
- addRectangle(pos, width, height) {
5762
- if (!pos) return;
5763
- const konvaRectangle = new Konva.Rect({
5764
- stroke: this._markupColor.HexColor,
5765
- strokeWidth: this.lineWidth,
5766
- globalCompositeOperation: "source-over",
5767
- lineCap: "round",
5768
- lineJoin: "round",
5769
- x: pos.x,
5770
- y: pos.y,
6180
+ addRectangle(position, width, height, lineWidth, color, id) {
6181
+ if (!position) return;
6182
+ const konvaRectangle = new KonvaRectangle({
6183
+ position: position,
6184
+ color: color || this._markupColor.HexColor,
6185
+ lineWidth: lineWidth || this.lineWidth,
5771
6186
  width: width,
5772
6187
  height: height,
5773
- draggable: true,
5774
- strokeScaleEnabled: false
6188
+ id: id
5775
6189
  });
5776
- this._konvaLayer.add(konvaRectangle);
5777
- return konvaRectangle;
5778
- }
5779
- addEllipse(pos, radius) {
5780
- if (!pos) return;
5781
- const konvaEllipse = new Konva.Ellipse({
5782
- stroke: this._markupColor.HexColor,
5783
- strokeWidth: this.lineWidth,
5784
- globalCompositeOperation: "source-over",
5785
- lineCap: "round",
5786
- lineJoin: "round",
5787
- x: pos.x,
5788
- y: pos.y,
5789
- radiusX: radius.x,
5790
- radiusY: radius.y,
5791
- draggable: true,
5792
- strokeScaleEnabled: false
6190
+ const obj = konvaRectangle.ref();
6191
+ this._konvaLayer.add(obj);
6192
+ return obj;
6193
+ }
6194
+ addEllipse(position, radius, lineWidth, color, id) {
6195
+ if (!position) return;
6196
+ const konvaEllipse = new KonvaEllipse({
6197
+ position: position,
6198
+ radius: radius,
6199
+ lineWidth: lineWidth,
6200
+ color: color || this._markupColor.HexColor,
6201
+ id: id
5793
6202
  });
5794
- this._konvaLayer.add(konvaEllipse);
5795
- return konvaEllipse;
5796
- }
5797
- addArrow(points, pointerWidth, pointerLength) {
5798
- if (!points) return;
5799
- const konvaArrow = new Konva.Arrow({
5800
- stroke: this._markupColor.HexColor,
5801
- fill: this._markupColor.HexColor,
5802
- strokeWidth: this.lineWidth,
5803
- globalCompositeOperation: "source-over",
5804
- lineCap: "round",
5805
- lineJoin: "round",
5806
- points: points,
5807
- pointerWidth: pointerWidth,
5808
- pointerLength: pointerLength,
5809
- draggable: true,
5810
- strokeScaleEnabled: false
6203
+ const obj = konvaEllipse.ref();
6204
+ this._konvaLayer.add(obj);
6205
+ return obj;
6206
+ }
6207
+ addArrow(start, end, color, id) {
6208
+ if (!start || !end) return;
6209
+ const konvaArrow = new KonvaArrow({
6210
+ start: start,
6211
+ end: end,
6212
+ color: color || this._markupColor.HexColor,
6213
+ id: id
5811
6214
  });
5812
- this._konvaLayer.add(konvaArrow);
5813
- return konvaArrow;
6215
+ const obj = konvaArrow.ref();
6216
+ this._konvaLayer.add(obj);
6217
+ return obj;
6218
+ }
6219
+ addCloud(position, width, height, lineWidth, color, id) {
6220
+ if (!position || !width || !height) return;
6221
+ const konvaCloud = new KonvaCloud({
6222
+ position: position,
6223
+ width: width,
6224
+ height: height,
6225
+ color: color || this._markupColor.HexColor,
6226
+ lineWidth: lineWidth || this.lineWidth,
6227
+ id: id
6228
+ });
6229
+ const obj = konvaCloud.ref();
6230
+ this._konvaLayer.add(obj);
6231
+ return obj;
6232
+ }
6233
+ addImage(position, src, width, height, id) {
6234
+ if (!position || !width || !height) return;
6235
+ const konvaImage = new KonvaImage({
6236
+ position: position,
6237
+ src: src,
6238
+ width: width,
6239
+ height: height,
6240
+ id: id
6241
+ });
6242
+ const obj = konvaImage.ref();
6243
+ this._konvaLayer.add(obj);
6244
+ return obj;
5814
6245
  }
5815
6246
  }
5816
6247
 
@@ -7145,7 +7576,7 @@ function zoomToSelected(viewer) {
7145
7576
 
7146
7577
  commands("VisualizeJS").registerCommand("zoomToSelected", zoomToSelected);
7147
7578
 
7148
- const version = "25.2.2";
7579
+ const version = "25.2.5";
7149
7580
 
7150
7581
  export { Assembly, CANVAS_EVENTS, ClashTest, Client, EventEmitter2, File$1 as File, Job, Member, Model, OdBaseDragger, Options, Permission, Project, Role, User, Viewer, Viewer as VisualizejsViewer, commands, version };
7151
7582
  //# sourceMappingURL=client.module.js.map