UICanvas.h file
Canvas: custom drawing in an element, for gizmos, graphs, curves, node wires.
if (auto canvas = ui.Canvas({ .Width = GGSize::Grow(), .Height = GGSize::Grow() }, [=](GGCanvas& draw) { draw.Line({ 0, 0 }, { draw.Width(), draw.Height() }, { .Width = 2.0f, .Color = axisX }); draw.Arc(centre, 40.0f, 0.0f, 3.14159f, { .Color = axisY }); })) { ui.OnDrag([](const PointerEvent& e) { ... }); // handlers go inside it, as for any element }
Positions are UI units from the canvas's top-left; Width() and Height() are its size as last laid out (zero the first time). The drawing is redone whenever the code around it runs again, and when the canvas changes size. It draws under the canvas's children and is clipped to it.
Namespaces
- namespace GGUI
Classes
- struct GGUI::GGPoint
- A point on a canvas, in UI units from its top left.
- struct GGUI::GGStroke
- How a line is drawn.
- struct GGUI::CanvasProps
- Properties of ui.Canvas.
- class GGUI::GGCanvas
- What a canvas's drawing function draws with.