The PR makes it possible for vsvg to use the Widget derive macro on its own types.
So far, the Widget trait for some vsvg types (such as Point, Unit, Length, etc.) was implemented within the whiskers crate. This is ok for manual implementation, but this would make it impossible to use the Widget derive macro because that would cause a circular dependency between the whiskers and vsvg crate.
This PR addresses this issue by splitting all widget traits and code into a separate whiskers-widgets crate, on which both whiskers and, optionally, vsvg depend. This is gated behind the whiskers-widgets feature of vsvg.
This PR also:
brings back into vsvg the widget code for vsvg types,
moves some UI utilities from vsvg_viewer to vsvg (gated behind the egui feature),
moves some other UI utilities from whisker to whiskers-widgets.
This is the resulting dependency graph:
flowchart LR
UserSketch["User Sketch"]
widgets["whiskers-widgets"]
derive["whiskers-derive"]
other["Custom Crate"]
UserSketch --> whiskers
UserSketch --> other
other --> widgets
whiskers --> vsvg
whiskers --> widgets
vsvg --> widgets
widgets --> derive
Note that whiskers reexport everything needed in whiskers::prelude::* so no other dependency/use statement is typically needed for user sketches.
The PR makes it possible for
vsvg
to use theWidget
derive macro on its own types.So far, the
Widget
trait for somevsvg
types (such asPoint
,Unit
,Length
, etc.) was implemented within thewhiskers
crate. This is ok for manual implementation, but this would make it impossible to use theWidget
derive macro because that would cause a circular dependency between thewhiskers
andvsvg
crate.This PR addresses this issue by splitting all widget traits and code into a separate
whiskers-widgets
crate, on which bothwhiskers
and, optionally,vsvg
depend. This is gated behind thewhiskers-widgets
feature ofvsvg
.This PR also:
vsvg
the widget code forvsvg
types,vsvg_viewer
tovsvg
(gated behind theegui
feature),whisker
towhiskers-widgets
.This is the resulting dependency graph:
Note that whiskers reexport everything needed in
whiskers::prelude::*
so no other dependency/use
statement is typically needed for user sketches.TODO: