chiark / gitweb /
js: Introduce Rect type alias
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 3 Apr 2021 21:58:23 +0000 (22:58 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 4 Apr 2021 19:07:53 +0000 (20:07 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index abd6d096703bdf40aa645a0e745d82ab89320698..fbc386fcf03dab5ec6fedb0876913e2e277741df 100644 (file)
@@ -40,6 +40,7 @@
 type PieceId = string;
 type PlayerId = string;
 type Pos = [number, number];
+type Rect = [Pos, Pos];
 type ClientSeq = number;
 type Generation = number;
 type UoKind = 'Client' | "Global"| "Piece" | "ClientExtra" | "GlobalExtra";
@@ -80,7 +81,7 @@ type PieceInfo = {
   queued_moves : number,
   last_seen_moved : DOMHighResTimeStamp | null, // non-0 means halo'd
   held_us_inoccult: boolean,
-  bbox: [Pos, Pos],
+  bbox: Rect,
 }
 
 let wasm : InitOutput;
@@ -1323,7 +1324,7 @@ type PreparedPieceState = {
   uos: UoDescription[],
   moveable: PieceMoveable,
   occregion: string | null,
-  bbox: [Pos, Pos],
+  bbox: Rect,
 }
 
 pieceops.ModifyQuiet = <PieceHandler>function
@@ -1435,7 +1436,7 @@ function redisplay_held_ancillaries() {
 type PreparedPieceImage = {
   svg: string,
   uos: UoDescription[],
-  bbox: [Pos, Pos],
+  bbox: Rect,
 }
 
 type TransmitUpdateEntry_Image = {