myersdg / rubyTarker

2 stars 3 forks source link

Bug: savedPalette referencing palette #10

Closed Qlaub closed 2 years ago

Qlaub commented 2 years ago

Behavior:

When palettes updates, savedPalettes also updates. Causes bug with loading palettes.

Possible reason:

They both reference the same array (palette)

Possible area of bug:

line 536 - savedPalettes.push(palette) - found in event handler $(".saveBtn").on("click", function() {

Possible fix:

Before pushing, create new palette copy array by passing every string and integer from palette and then pushing into savedPalette. Could make palette an object instead of an array (updating all references to it in the code), which would make the aforementioned duplication easier.