From 4567a550e27388e7407d1ba67b5ea812576dba41 Mon Sep 17 00:00:00 2001 From: Akita Noek Date: Thu, 12 Sep 2024 12:55:49 -0600 Subject: [PATCH] Fix issue where a single click in analysis mode would begin leaving a trail Fixes https://github.com/online-go/online-go.com/issues/2827 --- engine/package.json | 2 +- package.json | 2 +- src/Goban/SVGRenderer.ts | 11 ++++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/engine/package.json b/engine/package.json index 94d46ab2..b2199cc2 100644 --- a/engine/package.json +++ b/engine/package.json @@ -1,6 +1,6 @@ { "name": "goban-engine", - "version": "8.3.49", + "version": "8.3.50", "description": "", "main": "build/goban-engine.js", "types": "build/engine/index.d.ts", diff --git a/package.json b/package.json index 15fc5dc2..1f3ca5a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "goban", - "version": "8.3.49", + "version": "8.3.50", "description": "", "main": "build/goban.js", "types": "build/src/index.d.ts", diff --git a/src/Goban/SVGRenderer.ts b/src/Goban/SVGRenderer.ts index f1bd7ce5..ecb49deb 100644 --- a/src/Goban/SVGRenderer.ts +++ b/src/Goban/SVGRenderer.ts @@ -360,7 +360,6 @@ export class SVGRenderer extends Goban implements GobanSVGInterface { div.setAttribute("data-pointers-bound", "true"); this.on("destroy", () => { - console.log("Clearing pointer bindings"); div.removeAttribute("data-pointers-bound"); }); @@ -528,6 +527,14 @@ export class SVGRenderer extends Goban implements GobanSVGInterface { pointerDown(ev); } ev.preventDefault(); + + return false; + }; + const onMouseUp = (ev: MouseEvent) => { + if (!mouse_disabled) { + pointerUp(ev, false); + } + ev.preventDefault(); return false; }; const onMouseMove = (ev: MouseEvent) => { @@ -561,6 +568,7 @@ export class SVGRenderer extends Goban implements GobanSVGInterface { div.addEventListener("click", onClick); div.addEventListener("dblclick", onDblClick); div.addEventListener("mousedown", onMouseDown); + div.addEventListener("mouseup", onMouseUp); div.addEventListener("mousemove", onMouseMove); div.addEventListener("mouseout", onMouseOut); div.addEventListener("contextmenu", onContextMenu); @@ -569,6 +577,7 @@ export class SVGRenderer extends Goban implements GobanSVGInterface { div.removeEventListener("click", onClick); div.removeEventListener("dblclick", onDblClick); div.removeEventListener("mousedown", onMouseDown); + div.removeEventListener("mouseup", onMouseUp); div.removeEventListener("mousemove", onMouseMove); div.removeEventListener("mouseout", onMouseOut); div.removeEventListener("contextmenu", onContextMenu);