add a laser pointer to highlight a case
This commit is contained in:
parent
08a7890bf7
commit
ff8bb5ce49
|
@ -165,3 +165,6 @@ msgstr "Vous avez changé la langue du plateau en {0}"
|
|||
|
||||
msgid "{0} changed the language of the board to {1}"
|
||||
msgstr "{0} a changé la langue du plateau en {1}"
|
||||
|
||||
msgid "Look at:"
|
||||
msgstr "Regardez ici :"
|
||||
|
|
|
@ -171,3 +171,6 @@ msgstr ""
|
|||
|
||||
msgid "{0} changed the language of the board to {1}"
|
||||
msgstr ""
|
||||
|
||||
msgid "Look at:"
|
||||
msgstr ""
|
||||
|
|
|
@ -192,6 +192,10 @@ button:hover {
|
|||
cursor:pointer
|
||||
}
|
||||
|
||||
.highlight {
|
||||
background-color: #E3E;
|
||||
}
|
||||
|
||||
.tile.tile-highlight {
|
||||
background-color: #FFF;
|
||||
font-weight: bold;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
setConf("ENABLE_EVENT_SOURCE", true);
|
||||
setConf("MAX_WEBSOCKET_ERRORS", 1);
|
||||
setConf("APP_PATH", "");
|
||||
setConf("DOUBLE_TAP_DURATION", 1000);
|
||||
|
||||
const _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {
|
||||
return s;
|
||||
|
@ -683,6 +684,11 @@
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
case "highlightTile": {
|
||||
localHighlightTile(msg.specialMsg.tile);
|
||||
infoMessage(msg.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1435,6 +1441,41 @@
|
|||
|
||||
}
|
||||
|
||||
function highlightTile(e) {
|
||||
let id = this.id;
|
||||
if (id === "") {
|
||||
return;
|
||||
}
|
||||
if (e.type === "touchstart") {
|
||||
if ((highlightTile.id !== id) || (Date.now() - highlightTile.date > Conf.DOUBLE_TAP_DURATION)) {
|
||||
highlightTile.id = id;
|
||||
highlightTile.date = Date.now();
|
||||
return;
|
||||
}
|
||||
}
|
||||
const letters = "ABCDEFGHIJKLMNO";
|
||||
const col = (id % 15) + 1;
|
||||
const row = letters[Math.floor(id / 15)];
|
||||
sendCmds([{
|
||||
cmd: "msg",
|
||||
msg: _("Look at:") + " " + row + "" + col,
|
||||
specialMsg: {
|
||||
type: "highlightTile",
|
||||
tile: id
|
||||
}
|
||||
}]);
|
||||
}
|
||||
|
||||
function localHighlightTile(id) {
|
||||
const placeholder = boardCells[id].getElementsByClassName("tile-placeholder")[0];
|
||||
placeholder.classList.add("highlight");
|
||||
setTimeout(function (x) { x.classList.remove("highlight"); }, 500, placeholder);
|
||||
setTimeout(function (x) { x.classList.add("highlight"); }, 750, placeholder);
|
||||
setTimeout(function (x) { x.classList.remove("highlight"); }, 1000, placeholder);
|
||||
setTimeout(function (x) { x.classList.add("highlight"); }, 1250, placeholder);
|
||||
setTimeout(function (x) { x.classList.remove("highlight"); }, 1500, placeholder);
|
||||
}
|
||||
|
||||
function initChat() {
|
||||
const btn = document.getElementById("chat-btn");
|
||||
|
||||
|
@ -1658,6 +1699,9 @@
|
|||
cell = document.createElement("td");
|
||||
boardCells.push(cell);
|
||||
board.lastChild.appendChild(cell);
|
||||
cell.id = i * 15 + j;
|
||||
cell.ondblclick = highlightTile;
|
||||
cell.ontouchstart = highlightTile;
|
||||
cell.appendChild(document.createElement("div"));
|
||||
cell.lastChild.className = "tile-placeholder";
|
||||
|
||||
|
|
Loading…
Reference in New Issue