From: Ian Jackson Date: Sun, 12 Jun 2022 23:47:01 +0000 (+0100) Subject: script: Mouse cursor: Reorganise X-Git-Tag: otter-1.2.0~27 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9529a1c4b68e73c28e7e8add22697a519ced1d2b;p=otter.git script: Mouse cursor: Reorganise This will make it easier to reuse bits. Signed-off-by: Ian Jackson --- diff --git a/templates/script.ts b/templates/script.ts index ed364ccc..ccb7e252 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -544,13 +544,13 @@ function pane_switch(newpane: PaneName) { function special_count_reupdate() { let style_elem = document.getElementById("space-cursor-style")!; let style_text; + let svg; + let xy; + let path = 'stroke-linecap="square" d="M -10 -10 10 10 M 10 -10 -10 10"'; + if (special_count == null) { - style_text = ''; } else { - let svg; - let xy; if (special_count != 0) { - let path = 'stroke-linecap="square" d="M -10 -10 10 10 M 10 -10 -10 10"'; let text_len = special_count.toString().length; let text_x = text_len <= 3 ? 0 : -15; let text_size = text_len <= 3 ? 50 : 45 * (4/text_len); @@ -575,11 +575,15 @@ function special_count_reupdate() { `; } + } + if (svg !== undefined) { let svg_data = btoa(svg); style_text = `svg[id=space] { cursor: url(data:image/svg+xml;base64,${svg_data}) ${xy}, auto; }`; + } else { + style_text = ''; } style_elem.innerHTML = style_text; recompute_keybindings();