diff --git a/engine/package.json b/engine/package.json index 13b28bff..034c911e 100644 --- a/engine/package.json +++ b/engine/package.json @@ -1,6 +1,6 @@ { "name": "goban-engine", - "version": "8.3.23", + "version": "8.3.24", "description": "", "main": "build/goban-engine.js", "types": "build/engine/index.d.ts", diff --git a/package.json b/package.json index b931d518..6ee586ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "goban", - "version": "8.3.23", + "version": "8.3.24", "description": "", "main": "build/goban.js", "types": "build/src/index.d.ts", diff --git a/src/Goban/CanvasRenderer.ts b/src/Goban/CanvasRenderer.ts index 6d96651a..15b2271d 100644 --- a/src/Goban/CanvasRenderer.ts +++ b/src/Goban/CanvasRenderer.ts @@ -801,7 +801,7 @@ export class GobanCanvas extends Goban implements GobanCanvasInterface { /* nor when in labeling mode */ this.analyze_tool !== "label" ) { - const m = this.engine.getMoveByLocation(x, y); + const m = this.engine.getMoveByLocation(x, y, true); if (m) { this.engine.jumpTo(m); this.emit("update"); @@ -1940,7 +1940,7 @@ export class GobanCanvas extends Goban implements GobanCanvasInterface { pos.square ) ) { - const m = this.engine.getMoveByLocation(i, j); + const m = this.engine.getMoveByLocation(i, j, false); if (m && !m.trunk) { if (m.edited) { //letter = "triangle"; @@ -2602,7 +2602,7 @@ export class GobanCanvas extends Goban implements GobanCanvasInterface { !letter && !(pos.circle || pos.triangle || pos.chat_triangle || pos.cross || pos.square) ) { - const m = this.engine.getMoveByLocation(i, j); + const m = this.engine.getMoveByLocation(i, j, false); if (m && !m.trunk) { if (m.edited) { //letter = "triangle"; diff --git a/src/Goban/InteractiveBase.ts b/src/Goban/InteractiveBase.ts index 73cf08c2..ef64ff47 100644 --- a/src/Goban/InteractiveBase.ts +++ b/src/Goban/InteractiveBase.ts @@ -485,10 +485,6 @@ export abstract class GobanInteractive extends GobanBase { } */ protected getShowVariationMoveNumbers(): boolean { - if (this.mode === "puzzle") { - return false; - } - if (callbacks.getShowVariationMoveNumbers) { return callbacks.getShowVariationMoveNumbers(); } diff --git a/src/Goban/SVGRenderer.ts b/src/Goban/SVGRenderer.ts index 22cd1cfc..2453c0f6 100644 --- a/src/Goban/SVGRenderer.ts +++ b/src/Goban/SVGRenderer.ts @@ -773,7 +773,7 @@ export class SVGRenderer extends Goban implements GobanSVGInterface { /* nor when in labeling mode */ this.analyze_tool !== "label" ) { - const m = this.engine.getMoveByLocation(x, y); + const m = this.engine.getMoveByLocation(x, y, true); if (m) { this.engine.jumpTo(m); this.emit("update"); @@ -1933,7 +1933,7 @@ export class SVGRenderer extends Goban implements GobanSVGInterface { pos.square ) ) { - const m = this.engine.getMoveByLocation(i, j); + const m = this.engine.getMoveByLocation(i, j, false); if (m && !m.trunk) { if (m.edited) { //letter = "triangle"; @@ -2628,7 +2628,7 @@ export class SVGRenderer extends Goban implements GobanSVGInterface { !letter && !(pos.circle || pos.triangle || pos.chat_triangle || pos.cross || pos.square) ) { - const m = this.engine.getMoveByLocation(i, j); + const m = this.engine.getMoveByLocation(i, j, false); if (m && !m.trunk) { if (m.edited) { //letter = "triangle"; diff --git a/src/engine/GobanEngine.ts b/src/engine/GobanEngine.ts index 6a932094..af53a488 100644 --- a/src/engine/GobanEngine.ts +++ b/src/engine/GobanEngine.ts @@ -2479,14 +2479,23 @@ export class GobanEngine extends BoardState { ); return se.score(); } - public getMoveByLocation(x: number, y: number): MoveTree | null { + /* Returns the move by location if it exists within our current branch. If + * include_forward_search is true, we also search forward in the tree along + * the last selected branch. */ + public getMoveByLocation( + x: number, + y: number, + include_forward_search: boolean, + ): MoveTree | null { let m: MoveTree | null = null; let cur_move: MoveTree | null = this.cur_move; - while (!m && cur_move) { - if (cur_move.x === x && cur_move.y === y) { - m = cur_move; + if (include_forward_search) { + while (!m && cur_move) { + if (cur_move.x === x && cur_move.y === y) { + m = cur_move; + } + cur_move = cur_move.next(); } - cur_move = cur_move.next(); } cur_move = this.cur_move.parent; while (!m && cur_move) {