goban
Version:
[](https://opensource.org/licenses/Apache-2.0)
59 lines (58 loc) • 2.78 kB
TypeScript
import { OGSConnectivity } from "./OGSConnectivity";
import { GobanConfig } from "../GobanBase";
export declare const GOBAN_FONT = "Verdana,Arial,sans-serif";
export interface GobanSelectedThemes {
"board": string;
"white": string;
"black": string;
"removal-graphic": "square" | "x";
"removal-scale": number;
}
export type LabelPosition = "all" | "none" | "top-left" | "top-right" | "bottom-right" | "bottom-left";
export interface GobanMetrics {
width: number;
height: number;
mid: number;
offset: number;
}
/**
* Goban serves as a base class for our renderers as well as a namespace for various
* classes, types, and enums.
*
* You can't create an instance of a Goban directly, you have to create an instance of
* one of the renderers, such as GobanSVG.
*/
export declare abstract class Goban extends OGSConnectivity {
static THEMES: import("./themes").ThemesInterface;
static THEMES_SORTED: {
[key: string]: import("./themes").GobanTheme[];
white: import("./themes").GobanTheme[];
black: import("./themes").GobanTheme[];
board: import("./themes").GobanTheme[];
};
protected abstract setTheme(themes: GobanSelectedThemes, dont_redraw: boolean): void;
parent: HTMLElement;
private analysis_scoring_color?;
private analysis_scoring_last_position;
constructor(config: GobanConfig, preloaded_data?: GobanConfig);
destroy(): void;
protected getSelectedThemes(): GobanSelectedThemes;
protected putOrClearLabel(x: number, y: number, mode?: "put" | "clear"): boolean;
protected getAnalysisScoreColorAtLocation(x: number, y: number): "black" | "white" | string | undefined;
protected putAnalysisScoreColorAtLocation(x: number, y: number, color?: "black" | "white" | string, sync_review_move?: boolean): void;
protected putAnalysisRemovalAtLocation(x: number, y: number, removal?: boolean): void;
/** Marks scores on the board when in analysis mode. Note: this will not
* clear existing scores, this is intentional as I think it's the expected
* behavior of reviewers */
markAnalysisScores(): void;
setSquareSizeBasedOnDisplayWidth(display_width: number, suppress_redraw?: boolean): void;
setLabelPosition(label_position: LabelPosition): void;
protected onAnalysisToggleStoneRemoval(ev: MouseEvent | TouchEvent): void;
/** Clears any analysis scores on the board */
clearAnalysisScores(): void;
setSquareSize(new_ss: number, suppress_redraw?: boolean): void;
setStoneFontScale(new_ss: number, suppress_redraw?: boolean): void;
computeMetrics(): GobanMetrics;
protected onAnalysisScoringStart(ev: MouseEvent | TouchEvent): void;
protected onAnalysisScoringMove(ev: MouseEvent | TouchEvent): void;
}