@vertexvis/utils 1.0.0-canary.5 → 1.0.0-canary.7

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.
package/dist/index.d.ts CHANGED
@@ -14,6 +14,8 @@ import * as Uri from './uri';
14
14
  import * as UUID from './uuid';
15
15
  export * from './disposable';
16
16
  export * from './eventDispatcher';
17
+ export * from './interactions/basicInteractionHandler';
17
18
  export * from './mappedTypes';
18
19
  export * from './predicate';
20
+ export * from './viewer/basicViewer';
19
21
  export { Async, BinaryReader, Color, EventTargets, Mapper, Objects, Range, Sets, Strings, Uri, UUID, };
@@ -0,0 +1,42 @@
1
+ import { Disposable } from '../disposable';
2
+ /**
3
+ * An `BasicInteractionHandler` provides a mechanism for customizing the mouse and
4
+ * touch handling in the viewer.
5
+ *
6
+ * When an interaction handler is registered with the viewer, it'll call the
7
+ * `initialize()` method and pass it the internal canvas element that can be
8
+ * used to modify the internal interaction state.
9
+ *
10
+ * @example
11
+ * ```
12
+ * class CustomInteractionHandler extends BasicInteractionHandler {
13
+ * private element: HTMLElement;
14
+ *
15
+ * public dispose(): void {
16
+ * this.element.removeEventListener('click', this.handleElementClick);
17
+ * }
18
+ *
19
+ * public initialize(element: HTMLElement): void {
20
+ * this.element = element;
21
+ * this.element.addEventListener('click', this.handleElementClick);
22
+ * }
23
+ *
24
+ * private handleElementClick = (event: MouseEvent) => {
25
+ * api.pick({ x: event.clientX, y: event.clientY });
26
+ * }
27
+ * }
28
+ *
29
+ * const viewer = document.querySelector("vertex-viewer");
30
+ * viewer.registerInteractionHandler(new CustomInteractionHandler);
31
+ * ```
32
+ */
33
+ export interface BasicInteractionHandler extends Disposable {
34
+ /**
35
+ * Called by the viewer when the interaction handler is registered with the
36
+ * viewer. Used to setup any necessary event listeners to handle user
37
+ * interactions.
38
+ *
39
+ * @param element The internal viewer element to add event listeners to.
40
+ */
41
+ initialize(element: HTMLElement): void;
42
+ }
@@ -0,0 +1,5 @@
1
+ import { Disposable } from '../disposable';
2
+ import { BasicInteractionHandler } from '../interactions/basicInteractionHandler';
3
+ export interface BasicViewer {
4
+ registerBasicInteractionHandler(interactionHandler: BasicInteractionHandler): Promise<Disposable>;
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertexvis/utils",
3
- "version": "1.0.0-canary.5",
3
+ "version": "1.0.0-canary.7",
4
4
  "description": "Utility library for Viewer SDK.",
5
5
  "license": "MIT",
6
6
  "author": "Vertex Developers <support@vertex3d.com> (https://developer.vertex3d.com)",
@@ -52,7 +52,7 @@
52
52
  "@types/jest": "^29.5.14",
53
53
  "@vertexvis/eslint-config-vertexvis-typescript": "^0.5.0",
54
54
  "@vertexvis/jest-config-vertexvis": "^0.5.4",
55
- "@vertexwebsdk/build": "1.0.0-canary.5",
55
+ "@vertexwebsdk/build": "1.0.0-canary.7",
56
56
  "eslint": "^8.57.1",
57
57
  "jest": "^29.5.14",
58
58
  "jest-cli": "^29.5.14",
@@ -64,5 +64,5 @@
64
64
  "peerDependencies": {
65
65
  "tslib": ">=2.4.0"
66
66
  },
67
- "gitHead": "87508dde7c51472f558182a7c7bcd82267898535"
67
+ "gitHead": "bd084f39b93daca5cf74abd1a1dfb0ca1f055f2a"
68
68
  }