Skip to content

Add support for units / math expressions - #3

Draft
DJ-Laser wants to merge 4 commits into
edanliahovetsky:mainfrom
DJ-Laser:units
Draft

DJ-Laser wants to merge 4 commits into
edanliahovetsky:mainfrom
DJ-Laser:units

Conversation

@DJ-Laser

Copy link
Copy Markdown
Contributor

Replaces most numeric values with a unit aware record type. Note that the use of structuredClone in the history saving logic means that storing the actual mathjs.Unit value is not possible. I have not modified the tests or file saving code yet, as this pr will eventually need breaking changes in the save file format.

Right now this PR is very much a work in progress, but I wanted to share my current progress and get any feedback on the proposed changes.

@DJ-Laser

Copy link
Copy Markdown
Contributor Author

The changes made to the properties display mean that generated values (such as element dragging) are shown with full precision. Rounding these would need to be done when they are assigned to the path element since they just get stored as units.<Unit>.of(<Number with lots of decimals>)

I also had to change the undo-history commands to take in unit values instead of numbers in order to preserve expressions when undo/redo occurs

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.

1 participant