Skip to content

Commit

Permalink
Fix issue where a single click in analysis mode would begin leaving a…
Browse files Browse the repository at this point in the history
  • Loading branch information
anoek committed Sep 12, 2024
1 parent 8e81093 commit 4567a55
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion engine/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
11 changes: 10 additions & 1 deletion src/Goban/SVGRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 4567a55

Please sign in to comment.