From: Ian Jackson Date: Tue, 1 Sep 2020 13:15:57 +0000 (+0100) Subject: end drag when Conflict X-Git-Tag: otter-0.2.0~1038 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=5fcd34beb93f0c0b3b01565be50fe80cb0722073;p=otter.git end drag when Conflict --- 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;