Serialise flags value - #317
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #317 +/- ##
==========================================
+ Coverage 91.86% 91.87% +0.01%
==========================================
Files 128 128
Lines 9350 9352 +2
Branches 1966 1966
==========================================
+ Hits 8589 8592 +3
+ Misses 685 684 -1
Partials 76 76 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR makes Flags serialise to a plain numeric value so JSON-based flows preserve bitmask state when entities are copied, stringified, and reconstructed. In the codebase, this is especially relevant to clipboard/import-style round trips where flagged entities such as polylines and text rely on numeric flag values during reconstruction.
Changes:
- Add
Flags.toJSON()soJSON.stringify()emits the numeric flag value instead of a nested{ flags: ... }object. - Document why numeric serialisation is needed for clipboard-style round trips.
- Add unit tests covering
toJSON()directly and a basic JSON stringify/parse round trip forFlags.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
core/properties/flags.js |
Adds numeric JSON serialisation for Flags instances. |
test/properties/flags.test.js |
Adds unit tests for direct and JSON round-trip serialisation of Flags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| toJSON() { | ||
| return this.flags; |
No description provided.