Skip to content

fix: preserve shape order in sheet exports#14

Open
saurabhhhcodes wants to merge 1 commit into
binarycodon:masterfrom
saurabhhhcodes:fix/export-shape-order-11
Open

fix: preserve shape order in sheet exports#14
saurabhhhcodes wants to merge 1 commit into
binarycodon:masterfrom
saurabhhhcodes:fix/export-shape-order-11

Conversation

@saurabhhhcodes

Copy link
Copy Markdown

Summary

  • add an explicit exportOrder field when saving sheet shapes
  • sort imported shapes by exportOrder when present so exported layouts reload in their original order
  • keep existing JSON compatible by leaving older files in their original array order

Root Cause

The sheet save path exports shapes as an array without an explicit ordering contract. If that array is reordered during export handling or external processing, the loader recreates shapes in the wrong stacking/layout order.

Changes Made

  • annotate each saved shape with its current sheet index
  • honor that index before recreating shapes on JSON import

Testing

  • node --check js/MagicBoard.js
  • git diff --check

Note

The issue mentions src/export/exporter.js, but this repository currently implements JSON sheet save/load in js/MagicBoard.js and MagicBoard.html.

Fixes #11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Board Export Missing Card Order - Export Randomizes Layout

1 participant