@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.js CHANGED
@@ -269,9 +269,13 @@ var InputHandler = class {
269
269
  }
270
270
  onWheel = (e) => {
271
271
  e.preventDefault();
272
+ const rect = this.element.getBoundingClientRect();
272
273
  const zoomFactor = 1 - e.deltaY * ZOOM_SENSITIVITY;
273
274
  const newZoom = this.camera.zoom * zoomFactor;
274
- this.camera.zoomAt(newZoom, { x: e.clientX, y: e.clientY });
275
+ this.camera.zoomAt(newZoom, {
276
+ x: e.clientX - rect.left,
277
+ y: e.clientY - rect.top
278
+ });
275
279
  };
276
280
  isInteractiveHtmlContent(e) {
277
281
  const target = e.target;
@@ -398,7 +402,12 @@ var InputHandler = class {
398
402
  return { x: (a.x + b.x) / 2, y: (a.y + b.y) / 2 };
399
403
  }
400
404
  toPointerState(e) {
401
- return { x: e.clientX, y: e.clientY, pressure: e.pressure };
405
+ const rect = this.element.getBoundingClientRect();
406
+ return {
407
+ x: e.clientX - rect.left,
408
+ y: e.clientY - rect.top,
409
+ pressure: e.pressure
410
+ };
402
411
  }
403
412
  dispatchToolDown(e) {
404
413
  if (!this.toolManager || !this.toolContext) return;