// <g id="piece{}" >
// currently-displayed version of the piece
// to allow addition/removal of selected indication
-// contains 1 or 2 subelements:
-// first is straight from server and not modified
-// second is possible <use href="#select{}" >
+// contains 1 or 3 subelements:
+// one is straight from server and not modified
+// one is possible <use href="#select{}" >
+// one is possible <use href="#halo{}" >
//
// #select{}
// generated by server, referenced by JS in pelem for selection
var defs_marker : SVGGraphicsElement;
var logdiv : HTMLElement;
var status_node : HTMLElement;
+var halo : PieceId | null;
type PlayerInfo = {
dasharray : string,
display_grab(piece,p);
}
function display_grab(piece: PieceId, p: PieceInfo) {
- var nelem = document.createElementNS(svg_ns,'use');
piece_undisplay_grab(piece, p);
+ var nelem = document.createElementNS(svg_ns,'use');
nelem.setAttributeNS(null,'href','#select'+piece);
let da = players[p.held!]!.dasharray;
nelem.setAttributeNS(null,'stroke-dasharray',da);
p.pelem= piece_element('piece',piece)!;
p.uelem.setAttributeNS(null, "x", info.pos[0]+"");
p.uelem.setAttributeNS(null, "y", info.pos[1]+"");
+ if (halo == piece) { halo = null }
piece_checkconflict(piece,p);
if (info.held == null) {
set_ungrab(piece,p);
}
function piece_checkconflict(piece: PieceId, p: PieceInfo) {
+ if (halo != piece) {
+ if (halo != null) {
+ console.log('UNHALOING',halo);
+ piece_undisplay_ancillary(p, "#halo"+halo);
+ }
+ console.log('HALOING',piece);
+ halo = piece;
+ var nelem = document.createElementNS(svg_ns,'use');
+ nelem.setAttributeNS(null,'href','#halo'+piece);
+ p.pelem.prepend(nelem);
+ }
+
if (p.cseq == null) { return; }
p.cseq = null;
add_log_message('Conflict! - simultaneous update');