From f83b4a60b32f88720b583bd2b4a4d91995d0df77 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 6 Nov 2023 20:15:22 -0500 Subject: fixed side endpoints with parallel symmetry --- app/assets/javascripts/wittle/trace2.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'app/assets/javascripts') diff --git a/app/assets/javascripts/wittle/trace2.js b/app/assets/javascripts/wittle/trace2.js index 9602a41..a3ef343 100644 --- a/app/assets/javascripts/wittle/trace2.js +++ b/app/assets/javascripts/wittle/trace2.js @@ -62,11 +62,21 @@ class BoundingBox { this.y1 = this.raw.y1 this.y2 = this.raw.y2 - // Check for endpoint adjustment - if (this.sym !== true) { - var cell = data.puzzle.getCell(data.pos.x, data.pos.y) + // Check for endpoint adjustment. + // Pretend it's not an endpoint if the sym cell isn't an endpoint. + if (data.puzzle.symType != SYM_TYPE_NONE) { + var cell1 = data.puzzle.getCell(data.pos.x, data.pos.y) + var cell2 = data.puzzle.getSymmetricalCell(data.pos.x, data.pos.y) + + if (cell1.end !== cell2.end) { + var cell = {'end': 'none'} + } else if (this.sym !== true) { + var cell = cell1 + } else { + var cell = cell2 + } } else { - var cell = data.puzzle.getSymmetricalCell(data.sym.x, data.sym.y) + var cell = data.puzzle.getCell(data.pos.x, data.pos.y) } if (cell.end === 'left') { this.x1 -= 24 -- cgit 1.4.1