@fieldnotes/core 0.1.0 → 0.1.1

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.cjs CHANGED
@@ -331,9 +331,13 @@ var InputHandler = class {
331
331
  }
332
332
  onWheel = (e) => {
333
333
  e.preventDefault();
334
+ const rect = this.element.getBoundingClientRect();
334
335
  const zoomFactor = 1 - e.deltaY * ZOOM_SENSITIVITY;
335
336
  const newZoom = this.camera.zoom * zoomFactor;
336
- this.camera.zoomAt(newZoom, { x: e.clientX, y: e.clientY });
337
+ this.camera.zoomAt(newZoom, {
338
+ x: e.clientX - rect.left,
339
+ y: e.clientY - rect.top
340
+ });
337
341
  };
338
342
  isInteractiveHtmlContent(e) {
339
343
  const target = e.target;
@@ -460,7 +464,12 @@ var InputHandler = class {
460
464
  return { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 };
461
465
  }
462
466
  toPointerState(e) {
463
- return { x: e.clientX, y: e.clientY, pressure: e.pressure };
467
+ const rect = this.element.getBoundingClientRect();
468
+ return {
469
+ x: e.clientX - rect.left,
470
+ y: e.clientY - rect.top,
471
+ pressure: e.pressure
472
+ };
464
473
  }
465
474
  dispatchToolDown(e) {
466
475
  if (!this.toolManager || !this.toolContext) return;