Port 23 more examples to Layout columns; place Image and PanedView ahead
BandChart, Box, CandleChart, DiscreteSlider, Flow, Image, InlineEdit, Kanban, LineChart, LineChartCompare, MoneyField, OneTimeCode, Page, PanedView, Plot bars and lines, ScrubField, Shape, ShortcutRecorder, Slider, TableView, TagInput and TreeView draw in a padded Layout column; Box lays its caption over the surface in a Stack. Image and PanedView read their rect before submitting a node and now place themselves ahead, so a column shows the picture and keeps the panes inside its padding. Popup stays at its explicit rect: an overlay places itself. Shot digests, light theme, before -> after: bandchart cfd806fbd932 -> d37fe84375f2 box d6ddc973a937 -> a821528e410f candlechart f2e99d28cdf1 -> cd5f05909ee6 discreteslider f5272a989129 -> 70622cc955d9 flow 2c5805b26b8b -> 3e22f2b27294 image ca6250c0a36d -> 3fb48f5fd6b8 inlineedit 8a527d0ad8ac -> f866a3238cb1 kanban dd5a34289cc8 -> f8c1ef8bb347 linechart cc8e3ef43199 -> 5fd1b3ad6ee2 linechartcompare 7a8b1df653c7 -> 945b38580f5b moneyfield c68414de862d -> dc7081c25f6c onetimecode ffa8c2b07b64 -> f31c29882232 page a0e259c9a197 -> 93471a5ffc7a panedview c989da6c2e7d -> 1bea2c600517 plotbars a9a4863153a8 -> 328835f9f30f plotlines 0c37c01f8363 -> cd702f3d76e1 scrubfield ed4adbba3b14 -> e54c141be31f shape afea96070eff -> d0fda20c598f shortcutrecorder 2c5d3a09f612 -> a7d1ecf60db4 slider 572dbc46e242 -> fce52743e18d tableview 586c1be5b4b3 -> 82df7903b3ac taginput cfa785b58e2c -> 02253e90ba58 treeview f5dbe580fdd0 -> 7b80a157be8c
This commit is contained in:
1 parent
f06017b560
commit
e2df0721cd
25 files changed
+182
-41
No files matched your search
@@ -9,6 +9,8 @@ Text :: #import "kryon/text";
|
||||
Plot :: #import "plot/PlotWidget";
|
||||
Charts :: #import "plot/Plot";
|
||||
Theme :: #import "kryon/theme";
|
||||
Layout :: #import "kryon/layout";
|
||||
#import "kryon/tree"
|
||||
|
||||
WidgetContext :: struct { theme: s32; now: float32; disabled: bool; reduced_motion: bool }
|
||||
|
||||
@@ -72,12 +74,16 @@ Frame :: (session: Session, viewport: Rectangle) -> s32 {
|
||||
example_input := WidgetInput(session)
|
||||
SetGalleryViewport(viewport, true, example_input.now, example_input.reduced_motion)
|
||||
Box.Draw(session, Box.Props.{.bounds = viewport, .fill = StyleTokenColor("canvas")})
|
||||
Text.Draw(session, Text.Props.{.bounds = .{viewport.x + 24.0, viewport.y + 12.0, viewport.width - 48.0, 36.0}, .text = "Plot · bars", .size = 23})
|
||||
page := Layout.Draw(session, Layout.Props.{.bounds = viewport, .padding = Layout.Gap(.ThemeMetricSpace6),
|
||||
.gap = Layout.Gap(.ThemeMetricSpace4), .gap_override = true})
|
||||
if !page.opened { return 0 }
|
||||
Text.Draw(session, Text.Props.{.bounds = .{height = 36}, .text = "Plot · bars", .size = 23})
|
||||
disabled := example_input.disabled
|
||||
scene: s32 = 1
|
||||
InstallStyles(example_input.theme == 2)
|
||||
Prepare(session, scene)
|
||||
unused Plot.Plot(session, Plot.PlotProps.{.bounds = bounds, .semantic_label = "Eight example values", .scale_min = 0.0, .scale_max = 12.0, .mode = cast(Plot.PlotMode)scene}, values[:])
|
||||
unused End(session)
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user