Skip to content

Add support for vsvg::Unit and vsvg::Length as sketch parameters#95

Merged
abey79 merged 8 commits into
masterfrom
length-widget
Jan 2, 2024
Merged

Add support for vsvg::Unit and vsvg::Length as sketch parameters#95
abey79 merged 8 commits into
masterfrom
length-widget

Conversation

@abey79

@abey79 abey79 commented Jan 1, 2024

Copy link
Copy Markdown
Owner

This PR makes vsvg::Unit and vsvg::Length first class citizen in whiskers:

  • both can now be used as sketch parameters
  • most Sketch APIs (from the Draw and Transform traits) accept now impl Into<f64> for spatial coordinate arguments, which means Unit and Length can directly be passed
  • UI widget for Unit and Length support the #[param(all_units)] attribute to include large, typically irrelevant units (Unit::Km, etc.)
  • the reduced list of units is now available as vsvg::SMALL_UNITS
  • UI widget for Length further support the same set of parameters as numeric types (min, max, slider, log, etc.)
let u = self.unit;
sketch.line(u, 2. * u, 7. * u, 4. * u);
sketch.translate(0., 2. * u);
sketch.rect(4. * u, 2. * u, 6. * u, 2. * u);
image

@abey79 abey79 added the whiskers Relates to whiskers or whiskers-derive label Jan 1, 2024
abey79 added 3 commits January 2, 2024 13:47
… sketch-relevant units (excludes large units like km, etc.)
- fix length widget
- introduce unit widget
- introduce `length` example
- update `ui_demo` example
@abey79 abey79 changed the title Add supprt for vsvg::Length as sketch parameters Add support for vsvg::Unit and vsvg::Length as sketch parameters Jan 2, 2024
@abey79 abey79 merged commit 8f353ba into master Jan 2, 2024
@abey79 abey79 deleted the length-widget branch January 2, 2024 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

whiskers Relates to whiskers or whiskers-derive

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant