From 521a44eb720c0dbd8a30b38973fcd0352a22f825 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 29 Nov 2023 20:15:45 -0500 Subject: fix error-correction issues with overlapping lines --- app/assets/javascripts/wittle/trace2.js | 12 ++++++++++-- app/assets/javascripts/wittle/utilities.js.erb | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'app/assets') diff --git a/app/assets/javascripts/wittle/trace2.js b/app/assets/javascripts/wittle/trace2.js index e36e4bd..81439e7 100644 --- a/app/assets/javascripts/wittle/trace2.js +++ b/app/assets/javascripts/wittle/trace2.js @@ -696,7 +696,11 @@ window.onMove = function(dx, dy) { data.path.pop().destroy() data.puzzle.updateCell2(data.pos.x, data.pos.y, 'line', window.LINE_NONE) if (data.puzzle.symType != SYM_TYPE_NONE) { - data.puzzle.updateCell2(data.sym.x, data.sym.y, 'line', window.LINE_NONE) + if (data.puzzle.getLine(data.sym.x, data.sym.y) == window.LINE_OVERLAP) { + data.puzzle.updateCell2(data.sym.x, data.sym.y, 'line', window.LINE_BLUE) + } else { + data.puzzle.updateCell2(data.sym.x, data.sym.y, 'line', window.LINE_NONE) + } } } @@ -713,7 +717,11 @@ window.onMove = function(dx, dy) { data.puzzle.updateCell2(data.pos.x, data.pos.y, 'line', window.LINE_BLACK) } else { data.puzzle.updateCell2(data.pos.x, data.pos.y, 'line', window.LINE_BLUE) - data.puzzle.updateCell2(data.sym.x, data.sym.y, 'line', window.LINE_YELLOW) + if (data.puzzle.getLine(data.sym.x, data.sym.y) == window.LINE_BLUE) { + data.puzzle.updateCell2(data.sym.x, data.sym.y, 'line', window.LINE_OVERLAP) + } else { + data.puzzle.updateCell2(data.sym.x, data.sym.y, 'line', window.LINE_YELLOW) + } } } } diff --git a/app/assets/javascripts/wittle/utilities.js.erb b/app/assets/javascripts/wittle/utilities.js.erb index 6bf3a17..b621003 100644 --- a/app/assets/javascripts/wittle/utilities.js.erb +++ b/app/assets/javascripts/wittle/utilities.js.erb @@ -129,6 +129,7 @@ window.LINE_NONE = 0 window.LINE_BLACK = 1 window.LINE_BLUE = 2 window.LINE_YELLOW = 3 +window.LINE_OVERLAP = 4 window.DOT_NONE = 0 window.DOT_BLACK = 1 window.DOT_BLUE = 2 -- cgit 1.4.1