We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 51e719e commit aab083aCopy full SHA for aab083a
src/widget.ts
@@ -400,8 +400,9 @@ class CanvasView extends DOMWidgetView {
400
401
protected getCoordinates(event: MouseEvent | Touch) {
402
const rect = this.el.getBoundingClientRect();
403
- const x = event.clientX - rect.left;
404
- const y = event.clientY - rect.top;
+
+ const x = this.el.width * (event.clientX - rect.left) / rect.width;
405
+ const y = this.el.height * (event.clientY - rect.top) / rect.height;
406
407
return { x, y };
408
}
0 commit comments