chiark / gitweb /
script: Change how we ungrab on all wresting transitions
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 13 Jun 2022 00:50:29 +0000 (01:50 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Jun 2022 09:24:06 +0000 (10:24 +0100)
We're going to change wresting in another place.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index 7a4fe10ca5194bd99f1867844ddead67763cb8ef..ce6a395c4e4b2c942788cfa656e521ca3324aa00 100644 (file)
@@ -158,6 +158,7 @@ var uos_node : HTMLElement;
 var zoom_val : HTMLInputElement;
 var zoom_btn : HTMLInputElement;
 var links_elem : HTMLElement;
+var was_wresting: boolean;
 var wresting: boolean;
 var occregions: wasm_bindgen.RegionList;
 let special_count: number | null;
@@ -561,6 +562,11 @@ function mousecursor_etc_reupdate() {
 
   document.getElementById('wresting-warning')!.innerHTML = !wresting ? "" :
     " <strong>(wresting mode!)</strong>";
+
+  if (wresting != was_wresting) {
+    ungrab_all();
+    was_wresting = wresting;
+  }
   
   if (wresting) {
     let text;
@@ -881,7 +887,6 @@ function lower_pieces(targets_todo: LowerTodoList):
 
 keyops_local['wrest'] = function (uo: UoRecord) {
   wresting = !wresting;
-  ungrab_all();
   mousecursor_etc_reupdate();
 }