diff options
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/wittle/puzzle.js | 5 | ||||
-rw-r--r-- | app/assets/javascripts/wittle/serializer.js | 3 | ||||
-rw-r--r-- | app/assets/javascripts/wittle/trace2.js | 23 | ||||
-rw-r--r-- | app/assets/javascripts/wittle/utilities.js.erb | 4 |
4 files changed, 29 insertions, 6 deletions
diff --git a/app/assets/javascripts/wittle/puzzle.js b/app/assets/javascripts/wittle/puzzle.js index a7ad10a..4d6b0fb 100644 --- a/app/assets/javascripts/wittle/puzzle.js +++ b/app/assets/javascripts/wittle/puzzle.js | |||
@@ -35,9 +35,12 @@ window.Puzzle = class { | |||
35 | 35 | ||
36 | // If true, custom mechanics are displayed (and validated) in this puzzle. | 36 | // If true, custom mechanics are displayed (and validated) in this puzzle. |
37 | CUSTOM_MECHANICS: false, | 37 | CUSTOM_MECHANICS: false, |
38 | 38 | ||
39 | // If true, polyominos may be placed partially off of the grid as an intermediate solution step. | 39 | // If true, polyominos may be placed partially off of the grid as an intermediate solution step. |
40 | // OUT_OF_BOUNDS_POLY: false, | 40 | // OUT_OF_BOUNDS_POLY: false, |
41 | |||
42 | // If true, the symmetry line will be invisible. | ||
43 | INVISIBLE_SYMMETRY: false, | ||
41 | } | 44 | } |
42 | } | 45 | } |
43 | 46 | ||
diff --git a/app/assets/javascripts/wittle/serializer.js b/app/assets/javascripts/wittle/serializer.js index e440569..1598d9b 100644 --- a/app/assets/javascripts/wittle/serializer.js +++ b/app/assets/javascripts/wittle/serializer.js | |||
@@ -43,6 +43,7 @@ window.serializePuzzle = function(puzzle) { | |||
43 | if (puzzle.settings.FLASH_FOR_ERRORS) settingsFlags |= SETTINGS_FLAG_FFE | 43 | if (puzzle.settings.FLASH_FOR_ERRORS) settingsFlags |= SETTINGS_FLAG_FFE |
44 | if (puzzle.settings.FAT_STARTPOINTS) settingsFlags |= SETTINGS_FLAG_FS | 44 | if (puzzle.settings.FAT_STARTPOINTS) settingsFlags |= SETTINGS_FLAG_FS |
45 | if (puzzle.settings.CUSTOM_MECHANICS) settingsFlags |= SETTINGS_FLAG_CM | 45 | if (puzzle.settings.CUSTOM_MECHANICS) settingsFlags |= SETTINGS_FLAG_CM |
46 | if (puzzle.settings.INVISIBLE_SYMMETRY) settingsFlags |= SETTINGS_FLAG_IS | ||
46 | s.writeByte(settingsFlags) | 47 | s.writeByte(settingsFlags) |
47 | 48 | ||
48 | return s.str() | 49 | return s.str() |
@@ -93,6 +94,7 @@ window.deserializePuzzle = function(data) { | |||
93 | FLASH_FOR_ERRORS: (settingsFlags & SETTINGS_FLAG_FFE) != 0, | 94 | FLASH_FOR_ERRORS: (settingsFlags & SETTINGS_FLAG_FFE) != 0, |
94 | FAT_STARTPOINTS: (settingsFlags & SETTINGS_FLAG_FS) != 0, | 95 | FAT_STARTPOINTS: (settingsFlags & SETTINGS_FLAG_FS) != 0, |
95 | CUSTOM_MECHANICS: (settingsFlags & SETTINGS_FLAG_CM) != 0, | 96 | CUSTOM_MECHANICS: (settingsFlags & SETTINGS_FLAG_CM) != 0, |
97 | INVISIBLE_SYMMETRY: (settingsFlags & SETTINGS_FLAG_IS) != 0, | ||
96 | } | 98 | } |
97 | 99 | ||
98 | s.destroy() | 100 | s.destroy() |
@@ -342,5 +344,6 @@ var SETTINGS_FLAG_PP = 4 | |||
342 | var SETTINGS_FLAG_FFE = 8 | 344 | var SETTINGS_FLAG_FFE = 8 |
343 | var SETTINGS_FLAG_FS = 16 | 345 | var SETTINGS_FLAG_FS = 16 |
344 | var SETTINGS_FLAG_CM = 32 | 346 | var SETTINGS_FLAG_CM = 32 |
347 | var SETTINGS_FLAG_IS = 64 | ||
345 | 348 | ||
346 | }) | 349 | }) |
diff --git a/app/assets/javascripts/wittle/trace2.js b/app/assets/javascripts/wittle/trace2.js index 01e4ccd..7a77564 100644 --- a/app/assets/javascripts/wittle/trace2.js +++ b/app/assets/javascripts/wittle/trace2.js | |||
@@ -138,10 +138,18 @@ class PathSegment { | |||
138 | data.svg.insertBefore(this.symCirc, data.cursor) | 138 | data.svg.insertBefore(this.symCirc, data.cursor) |
139 | data.svg.insertBefore(this.symPoly2, data.cursor) | 139 | data.svg.insertBefore(this.symPoly2, data.cursor) |
140 | data.svg.insertBefore(this.symPillarCirc, data.cursor) | 140 | data.svg.insertBefore(this.symPillarCirc, data.cursor) |
141 | this.symPoly1.setAttribute('class', 'line-3 ' + data.svg.id) | 141 | |
142 | this.symCirc.setAttribute('class', 'line-3 ' + data.svg.id) | 142 | if (data.puzzle.settings.INVISIBLE_SYMMETRY) { |
143 | this.symPoly2.setAttribute('class', 'line-3 ' + data.svg.id) | 143 | this.symPoly1.setAttribute('class', 'line-4 ' + data.svg.id) |
144 | this.symPillarCirc.setAttribute('class', 'line-3 ' + data.svg.id) | 144 | this.symCirc.setAttribute('class', 'line-4 ' + data.svg.id) |
145 | this.symPoly2.setAttribute('class', 'line-4 ' + data.svg.id) | ||
146 | this.symPillarCirc.setAttribute('class', 'line-4 ' + data.svg.id) | ||
147 | } else { | ||
148 | this.symPoly1.setAttribute('class', 'line-3 ' + data.svg.id) | ||
149 | this.symCirc.setAttribute('class', 'line-3 ' + data.svg.id) | ||
150 | this.symPoly2.setAttribute('class', 'line-3 ' + data.svg.id) | ||
151 | this.symPillarCirc.setAttribute('class', 'line-3 ' + data.svg.id) | ||
152 | } | ||
145 | 153 | ||
146 | this.symCirc.setAttribute('cx', data.symbbox.middle.x) | 154 | this.symCirc.setAttribute('cx', data.symbbox.middle.x) |
147 | this.symCirc.setAttribute('cy', data.symbbox.middle.y) | 155 | this.symCirc.setAttribute('cy', data.symbbox.middle.y) |
@@ -345,6 +353,7 @@ function clearGrid(svg, puzzle) { | |||
345 | window.deleteElementsByClassName(svg, 'line-1') | 353 | window.deleteElementsByClassName(svg, 'line-1') |
346 | window.deleteElementsByClassName(svg, 'line-2') | 354 | window.deleteElementsByClassName(svg, 'line-2') |
347 | window.deleteElementsByClassName(svg, 'line-3') | 355 | window.deleteElementsByClassName(svg, 'line-3') |
356 | window.deleteElementsByClassName(svg, 'line-4') | ||
348 | puzzle.clearLines() | 357 | puzzle.clearLines() |
349 | } | 358 | } |
350 | 359 | ||
@@ -506,7 +515,11 @@ window.onTraceStart = function(puzzle, pos, svg, start, symStart=null) { | |||
506 | 515 | ||
507 | data.symcursor = createElement('circle') | 516 | data.symcursor = createElement('circle') |
508 | svg.insertBefore(data.symcursor, data.cursor) | 517 | svg.insertBefore(data.symcursor, data.cursor) |
509 | data.symcursor.setAttribute('class', 'line-3 ' + data.svg.id) | 518 | if (data.puzzle.settings.INVISIBLE_SYMMETRY) { |
519 | data.symcursor.setAttribute('class', 'line-4 ' + data.svg.id) | ||
520 | } else { | ||
521 | data.symcursor.setAttribute('class', 'line-3 ' + data.svg.id) | ||
522 | } | ||
510 | data.symcursor.setAttribute('cx', symStart.getAttribute('cx')) | 523 | data.symcursor.setAttribute('cx', symStart.getAttribute('cx')) |
511 | data.symcursor.setAttribute('cy', symStart.getAttribute('cy')) | 524 | data.symcursor.setAttribute('cy', symStart.getAttribute('cy')) |
512 | data.symcursor.setAttribute('r', 12) | 525 | data.symcursor.setAttribute('r', 12) |
diff --git a/app/assets/javascripts/wittle/utilities.js.erb b/app/assets/javascripts/wittle/utilities.js.erb index 487af6e..6bf3a17 100644 --- a/app/assets/javascripts/wittle/utilities.js.erb +++ b/app/assets/javascripts/wittle/utilities.js.erb | |||
@@ -153,6 +153,10 @@ l('.line-3 {') | |||
153 | l(' fill: ' + window.LINE_SECONDARY + ';') | 153 | l(' fill: ' + window.LINE_SECONDARY + ';') |
154 | l(' pointer-events: none;') | 154 | l(' pointer-events: none;') |
155 | l('}') | 155 | l('}') |
156 | l('.line-4 {') | ||
157 | l(' display: none;') | ||
158 | l(' pointer-events: none;') | ||
159 | l('}') | ||
156 | l('@keyframes line-success {to {fill: ' + window.LINE_SUCCESS + ';}}') | 160 | l('@keyframes line-success {to {fill: ' + window.LINE_SUCCESS + ';}}') |
157 | l('@keyframes line-fail {to {fill: ' + window.LINE_FAIL + ';}}') | 161 | l('@keyframes line-fail {to {fill: ' + window.LINE_FAIL + ';}}') |
158 | l('@keyframes error {to {fill: red;}}') | 162 | l('@keyframes error {to {fill: red;}}') |