diff --git a/engine/package.json b/engine/package.json index 5a7caf26..2959d454 100644 --- a/engine/package.json +++ b/engine/package.json @@ -1,6 +1,6 @@ { "name": "goban-engine", - "version": "8.3.20", + "version": "8.3.21", "description": "", "main": "build/goban-engine.js", "types": "build/engine/index.d.ts", diff --git a/package.json b/package.json index f07a8ec2..06998c19 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "goban", - "version": "8.3.20", + "version": "8.3.21", "description": "", "main": "build/goban.js", "types": "build/src/index.d.ts", diff --git a/src/Goban/CanvasRenderer.ts b/src/Goban/CanvasRenderer.ts index e2d41625..6d96651a 100644 --- a/src/Goban/CanvasRenderer.ts +++ b/src/Goban/CanvasRenderer.ts @@ -1275,7 +1275,7 @@ export class GobanCanvas extends Goban implements GobanCanvasInterface { if (cur.x === i && cur.y === j) { const move_diff = cur.getMoveNumberDifferenceFromTrunk(); if (move_diff !== cur.move_number) { - if (!cur.edited && this.show_move_numbers) { + if (!cur.edited && this.show_variation_move_numbers) { alt_marking = cur.getMoveNumberDifferenceFromTrunk().toString(); } } @@ -2184,7 +2184,7 @@ export class GobanCanvas extends Goban implements GobanCanvasInterface { } else { if ( this.engine.undo_requested && - this.visual_undo_request_indicator && + this.getShowUndoRequestIndicator() && this.engine.undo_requested === this.engine.cur_move.move_number ) { const letter = "?"; @@ -2307,7 +2307,7 @@ export class GobanCanvas extends Goban implements GobanCanvasInterface { if (cur.x === i && cur.y === j) { const move_diff = cur.getMoveNumberDifferenceFromTrunk(); if (move_diff !== cur.move_number) { - if (!cur.edited && this.show_move_numbers) { + if (!cur.edited && this.show_variation_move_numbers) { alt_marking = cur.getMoveNumberDifferenceFromTrunk().toString(); } } @@ -2664,6 +2664,13 @@ export class GobanCanvas extends Goban implements GobanCanvasInterface { (this.engine.phase === "play" || this.engine.phase === "finished") ) { ret += "last_move,"; + if ( + this.engine.undo_requested && + this.getShowUndoRequestIndicator() && + this.engine.undo_requested === this.engine.cur_move.move_number + ) { + ret += "?" + ","; + } } } diff --git a/src/Goban/InteractiveBase.ts b/src/Goban/InteractiveBase.ts index 5427efd5..ef64ff47 100644 --- a/src/Goban/InteractiveBase.ts +++ b/src/Goban/InteractiveBase.ts @@ -93,7 +93,6 @@ export abstract class GobanInteractive extends GobanBase { public draw_left_labels: boolean; public draw_right_labels: boolean; public draw_top_labels: boolean; - public visual_undo_request_indicator: boolean; public height: number; public last_clock?: AdHocClock; public last_emitted_clock?: JGOFClockWithTransmitting; @@ -273,7 +272,7 @@ export abstract class GobanInteractive extends GobanBase { protected review_had_gamedata: boolean; protected scoring_mode: boolean | "stalling-scoring-mode"; protected shift_key_is_down: boolean; - protected show_move_numbers: boolean; + //protected show_move_numbers: boolean; protected show_variation_move_numbers: boolean; protected square_size: number = 10; protected stone_placement_enabled: boolean; @@ -337,10 +336,6 @@ export abstract class GobanInteractive extends GobanBase { typeof config.variation_stone_opacity !== "undefined" ? config.variation_stone_opacity : 0.6; - this.visual_undo_request_indicator = - "visual_undo_request_indicator" in config - ? !!config.visual_undo_request_indicator - : false; this.original_square_size = config.square_size || "auto"; //this.square_size = config["square_size"] || "auto"; this.interactive = !!config.interactive; @@ -410,7 +405,7 @@ export abstract class GobanInteractive extends GobanBase { this.draw_right_labels = "draw_right_labels" in config ? !!config.draw_right_labels : true; this.draw_bottom_labels = "draw_bottom_labels" in config ? !!config.draw_bottom_labels : true; - this.show_move_numbers = this.getShowMoveNumbers(); + //this.show_move_numbers = this.getShowMoveNumbers(); this.show_variation_move_numbers = this.getShowVariationMoveNumbers(); if (this.bounds.left > 0) { @@ -475,12 +470,20 @@ export abstract class GobanInteractive extends GobanBase { } return "A1"; } + protected getShowUndoRequestIndicator(): boolean { + if (callbacks.getShowUndoRequestIndicator) { + return callbacks.getShowUndoRequestIndicator(); + } + return true; + } + /* protected getShowMoveNumbers(): boolean { if (callbacks.getShowMoveNumbers) { return callbacks.getShowMoveNumbers(); } return false; } + */ protected getShowVariationMoveNumbers(): boolean { if (callbacks.getShowVariationMoveNumbers) { return callbacks.getShowVariationMoveNumbers(); diff --git a/src/Goban/OGSConnectivity.ts b/src/Goban/OGSConnectivity.ts index db05677f..be11bba7 100644 --- a/src/Goban/OGSConnectivity.ts +++ b/src/Goban/OGSConnectivity.ts @@ -390,7 +390,7 @@ export abstract class OGSConnectivity extends GobanInteractive { this.engine.undo_requested = parseInt(move_number); this.emit("update"); this.emit("audio-undo-requested"); - if (this.visual_undo_request_indicator) { + if (this.getShowUndoRequestIndicator()) { this.redraw(true); // need to update the mark on the last move } }, @@ -403,7 +403,7 @@ export abstract class OGSConnectivity extends GobanInteractive { this.engine.undo_requested = undefined; // can't call delete here because this is a getter/setter this.emit("update"); this.emit("undo_canceled"); - if (this.visual_undo_request_indicator) { + if (this.getShowUndoRequestIndicator()) { this.redraw(true); } }); diff --git a/src/Goban/SVGRenderer.ts b/src/Goban/SVGRenderer.ts index 61e88409..22cd1cfc 100644 --- a/src/Goban/SVGRenderer.ts +++ b/src/Goban/SVGRenderer.ts @@ -1069,8 +1069,10 @@ export class SVGRenderer extends Goban implements GobanSVGInterface { if (this.mode === "analyze" && this.analyze_tool === "stone") { let c: MoveTree | null = this.engine.cur_move; + while (c && !c.trunk) { let mark: any = c.getMoveNumberDifferenceFromTrunk(); + if (c.edited) { mark = "triangle"; } @@ -1261,14 +1263,16 @@ export class SVGRenderer extends Goban implements GobanSVGInterface { this.engine && this.engine.cur_move && (this.mode !== "play" || - (typeof this.isInPushedAnalysis() !== "undefined" && this.isInPushedAnalysis())) + (typeof this.isInPushedAnalysis() !== "undefined" && + this.isInPushedAnalysis() && + this.show_variation_move_numbers)) ) { let cur: MoveTree | null = this.engine.cur_move; for (; cur && !cur.trunk; cur = cur.parent) { if (cur.x === i && cur.y === j) { const move_diff = cur.getMoveNumberDifferenceFromTrunk(); if (move_diff !== cur.move_number) { - if (!cur.edited && this.show_move_numbers) { + if (!cur.edited && this.show_variation_move_numbers) { alt_marking = cur.getMoveNumberDifferenceFromTrunk().toString(); } } @@ -2176,7 +2180,7 @@ export class SVGRenderer extends Goban implements GobanSVGInterface { } else { if ( this.engine.undo_requested && - this.visual_undo_request_indicator && + this.getShowUndoRequestIndicator() && this.engine.undo_requested === this.engine.cur_move.move_number ) { const letter = "?"; @@ -2318,7 +2322,7 @@ export class SVGRenderer extends Goban implements GobanSVGInterface { if (cur.x === i && cur.y === j) { const move_diff = cur.getMoveNumberDifferenceFromTrunk(); if (move_diff !== cur.move_number) { - if (!cur.edited && this.show_move_numbers) { + if (!cur.edited && this.show_variation_move_numbers) { alt_marking = cur.getMoveNumberDifferenceFromTrunk().toString(); } } @@ -2686,6 +2690,13 @@ export class SVGRenderer extends Goban implements GobanSVGInterface { (this.engine.phase === "play" || this.engine.phase === "finished") ) { ret += "last_move,"; + if ( + this.engine.undo_requested && + this.getShowUndoRequestIndicator() && + this.engine.undo_requested === this.engine.cur_move.move_number + ) { + ret += "?" + ","; + } } } diff --git a/src/Goban/callbacks.ts b/src/Goban/callbacks.ts index d4cf714a..b570d264 100644 --- a/src/Goban/callbacks.ts +++ b/src/Goban/callbacks.ts @@ -25,8 +25,9 @@ export interface GobanCallbacks { getClockDrift?: () => number; getNetworkLatency?: () => number; getLocation?: () => string; - getShowMoveNumbers?: () => boolean; + // getShowMoveNumbers?: () => boolean; getShowVariationMoveNumbers?: () => boolean; + getShowUndoRequestIndicator?: () => boolean; getMoveTreeNumbering?: () => "move-coordinates" | "none" | "move-number"; getCDNReleaseBase?: () => string; getSoundEnabled?: () => boolean;