From 5fcd34beb93f0c0b3b01565be50fe80cb0722073 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 1 Sep 2020 14:15:57 +0100 Subject: [PATCH] end drag when Conflict --- templates/script.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/script.ts b/templates/script.ts index 24e7538d..4a5b66ad 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -358,6 +358,10 @@ function drag_mousemove(e: MouseEvent) { function drag_mouseup(e: MouseEvent) { console.log('mouseup', dragging); let ddr2 : number = drag_mousemove(e); + drag_end(); +} + +function drag_end() { if (dragging == DRAGGING.MAYBE_UNGRAB || (dragging & ~DRAGGING.RAISED) == (DRAGGING.MAYBE_GRAB | DRAGGING.YES)) { let dp = drag_pieces[0]!; @@ -539,6 +543,10 @@ messages.Recorded = function function piece_checkconflict_nrda(piece: PieceId, p: PieceInfo): boolean { if (p.cseq != null) { p.cseq = null; + if (drag_pieces.some(function(dp) { return dp.piece == piece; })) { + console.log('drag end due to conflict'); + drag_end(); + } add_log_message('Conflict! - simultaneous update'); } return false; -- 2.30.2