-p// Copyright 2020 Ian Jackson
+// Copyright 2020 Ian Jackson
// SPDX-License-Identifier: AGPL-3.0-or-later
// There is NO WARRANTY.
api_raise,
api_move,
api_wrest,
+ api_pin,
api_uo,
])
}
held : &'r Option<PlayerId>,
z : ZCoord,
zg : Generation,
+ pinned : bool,
uos: &'r [UoDescription],
}
held : &pr.held,
z : pr.zlevel.z,
zg : pr.zlevel.zg,
+ pinned : pr.pinned,
uos : &p.ui_operations()?,
};
recompute_keybindings();
}
+keyops_local['pin' ] = function (uo) { pin_unpin(uo, true ); }
+keyops_local['unpin'] = function (uo) { pin_unpin(uo, false); }
+
+function pin_unpin(uo: UoRecord, newpin: boolean) {
+ for (let piece of uo.targets!) {
+ let p = pieces[piece]!;
+ p.pinned = newpin;
+ api_piece(api, 'pin', piece,p, newpin);
+ redisplay_ancillaries(piece,p);
+ }
+ recompute_keybindings();
+}
+
// ----- clicking/dragging pieces -----
type DragInfo = {
} else if (p.last_seen_moved != null) {
halo_colour = 'yellow';
} else if (p.held != null && p.pinned) {
- halo_colour = 'white';
+ halo_colour = '#8cf';
}
if (halo_colour != null) {
let nelem = ancillary_node(piece, halo_colour);