@inweb/client 25.3.11 → 25.3.13

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 (206) hide show
  1. package/README.md +17 -35
  2. package/dist/client.js +33 -17365
  3. package/dist/client.js.map +1 -1
  4. package/dist/client.min.js +1 -1
  5. package/dist/client.module.js +9 -5552
  6. package/dist/client.module.js.map +1 -1
  7. package/lib/Api/Assembly.d.ts +0 -1
  8. package/lib/Api/ClashTest.d.ts +0 -1
  9. package/lib/Api/Client.d.ts +1 -2
  10. package/lib/Api/ClientEvents.d.ts +0 -1
  11. package/lib/Api/File.d.ts +0 -1
  12. package/lib/Api/HttpClient.d.ts +0 -1
  13. package/lib/Api/IAssembly.d.ts +0 -1
  14. package/lib/Api/IFile.d.ts +0 -1
  15. package/lib/Api/IHttpClient.d.ts +0 -1
  16. package/lib/Api/IUser.d.ts +0 -1
  17. package/lib/Api/Job.d.ts +0 -1
  18. package/lib/Api/Member.d.ts +0 -1
  19. package/lib/Api/Model.d.ts +13 -1
  20. package/lib/Api/Permission.d.ts +0 -1
  21. package/lib/Api/Project.d.ts +0 -1
  22. package/lib/Api/Role.d.ts +0 -1
  23. package/lib/Api/User.d.ts +0 -1
  24. package/lib/Api/impl/FetchError.d.ts +0 -1
  25. package/lib/Api/impl/Utils.d.ts +0 -1
  26. package/lib/Api/impl/http.d.ts +0 -1
  27. package/lib/ConvetMath.d.ts +0 -1
  28. package/lib/index.d.ts +1 -13
  29. package/package.json +5 -11
  30. package/src/Api/Client.ts +2 -1
  31. package/src/Api/Model.ts +19 -0
  32. package/src/index.ts +1 -13
  33. package/lib/Viewer/CanvasEvents.d.ts +0 -2
  34. package/lib/Viewer/Commands/ApplyModelTransform.d.ts +0 -2
  35. package/lib/Viewer/Commands/ClearMarkup.d.ts +0 -2
  36. package/lib/Viewer/Commands/ClearSlices.d.ts +0 -2
  37. package/lib/Viewer/Commands/CreatePreview.d.ts +0 -2
  38. package/lib/Viewer/Commands/Explode.d.ts +0 -2
  39. package/lib/Viewer/Commands/GetDefaultViewPositions.d.ts +0 -2
  40. package/lib/Viewer/Commands/GetModels.d.ts +0 -2
  41. package/lib/Viewer/Commands/GetSelected.d.ts +0 -2
  42. package/lib/Viewer/Commands/HideSelected.d.ts +0 -2
  43. package/lib/Viewer/Commands/IsolateSelected.d.ts +0 -2
  44. package/lib/Viewer/Commands/RegenerateAll.d.ts +0 -2
  45. package/lib/Viewer/Commands/ResetView.d.ts +0 -2
  46. package/lib/Viewer/Commands/SelectModel.d.ts +0 -2
  47. package/lib/Viewer/Commands/SetActiveDragger.d.ts +0 -2
  48. package/lib/Viewer/Commands/SetDefaultViewPosition.d.ts +0 -2
  49. package/lib/Viewer/Commands/SetMarkupColor.d.ts +0 -2
  50. package/lib/Viewer/Commands/SetSelected.d.ts +0 -2
  51. package/lib/Viewer/Commands/ShowAll.d.ts +0 -2
  52. package/lib/Viewer/Commands/Unselect.d.ts +0 -2
  53. package/lib/Viewer/Commands/ZoomToExtents.d.ts +0 -2
  54. package/lib/Viewer/Commands/ZoomToObjects.d.ts +0 -2
  55. package/lib/Viewer/Commands/ZoomToSelected.d.ts +0 -2
  56. package/lib/Viewer/Commands.d.ts +0 -3
  57. package/lib/Viewer/Draggers/Actions/OrbitAction.d.ts +0 -22
  58. package/lib/Viewer/Draggers/Actions/PanAction.d.ts +0 -18
  59. package/lib/Viewer/Draggers/Actions/ZoomAction.d.ts +0 -8
  60. package/lib/Viewer/Draggers/Common/Geometry.d.ts +0 -115
  61. package/lib/Viewer/Draggers/Common/GestureManager.d.ts +0 -41
  62. package/lib/Viewer/Draggers/Common/OdBaseDragger.d.ts +0 -54
  63. package/lib/Viewer/Draggers/Common/OdaGeAction.d.ts +0 -30
  64. package/lib/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.d.ts +0 -31
  65. package/lib/Viewer/Draggers/MeasureLineDragger/MeasureUtils.d.ts +0 -20
  66. package/lib/Viewer/Draggers/MeasureLineDragger/index.d.ts +0 -24
  67. package/lib/Viewer/Draggers/OdBaseCuttingPlaneDragger.d.ts +0 -27
  68. package/lib/Viewer/Draggers/OdCuttingPlaneXAxisDragger.d.ts +0 -8
  69. package/lib/Viewer/Draggers/OdCuttingPlaneYAxisDragger.d.ts +0 -8
  70. package/lib/Viewer/Draggers/OdCuttingPlaneZAxisDragger.d.ts +0 -8
  71. package/lib/Viewer/Draggers/OdOrbitDragger.d.ts +0 -15
  72. package/lib/Viewer/Draggers/OdPanDragger.d.ts +0 -12
  73. package/lib/Viewer/Draggers/OdZoomDragger.d.ts +0 -12
  74. package/lib/Viewer/Draggers/OdZoomWheelDragger.d.ts +0 -11
  75. package/lib/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.d.ts +0 -19
  76. package/lib/Viewer/Draggers/OdZoomWindowDragger/index.d.ts +0 -14
  77. package/lib/Viewer/Draggers/OdaLineDragger.d.ts +0 -15
  78. package/lib/Viewer/Draggers/OdaTextDragger.d.ts +0 -16
  79. package/lib/Viewer/Draggers/OdaWalkDragger.d.ts +0 -30
  80. package/lib/Viewer/Draggers/OrbitAroundBuildingDragger.d.ts +0 -19
  81. package/lib/Viewer/EventEmitter2.d.ts +0 -54
  82. package/lib/Viewer/ICommands.d.ts +0 -25
  83. package/lib/Viewer/IEventEmitter2.d.ts +0 -13
  84. package/lib/Viewer/IViewer.d.ts +0 -30
  85. package/lib/Viewer/Loaders/BaseLoader.d.ts +0 -11
  86. package/lib/Viewer/Loaders/LoaderFactory.d.ts +0 -11
  87. package/lib/Viewer/Loaders/TCSLoader.d.ts +0 -5
  88. package/lib/Viewer/Loaders/UpdaterController.d.ts +0 -15
  89. package/lib/Viewer/Loaders/VsfXLoader.d.ts +0 -5
  90. package/lib/Viewer/Loaders/VsfXPartialLoader.d.ts +0 -5
  91. package/lib/Viewer/Loaders/VsfXStreamingLoader.d.ts +0 -5
  92. package/lib/Viewer/Markup/Api/IMarkupArrow.d.ts +0 -22
  93. package/lib/Viewer/Markup/Api/IMarkupCloud.d.ts +0 -15
  94. package/lib/Viewer/Markup/Api/IMarkupColorable.d.ts +0 -5
  95. package/lib/Viewer/Markup/Api/IMarkupEllipse.d.ts +0 -15
  96. package/lib/Viewer/Markup/Api/IMarkupImage.d.ts +0 -15
  97. package/lib/Viewer/Markup/Api/IMarkupLine.d.ts +0 -13
  98. package/lib/Viewer/Markup/Api/IMarkupObject.d.ts +0 -12
  99. package/lib/Viewer/Markup/Api/IMarkupRectangle.d.ts +0 -15
  100. package/lib/Viewer/Markup/Api/IMarkupText.d.ts +0 -13
  101. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaArrow.d.ts +0 -47
  102. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaCloud.d.ts +0 -36
  103. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.d.ts +0 -41
  104. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaImage.d.ts +0 -37
  105. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaLine.d.ts +0 -37
  106. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.d.ts +0 -39
  107. package/lib/Viewer/Markup/Api/Impl/Konva/KonvaText.d.ts +0 -38
  108. package/lib/Viewer/Markup/IMarkup.d.ts +0 -40
  109. package/lib/Viewer/Markup/IViewpoint.d.ts +0 -129
  110. package/lib/Viewer/Markup/Impl/Konva/KonvaMarkup.d.ts +0 -72
  111. package/lib/Viewer/Markup/Impl/Konva/MarkupColor.d.ts +0 -19
  112. package/lib/Viewer/Markup/Impl/Visualize/VisualizeMarkup.d.ts +0 -34
  113. package/lib/Viewer/Markup/MarkupFactory.d.ts +0 -7
  114. package/lib/Viewer/Options.d.ts +0 -239
  115. package/lib/Viewer/OptionsEvents.d.ts +0 -26
  116. package/lib/Viewer/Viewer.d.ts +0 -354
  117. package/lib/Viewer/ViewerCommands.d.ts +0 -23
  118. package/lib/Viewer/ViewerEvents.d.ts +0 -601
  119. package/lib/Viewer/utils.d.ts +0 -4
  120. package/src/Viewer/CanvasEvents.ts +0 -41
  121. package/src/Viewer/Commands/ApplyModelTransform.ts +0 -70
  122. package/src/Viewer/Commands/ClearMarkup.ts +0 -28
  123. package/src/Viewer/Commands/ClearSlices.ts +0 -27
  124. package/src/Viewer/Commands/CreatePreview.ts +0 -33
  125. package/src/Viewer/Commands/Explode.ts +0 -38
  126. package/src/Viewer/Commands/GetDefaultViewPositions.ts +0 -36
  127. package/src/Viewer/Commands/GetModels.ts +0 -43
  128. package/src/Viewer/Commands/GetSelected.ts +0 -58
  129. package/src/Viewer/Commands/HideSelected.ts +0 -37
  130. package/src/Viewer/Commands/IsolateSelected.ts +0 -37
  131. package/src/Viewer/Commands/RegenerateAll.ts +0 -37
  132. package/src/Viewer/Commands/ResetView.ts +0 -43
  133. package/src/Viewer/Commands/SelectModel.ts +0 -52
  134. package/src/Viewer/Commands/SetActiveDragger.ts +0 -29
  135. package/src/Viewer/Commands/SetDefaultViewPosition.ts +0 -50
  136. package/src/Viewer/Commands/SetMarkupColor.ts +0 -29
  137. package/src/Viewer/Commands/SetSelected.ts +0 -47
  138. package/src/Viewer/Commands/ShowAll.ts +0 -37
  139. package/src/Viewer/Commands/Unselect.ts +0 -37
  140. package/src/Viewer/Commands/ZoomToExtents.ts +0 -43
  141. package/src/Viewer/Commands/ZoomToObjects.ts +0 -47
  142. package/src/Viewer/Commands/ZoomToSelected.ts +0 -39
  143. package/src/Viewer/Commands.ts +0 -81
  144. package/src/Viewer/Draggers/Actions/OrbitAction.ts +0 -250
  145. package/src/Viewer/Draggers/Actions/PanAction.ts +0 -102
  146. package/src/Viewer/Draggers/Actions/ZoomAction.ts +0 -45
  147. package/src/Viewer/Draggers/Common/Geometry.ts +0 -152
  148. package/src/Viewer/Draggers/Common/GestureManager.ts +0 -263
  149. package/src/Viewer/Draggers/Common/OdBaseDragger.ts +0 -270
  150. package/src/Viewer/Draggers/Common/OdaGeAction.ts +0 -146
  151. package/src/Viewer/Draggers/MeasureLineDragger/MeasureLineItem.ts +0 -248
  152. package/src/Viewer/Draggers/MeasureLineDragger/MeasureUtils.ts +0 -182
  153. package/src/Viewer/Draggers/MeasureLineDragger/index.ts +0 -166
  154. package/src/Viewer/Draggers/OdBaseCuttingPlaneDragger.ts +0 -182
  155. package/src/Viewer/Draggers/OdCuttingPlaneXAxisDragger.ts +0 -53
  156. package/src/Viewer/Draggers/OdCuttingPlaneYAxisDragger.ts +0 -53
  157. package/src/Viewer/Draggers/OdCuttingPlaneZAxisDragger.ts +0 -53
  158. package/src/Viewer/Draggers/OdOrbitDragger.ts +0 -70
  159. package/src/Viewer/Draggers/OdPanDragger.ts +0 -62
  160. package/src/Viewer/Draggers/OdZoomDragger.ts +0 -59
  161. package/src/Viewer/Draggers/OdZoomWheelDragger.ts +0 -103
  162. package/src/Viewer/Draggers/OdZoomWindowDragger/OdSelectionFrame.ts +0 -123
  163. package/src/Viewer/Draggers/OdZoomWindowDragger/index.ts +0 -75
  164. package/src/Viewer/Draggers/OdaLineDragger.ts +0 -80
  165. package/src/Viewer/Draggers/OdaTextDragger.ts +0 -118
  166. package/src/Viewer/Draggers/OdaWalkDragger.ts +0 -278
  167. package/src/Viewer/Draggers/OrbitAroundBuildingDragger.ts +0 -184
  168. package/src/Viewer/EventEmitter2.ts +0 -116
  169. package/src/Viewer/ICommands.ts +0 -53
  170. package/src/Viewer/IEventEmitter2.ts +0 -36
  171. package/src/Viewer/IViewer.ts +0 -59
  172. package/src/Viewer/Loaders/BaseLoader.ts +0 -40
  173. package/src/Viewer/Loaders/LoaderFactory.ts +0 -47
  174. package/src/Viewer/Loaders/TCSLoader.ts +0 -82
  175. package/src/Viewer/Loaders/UpdaterController.ts +0 -36
  176. package/src/Viewer/Loaders/VsfXLoader.ts +0 -65
  177. package/src/Viewer/Loaders/VsfXPartialLoader.ts +0 -208
  178. package/src/Viewer/Loaders/VsfXStreamingLoader.ts +0 -87
  179. package/src/Viewer/Markup/Api/IMarkupArrow.ts +0 -12
  180. package/src/Viewer/Markup/Api/IMarkupCloud.ts +0 -15
  181. package/src/Viewer/Markup/Api/IMarkupColorable.ts +0 -4
  182. package/src/Viewer/Markup/Api/IMarkupEllipse.ts +0 -15
  183. package/src/Viewer/Markup/Api/IMarkupImage.ts +0 -15
  184. package/src/Viewer/Markup/Api/IMarkupLine.ts +0 -13
  185. package/src/Viewer/Markup/Api/IMarkupObject.ts +0 -15
  186. package/src/Viewer/Markup/Api/IMarkupRectangle.ts +0 -15
  187. package/src/Viewer/Markup/Api/IMarkupText.ts +0 -12
  188. package/src/Viewer/Markup/Api/Impl/Konva/KonvaArrow.ts +0 -117
  189. package/src/Viewer/Markup/Api/Impl/Konva/KonvaCloud.ts +0 -208
  190. package/src/Viewer/Markup/Api/Impl/Konva/KonvaEllipse.ts +0 -118
  191. package/src/Viewer/Markup/Api/Impl/Konva/KonvaImage.ts +0 -123
  192. package/src/Viewer/Markup/Api/Impl/Konva/KonvaLine.ts +0 -131
  193. package/src/Viewer/Markup/Api/Impl/Konva/KonvaRectangle.ts +0 -119
  194. package/src/Viewer/Markup/Api/Impl/Konva/KonvaText.ts +0 -110
  195. package/src/Viewer/Markup/IMarkup.ts +0 -41
  196. package/src/Viewer/Markup/IViewpoint.ts +0 -146
  197. package/src/Viewer/Markup/Impl/Konva/KonvaMarkup.ts +0 -1144
  198. package/src/Viewer/Markup/Impl/Konva/MarkupColor.ts +0 -39
  199. package/src/Viewer/Markup/Impl/Visualize/VisualizeMarkup.ts +0 -228
  200. package/src/Viewer/Markup/MarkupFactory.ts +0 -32
  201. package/src/Viewer/Options.ts +0 -527
  202. package/src/Viewer/OptionsEvents.ts +0 -28
  203. package/src/Viewer/Viewer.ts +0 -1180
  204. package/src/Viewer/ViewerCommands.ts +0 -45
  205. package/src/Viewer/ViewerEvents.ts +0 -700
  206. package/src/Viewer/utils.ts +0 -74
@@ -1,102 +0,0 @@
1
- ///////////////////////////////////////////////////////////////////////////////
2
- // Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
3
- // All rights reserved.
4
- //
5
- // This software and its documentation and related materials are owned by
6
- // the Alliance. The software may only be incorporated into application
7
- // programs owned by members of the Alliance, subject to a signed
8
- // Membership Agreement and Supplemental Software License Agreement with the
9
- // Alliance. The structure and organization of this software are the valuable
10
- // trade secrets of the Alliance and its suppliers. The software is also
11
- // protected by copyright law and international treaty provisions. Application
12
- // programs incorporating this software must include the following statement
13
- // with their copyright notices:
14
- //
15
- // This application incorporates Open Design Alliance software pursuant to a
16
- // license agreement with Open Design Alliance.
17
- // Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
18
- // All rights reserved.
19
- //
20
- // By use of this software, its documentation or related materials, you
21
- // acknowledge and accept the above terms.
22
- ///////////////////////////////////////////////////////////////////////////////
23
-
24
- import { Point2d, Point3d } from "../Common/Geometry";
25
- import { ViewParams } from "../Common/OdaGeAction";
26
- import { Viewer } from "../../Viewer";
27
-
28
- export class PanAction {
29
- private _m_module: any;
30
- private _subject: Viewer;
31
- private _m_start: Point3d;
32
- private _deltaScreenPosition: Point2d;
33
- private _beginInteractivity: () => void;
34
- private _endInteractivity: () => void;
35
- private _getViewParams: () => ViewParams;
36
- private _setViewParams: (params: ViewParams) => void;
37
-
38
- constructor(
39
- m_module: any,
40
- subject: Viewer,
41
- beginInteractivity: () => void,
42
- endInteractivity: () => void,
43
- getViewParams: () => ViewParams,
44
- setViewParams: (params: ViewParams) => void
45
- ) {
46
- this._m_module = m_module;
47
- this._subject = subject;
48
- this._beginInteractivity = beginInteractivity;
49
- this._endInteractivity = endInteractivity;
50
- this._getViewParams = getViewParams;
51
- this._setViewParams = setViewParams;
52
- }
53
-
54
- public beginAction(x: number, y: number) {
55
- this._m_start = this.screenToWorld(x, y);
56
- this._deltaScreenPosition = { x, y };
57
- this._beginInteractivity();
58
- }
59
-
60
- public action(x: number, y: number) {
61
- const { Vector3d } = this._m_module;
62
- const params = this._getViewParams();
63
- const pt = this.screenToWorld(x, y);
64
-
65
- const ptSub = this._m_start.sub(pt);
66
- const delta = ptSub.asVector();
67
-
68
- const target = Vector3d.createFromArray(params.target);
69
- const targetWithDelta = target.add(delta);
70
- params.target = targetWithDelta.toArray();
71
-
72
- const position = Vector3d.createFromArray(params.position);
73
- const positionWithDelta = position.add(delta);
74
- params.position = positionWithDelta.toArray();
75
-
76
- this._setViewParams(params);
77
- target.delete();
78
-
79
- targetWithDelta.delete();
80
- position.delete();
81
- positionWithDelta.delete();
82
-
83
- this._subject.activeDragger()?.updatePreview();
84
- this._subject.emitEvent({
85
- type: "pan",
86
- x,
87
- y,
88
- dX: x - this._deltaScreenPosition.x,
89
- dY: y - this._deltaScreenPosition.y,
90
- });
91
-
92
- this._deltaScreenPosition = { x, y };
93
- }
94
-
95
- public endAction() {
96
- this._endInteractivity();
97
- }
98
-
99
- private screenToWorld(x: number, y: number): Point3d {
100
- return this._m_module.Point3d.createFromArray(this._m_module.getViewer().screenToWorld(x, y));
101
- }
102
- }
@@ -1,45 +0,0 @@
1
- ///////////////////////////////////////////////////////////////////////////////
2
- // Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
3
- // All rights reserved.
4
- //
5
- // This software and its documentation and related materials are owned by
6
- // the Alliance. The software may only be incorporated into application
7
- // programs owned by members of the Alliance, subject to a signed
8
- // Membership Agreement and Supplemental Software License Agreement with the
9
- // Alliance. The structure and organization of this software are the valuable
10
- // trade secrets of the Alliance and its suppliers. The software is also
11
- // protected by copyright law and international treaty provisions. Application
12
- // programs incorporating this software must include the following statement
13
- // with their copyright notices:
14
- //
15
- // This application incorporates Open Design Alliance software pursuant to a
16
- // license agreement with Open Design Alliance.
17
- // Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
18
- // All rights reserved.
19
- //
20
- // By use of this software, its documentation or related materials, you
21
- // acknowledge and accept the above terms.
22
- ///////////////////////////////////////////////////////////////////////////////
23
-
24
- import { Viewer } from "../../Viewer";
25
-
26
- export class ZoomAction {
27
- private _m_module: any;
28
- private _subject: Viewer;
29
-
30
- constructor(m_module: any, subject: Viewer) {
31
- this._m_module = m_module;
32
- this._subject = subject;
33
- }
34
-
35
- public action(x: number, y: number, zoomFactor: number) {
36
- const viewer = this._m_module.getViewer();
37
- viewer.zoomAt(zoomFactor, x, y);
38
-
39
- this._subject.activeDragger()?.updatePreview();
40
- this._subject.emitEvent({
41
- type: "zoomat",
42
- data: zoomFactor,
43
- });
44
- }
45
- }
@@ -1,152 +0,0 @@
1
- ///////////////////////////////////////////////////////////////////////////////
2
- // Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
3
- // All rights reserved.
4
- //
5
- // This software and its documentation and related materials are owned by
6
- // the Alliance. The software may only be incorporated into application
7
- // programs owned by members of the Alliance, subject to a signed
8
- // Membership Agreement and Supplemental Software License Agreement with the
9
- // Alliance. The structure and organization of this software are the valuable
10
- // trade secrets of the Alliance and its suppliers. The software is also
11
- // protected by copyright law and international treaty provisions. Application
12
- // programs incorporating this software must include the following statement
13
- // with their copyright notices:
14
- //
15
- // This application incorporates Open Design Alliance software pursuant to a
16
- // license agreement with Open Design Alliance.
17
- // Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
18
- // All rights reserved.
19
- //
20
- // By use of this software, its documentation or related materials, you
21
- // acknowledge and accept the above terms.
22
- ///////////////////////////////////////////////////////////////////////////////
23
- export interface Point2d {
24
- x: number;
25
- y: number;
26
- }
27
-
28
- export type Vector3 = [x: number, y: number, z: number];
29
-
30
- export interface Point3d {
31
- add(point: Point3d);
32
- asVector(): Vector3d;
33
- distanceTo(point: Point3d);
34
- rotateBy(angle: number, vector: Vector3d);
35
- rotateByBasePoint(angle: number, vector: Vector3d, basePoint: Point3d);
36
- scaleBy(factor: number, basePoint: Point3d);
37
- set(x: number, y: number, z: number);
38
- setToProduct(matrix: any, point: Point3d);
39
- setToSum(point: Point3d, vector: Vector3d);
40
- sub(point: Point3d): Point3d;
41
- toArray(): number[];
42
- transformBy(matrix: any);
43
- translate(vector: Vector3d);
44
- get x(): number;
45
- set x(x: number);
46
- get y(): number;
47
- set y(y: number);
48
- get z(): number;
49
- set z(z: number);
50
- }
51
-
52
- export interface Vector3d {
53
- add(vector: Vector3d);
54
- angleTo(vector: Vector3d);
55
- angleToWithRef(vector: Vector3d, ref: Vector3d);
56
- asPoint(): Point3d;
57
- crossProduct(vector: Vector3d);
58
- dotProduct(vector: Vector3d);
59
- isEqualTo(vector: Vector3d): boolean;
60
- length(): number;
61
- lengthSqrd(): number;
62
- mirror();
63
- negate();
64
- normal();
65
- normalize();
66
- rotateBy(angle: number, vector: Vector3d);
67
- set(x: number, y: number, z: number);
68
- setLength(length: number);
69
- setToProduct(vector: Vector3d, scale: number);
70
- setToSum(vector1: Vector3d, vector2: Vector3d);
71
- sub(vector: Vector3d);
72
- toArray(): number[];
73
- transformBy(matrix: any);
74
- get x(): number;
75
- set x(x: number);
76
- get y(): number;
77
- set y(y: number);
78
- get z(): number;
79
- set z(z: number);
80
- }
81
-
82
- export interface Matrix3d {
83
- det(): number;
84
- get(row: number, col: number): number;
85
- getCoordSystem(origin: Point3d, xAxis: Vector3d, yAxis: Vector3d, zAxis: Vector3d);
86
- getCsOrigin(): Point3d;
87
- getCsXAxis(): Vector3d;
88
- getCsYAxis(): Vector3d;
89
- getCsZAxis(): Vector3d;
90
- invert(): Matrix3d;
91
- isEqualTo();
92
- isPerspective();
93
- isScaledOrtho();
94
- isSingular();
95
- isUniScaledOrtho();
96
- norm(): number;
97
- postMultBy(rightSide: Matrix3d): Matrix3d;
98
- preMultBy(leftSide: Matrix3d): Matrix3d;
99
- scale();
100
- set(row: number, col: number, value: number);
101
- setCoordSystem(origin: Point3d, xAxis: Vector3d, yAxis: Vector3d, zAxis: Vector3d): Matrix3d;
102
- setToAlignCoordSys(
103
- fromOrigin: Point3d,
104
- fromXAxis: Vector3d,
105
- fromYAxis: Vector3d,
106
- fromZAxis: Vector3d,
107
- toOrigin: Point3d,
108
- toXAxis: Vector3d,
109
- toYAxis: Vector3d,
110
- toZAxis: Vector3d
111
- );
112
- setToIdentity(): Matrix3d;
113
- setToProduct(matrix1: Matrix3d, matrix2): Matrix3d;
114
- setToProjection(projectionPlane: OdTvPlane, projectDir: Vector3d): Matrix3d;
115
- setToRotation(angle: number, axis: Vector3, center: Point3d): Matrix3d;
116
- setToScaling(arg0: any, arg1: any);
117
- setToWorldToPlane(geVector3d: number[]);
118
- setTranslation(vect: Vector3d);
119
- transpose(): Matrix3d;
120
- transposeIt(): Matrix3d;
121
- validateZero(): void;
122
- }
123
-
124
- export interface OdTvPlane {
125
- getOrigin();
126
- getUAxis();
127
- getVAxis();
128
- normal();
129
- set(point: number[], normal: OdTvVector);
130
- set3ptr(uPnt: OdTvVector, origin: OdTvVector, vPnt: OdTvVector);
131
- set4double(a: number, b: number, c: number, d: number);
132
- setUV(origin: OdTvPoint, uAxis: OdTvPoint, vAxis: OdTvPoint);
133
- }
134
-
135
- export interface OdTvPoint {
136
- setParam(controlPoints: any[]);
137
- getParam(): any[];
138
- getPointsCount(): number;
139
- editPointsViaRange(startPos: number, points: any[]);
140
- editPointsViaList(indPoints: any[], points: any[]);
141
- setPointSize(value: number);
142
- getPointSize(): number;
143
- setPointColorsViaList(indPoints: any[], colors: any[]);
144
- setPointColorsViaRange(indStart: number, nCount: number, colors: any[]);
145
- getPointColor(ind: number): any;
146
- setPointNormalsViaList(indPoints: any[], vectors: any[]);
147
- setPointNormalsViaRange(indStart: number, vectors: any[]);
148
- getPointNormal(ind: number);
149
- }
150
-
151
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
152
- export interface OdTvVector {}
@@ -1,263 +0,0 @@
1
- ///////////////////////////////////////////////////////////////////////////////
2
- // Copyright (C) 2002-2021, Open Design Alliance (the "Alliance").
3
- // All rights reserved.
4
- //
5
- // This software and its documentation and related materials are owned by
6
- // the Alliance. The software may only be incorporated into application
7
- // programs owned by members of the Alliance, subject to a signed
8
- // Membership Agreement and Supplemental Software License Agreement with the
9
- // Alliance. The structure and organization of this software are the valuable
10
- // trade secrets of the Alliance and its suppliers. The software is also
11
- // protected by copyright law and international treaty provisions. Application
12
- // programs incorporating this software must include the following statement
13
- // with their copyright notices:
14
- //
15
- // This application incorporates Open Design Alliance software pursuant to a
16
- // license agreement with Open Design Alliance.
17
- // Open Design Alliance Copyright (C) 2002-2021 by Open Design Alliance.
18
- // All rights reserved.
19
- //
20
- // By use of this software, its documentation or related materials, you
21
- // acknowledge and accept the above terms.
22
- ///////////////////////////////////////////////////////////////////////////////
23
-
24
- import { Viewer } from "../../Viewer";
25
- import { OrbitAction } from "../Actions/OrbitAction";
26
- import { PanAction } from "../Actions/PanAction";
27
- import { ZoomAction } from "../Actions/ZoomAction";
28
- import { Point2d } from "./Geometry";
29
- import { OdBaseDragger } from "./OdBaseDragger";
30
-
31
- export enum GestureAction {
32
- None,
33
- Orbit,
34
- Pan,
35
- Zoom,
36
- }
37
-
38
- export class GestureManager extends OdBaseDragger {
39
- private _previousEvents = new Map<number, PointerEvent>();
40
- private _currentEvents = new Map<number, PointerEvent>();
41
- private _lastGestureAction = GestureAction.None;
42
- private _orbitAction: OrbitAction;
43
- private _panAction: PanAction;
44
- private _zoomAction: ZoomAction;
45
-
46
- private _initialDistance: number;
47
- private readonly _maxInitialDistanceDifference = 30 * window.devicePixelRatio;
48
-
49
- private _isSingleTouchEnabled = false;
50
-
51
- public get isSingleTouchEnabled(): boolean {
52
- return this._isSingleTouchEnabled;
53
- }
54
-
55
- public set isSingleTouchEnabled(value: boolean) {
56
- this._isSingleTouchEnabled = value;
57
- }
58
-
59
- public constructor(subject: Viewer) {
60
- super(subject);
61
-
62
- this._orbitAction = new OrbitAction(this.m_module, this.subject, this.beginInteractivity, this.endInteractivity);
63
- this._panAction = new PanAction(
64
- this.m_module,
65
- this.subject,
66
- this.beginInteractivity,
67
- this.endInteractivity,
68
- this.getViewParams,
69
- this.setViewParams
70
- );
71
- this._zoomAction = new ZoomAction(this.m_module, this.subject);
72
- }
73
-
74
- private getMiddlePoint(events: Map<number, PointerEvent>): Point2d {
75
- if (events.size !== 2) {
76
- return undefined;
77
- }
78
-
79
- const keys = this.getKeys(events);
80
- const point0 = this.relativeCoords(events.get(keys[0]));
81
- const point1 = this.relativeCoords(events.get(keys[1]));
82
-
83
- return {
84
- x: Math.floor((point0.x + point1.x) / 2),
85
- y: Math.floor((point0.y + point1.y) / 2),
86
- };
87
- }
88
-
89
- private getFirstPoint(events: Map<number, PointerEvent>): Point2d {
90
- if (events.size < 1) {
91
- return undefined;
92
- }
93
-
94
- const keys = this.getKeys(events);
95
- return this.relativeCoords(events.get(keys[0]));
96
- }
97
-
98
- private getDistance(events: Map<number, PointerEvent>): number {
99
- if (events.size !== 2) {
100
- return -1;
101
- }
102
-
103
- const keys = this.getKeys(events);
104
- const point0 = this.relativeCoords(events.get(keys[0]));
105
- const point1 = this.relativeCoords(events.get(keys[1]));
106
-
107
- return Math.hypot(point0.x - point1.x, point0.y - point1.y);
108
- }
109
-
110
- private updateEvent(event: PointerEvent) {
111
- const eventNotInCurrentEvents = !this._currentEvents.get(event.pointerId);
112
- if (eventNotInCurrentEvents && this._currentEvents.size === 2) {
113
- return;
114
- }
115
-
116
- const previousEvent = this._currentEvents.get(event.pointerId);
117
- if (previousEvent) {
118
- this._previousEvents.set(previousEvent.pointerId, previousEvent);
119
- }
120
-
121
- this._currentEvents.set(event.pointerId, event);
122
-
123
- if (eventNotInCurrentEvents) {
124
- this._initialDistance = this.getDistance(this._currentEvents);
125
- }
126
- }
127
-
128
- private removeEvent(event: PointerEvent) {
129
- this._currentEvents.delete(event.pointerId);
130
- this._previousEvents.delete(event.pointerId);
131
-
132
- if (this._currentEvents.size < 2) {
133
- this._initialDistance = -1;
134
- }
135
- }
136
-
137
- private getKeys(map: Map<number, PointerEvent>): number[] {
138
- return Array.from(map.keys());
139
- }
140
-
141
- private analyzeGesture() {
142
- if (this._currentEvents.size === 2) {
143
- const currentDistance = this.getDistance(this._currentEvents);
144
- const previousDistance = this.getDistance(this._previousEvents);
145
-
146
- const currentDistanceEqualsInitialDistance =
147
- Math.abs(this._initialDistance - currentDistance) <= this._maxInitialDistanceDifference;
148
- if (currentDistanceEqualsInitialDistance) {
149
- this.executePanAction(this.getMiddlePoint(this._currentEvents));
150
- } else {
151
- if (previousDistance !== -1 && currentDistance !== previousDistance) {
152
- this.executeZoomAction(currentDistance, previousDistance);
153
- }
154
- }
155
- } else if (this._currentEvents.size === 1 && this.isSingleTouchEnabled) {
156
- this.executeOrbitAction(this.getFirstPoint(this._currentEvents));
157
- }
158
- }
159
-
160
- private executeZoomAction(currentDistance: number, previousDistance: number) {
161
- if (this._lastGestureAction !== GestureAction.Zoom) {
162
- this.executeEndAction(this._lastGestureAction);
163
- this._lastGestureAction = GestureAction.Zoom;
164
- OdBaseDragger.isGestureActive = true;
165
- }
166
-
167
- const zoomSpeed = (currentDistance - previousDistance) / 700;
168
- const zoomFactor = 1 + zoomSpeed;
169
- const middlePoint = this.getMiddlePoint(this._currentEvents);
170
- this._zoomAction.action(middlePoint.x, middlePoint.y, zoomFactor);
171
- this.subject.update();
172
- }
173
-
174
- private executePanAction(currentPoint: Point2d) {
175
- if (this._lastGestureAction !== GestureAction.Pan) {
176
- this.executeEndAction(this._lastGestureAction);
177
- this._lastGestureAction = GestureAction.Pan;
178
- OdBaseDragger.isGestureActive = true;
179
-
180
- this._panAction.beginAction(currentPoint.x, currentPoint.y);
181
- }
182
-
183
- this._panAction.action(currentPoint.x, currentPoint.y);
184
- this.subject.update();
185
- }
186
-
187
- private executeOrbitAction(currentPoint: Point2d) {
188
- if (this._lastGestureAction !== GestureAction.Orbit) {
189
- this.executeEndAction(this._lastGestureAction);
190
- this._lastGestureAction = GestureAction.Orbit;
191
- OdBaseDragger.isGestureActive = true;
192
-
193
- this._orbitAction.beginAction(currentPoint.x, currentPoint.y);
194
- }
195
-
196
- this._orbitAction.action(currentPoint.x, currentPoint.y);
197
- this.subject.update();
198
- }
199
-
200
- private executeEndAction(gestureAction: GestureAction) {
201
- if (gestureAction === GestureAction.Orbit) this._orbitAction.endAction();
202
- if (gestureAction === GestureAction.Pan) this._panAction.endAction();
203
- OdBaseDragger.isGestureActive = false;
204
- }
205
-
206
- private needIgnoreEvent(event: PointerEvent): boolean {
207
- return (
208
- !this.subject.options.enableZoomWheel || !this.subject.options.enableGestures || !this.eventIsTouchEvent(event)
209
- );
210
- }
211
-
212
- private eventIsTouchEvent(event: PointerEvent): boolean {
213
- return event.pointerType === "touch" || event.pointerType === "";
214
- }
215
-
216
- override pointerdown(event: PointerEvent) {
217
- if (this.needIgnoreEvent(event)) {
218
- return;
219
- }
220
-
221
- this.updateEvent(event);
222
- }
223
-
224
- override pointermove(event: PointerEvent) {
225
- if (this.needIgnoreEvent(event)) {
226
- return;
227
- }
228
-
229
- this.updateEvent(event);
230
- this.analyzeGesture();
231
- }
232
-
233
- override pointerup(event: PointerEvent) {
234
- if (this.needIgnoreEvent(event)) {
235
- return;
236
- }
237
-
238
- this.removeEvent(event);
239
-
240
- if (this._currentEvents.size < 2) {
241
- this.executeEndAction(this._lastGestureAction);
242
- OdBaseDragger.isGestureActive = false;
243
- }
244
-
245
- this._lastGestureAction = GestureAction.None;
246
- }
247
-
248
- override pointercancel(event: PointerEvent) {
249
- if (this.needIgnoreEvent(event)) {
250
- return;
251
- }
252
-
253
- this.pointerup(event);
254
- }
255
-
256
- pointerleave(event: PointerEvent) {
257
- if (this.needIgnoreEvent(event)) {
258
- return;
259
- }
260
-
261
- this.pointerup(event);
262
- }
263
- }