@vertexvis/doc-viewer 1.0.0-canary.7 → 1.0.0-canary.8

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.
@@ -674,8 +674,9 @@ function getAllChildren(element) {
674
674
 
675
675
  const DRAG_PIXEL_THRESHOLD = 2;
676
676
  class PanInteractionHandler {
677
- constructor(element, api) {
677
+ constructor(element, hostElement, api) {
678
678
  this.element = element;
679
+ this.hostElement = hostElement;
679
680
  this.api = api;
680
681
  this.isDragging = false;
681
682
  this.handlePointerDown = this.handlePointerDown.bind(this);
@@ -684,11 +685,12 @@ class PanInteractionHandler {
684
685
  this.handleWheel = this.handleWheel.bind(this);
685
686
  this.element.addEventListener('pointerdown', this.handlePointerDown);
686
687
  this.element.addEventListener('wheel', this.handleWheel);
687
- window.addEventListener('wheel', this.handleWheel);
688
+ this.hostElement.addEventListener('wheel', this.handleWheel);
688
689
  }
689
690
  dispose() {
690
691
  this.element.removeEventListener('pointerdown', this.handlePointerDown);
691
692
  this.element.removeEventListener('wheel', this.handleWheel);
693
+ this.hostElement.removeEventListener('wheel', this.handleWheel);
692
694
  this.removeWindowListeners();
693
695
  }
694
696
  handleWheel(event) {
@@ -732,7 +734,6 @@ class PanInteractionHandler {
732
734
  removeWindowListeners() {
733
735
  window.removeEventListener('pointermove', this.handlePointerMove);
734
736
  window.removeEventListener('pointerup', this.handlePointerUp);
735
- window.removeEventListener('wheel', this.handleWheel);
736
737
  }
737
738
  }
738
739
 
@@ -34792,7 +34793,7 @@ const VertexDocumentViewer = class {
34792
34793
  var _a;
34793
34794
  (_a = this.panInteractionHandler) === null || _a === void 0 ? void 0 : _a.dispose();
34794
34795
  if (this.interactionMode === 'pan' && this.canvasEl != null && this.documentApi != null) {
34795
- this.panInteractionHandler = new PanInteractionHandler(this.canvasEl, this.documentApi);
34796
+ this.panInteractionHandler = new PanInteractionHandler(this.canvasEl, this.hostEl, this.documentApi);
34796
34797
  }
34797
34798
  }
34798
34799
  updateComponentDimensions(dimensions) {
@@ -175,7 +175,7 @@ export class VertexDocumentViewer {
175
175
  var _a;
176
176
  (_a = this.panInteractionHandler) === null || _a === void 0 ? void 0 : _a.dispose();
177
177
  if (this.interactionMode === 'pan' && this.canvasEl != null && this.documentApi != null) {
178
- this.panInteractionHandler = new PanInteractionHandler(this.canvasEl, this.documentApi);
178
+ this.panInteractionHandler = new PanInteractionHandler(this.canvasEl, this.hostEl, this.documentApi);
179
179
  }
180
180
  }
181
181
  updateComponentDimensions(dimensions) {
@@ -4,8 +4,9 @@
4
4
  import { Point } from "@vertexvis/geometry";
5
5
  const DRAG_PIXEL_THRESHOLD = 2;
6
6
  export class PanInteractionHandler {
7
- constructor(element, api) {
7
+ constructor(element, hostElement, api) {
8
8
  this.element = element;
9
+ this.hostElement = hostElement;
9
10
  this.api = api;
10
11
  this.isDragging = false;
11
12
  this.handlePointerDown = this.handlePointerDown.bind(this);
@@ -14,11 +15,12 @@ export class PanInteractionHandler {
14
15
  this.handleWheel = this.handleWheel.bind(this);
15
16
  this.element.addEventListener('pointerdown', this.handlePointerDown);
16
17
  this.element.addEventListener('wheel', this.handleWheel);
17
- window.addEventListener('wheel', this.handleWheel);
18
+ this.hostElement.addEventListener('wheel', this.handleWheel);
18
19
  }
19
20
  dispose() {
20
21
  this.element.removeEventListener('pointerdown', this.handlePointerDown);
21
22
  this.element.removeEventListener('wheel', this.handleWheel);
23
+ this.hostElement.removeEventListener('wheel', this.handleWheel);
22
24
  this.removeWindowListeners();
23
25
  }
24
26
  handleWheel(event) {
@@ -62,6 +64,5 @@ export class PanInteractionHandler {
62
64
  removeWindowListeners() {
63
65
  window.removeEventListener('pointermove', this.handlePointerMove);
64
66
  window.removeEventListener('pointerup', this.handlePointerUp);
65
- window.removeEventListener('wheel', this.handleWheel);
66
67
  }
67
68
  }