- let board_width = parseInt(document.querySelector(".board-b72b1").style.width, 10);
- let zoom_factor = board_width / 400.0;
- let line_width = arrow.line_width * zoom_factor;
- let arrow_size = arrow.arrow_size * zoom_factor;
+ // We always draw as if the board is 400x400, the viewBox will adjust that for us
+ let line_width = arrow.line_width;
+ let arrow_size = arrow.arrow_size;
let from_y, to_y, from_x, to_x;
if (board.orientation() === 'black') {
from_y = (arrow.from_row + 0.5)*square_width;
let from_y, to_y, from_x, to_x;
if (board.orientation() === 'black') {
from_y = (arrow.from_row + 0.5)*square_width;
let SVG_NS = "http://www.w3.org/2000/svg";
let XHTML_NS = "http://www.w3.org/1999/xhtml";
let svg = document.createElementNS(SVG_NS, "svg");
let SVG_NS = "http://www.w3.org/2000/svg";
let XHTML_NS = "http://www.w3.org/1999/xhtml";
let svg = document.createElementNS(SVG_NS, "svg");
- svg.setAttribute("width", board_width);
- svg.setAttribute("height", board_width);
- svg.setAttribute("style", "position: absolute");
- svg.setAttribute("position", "absolute");
+ svg.setAttribute("width", "100%");
+ svg.setAttribute("height", "100%");
+ svg.setAttribute("viewBox", "0 0 400 400");
svg.setAttribute("version", "1.1");
svg.setAttribute("class", "c1");
svg.setAttribute("xmlns", XHTML_NS);
svg.setAttribute("version", "1.1");
svg.setAttribute("class", "c1");
svg.setAttribute("xmlns", XHTML_NS);
- svg.style.top = '2px'; /* Border for .board-b72b1. */
- svg.style.left = '2px';
+ svg.style.position = 'absolute';
+ svg.style.top = '0px'; /* Border for .board-b72b1. */
+ svg.style.left = '0px';
if (opt_limit && opt_showlast && pv.length > opt_limit) {
// Truncate the PV at the beginning (instead of at the end).
// We assume here that toplay is 'W'. We also assume that if
// opt_showlast is set, then it is the history, and thus,
// the UI should be to expand the history.
ret.appendChild(document.createTextNode('('));
if (opt_limit && opt_showlast && pv.length > opt_limit) {
// Truncate the PV at the beginning (instead of at the end).
// We assume here that toplay is 'W'. We also assume that if
// opt_showlast is set, then it is the history, and thus,
// the UI should be to expand the history.
ret.appendChild(document.createTextNode('('));
} else if (toplay == 'B' && pv.length > 0) {
ret.appendChild(document.createTextNode(move_num + '. … '));
}
} else if (toplay == 'B' && pv.length > 0) {
ret.appendChild(document.createTextNode(move_num + '. … '));
}
- for ( ; i < pv.length; ++i) {
- link = document.createElement('a');
- link.className = 'move';
- link.setAttribute('id', 'automove' + line_num + '-' + i);
- link.textContent = pv[i];
- link.href = 'javascript:show_line(' + line_num + ', ' + i + ');';
+ for (; i < pv.length; ++i) {
+ let prefix = '';
+ ret.appendChild(document.createTextNode(prefix));
+
+ let link = document.createElement('a');
+ link.className = 'move';
+ link.setAttribute('id', 'automove' + line_num + '-' + i);
+ link.textContent = pv[i];
+ link.href = 'javascript:show_line(' + line_num + ', ' + i + ');';
document.getElementById("score").textContent = "No analysis for this move";
document.getElementById("pvtitle").textContent = "PV:";
document.getElementById("pv").replaceChildren();
document.getElementById("score").textContent = "No analysis for this move";
document.getElementById("pvtitle").textContent = "PV:";
document.getElementById("pv").replaceChildren();
document.getElementById("refutationlines").replaceChildren();
document.getElementById("whiteclock").replaceChildren();
document.getElementById("blackclock").replaceChildren();
document.getElementById("refutationlines").replaceChildren();
document.getElementById("whiteclock").replaceChildren();
document.getElementById("blackclock").replaceChildren();
// This matches what DGT clocks do.
let show_seconds = (white_clock_ms < 60 * 20 * 1000 || black_clock_ms < 60 * 20 * 1000);
// This matches what DGT clocks do.
let show_seconds = (white_clock_ms < 60 * 20 * 1000 || black_clock_ms < 60 * 20 * 1000);
document.getElementById("pvtitle").textContent = "Exploring:";
current_display_line.start_display_move_num = 0;
display_lines.push(current_display_line);
document.getElementById("pvtitle").textContent = "Exploring:";
current_display_line.start_display_move_num = 0;
display_lines.push(current_display_line);
display_line_num = display_lines.length - 1;
// Clear out the PV, so it's not selected by anything later.
display_line_num = display_lines.length - 1;
// Clear out the PV, so it's not selected by anything later.
let target = reverse_dragging_from;
reverse_dragging_from = null;
if (onDrop(source, target) !== 'snapback') {
let target = reverse_dragging_from;
reverse_dragging_from = null;
if (onDrop(source, target) !== 'snapback') {
window.addEventListener('keyup', function(event) {
if (event.which == 39) { // Left arrow.
next_move();
window.addEventListener('keyup', function(event) {
if (event.which == 39) { // Left arrow.
next_move();