mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
layout: reorder fields in Inset to match system.Insets
This makes it simple to convert from one into the other. Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
+1
-1
@@ -587,9 +587,9 @@ func Java_org_gioui_GioView_onWindowInsets(env *C.JNIEnv, class C.jclass, view C
|
|||||||
w := views[view]
|
w := views[view]
|
||||||
w.insets = system.Insets{
|
w.insets = system.Insets{
|
||||||
Top: unit.Px(float32(top)),
|
Top: unit.Px(float32(top)),
|
||||||
Right: unit.Px(float32(right)),
|
|
||||||
Bottom: unit.Px(float32(bottom)),
|
Bottom: unit.Px(float32(bottom)),
|
||||||
Left: unit.Px(float32(left)),
|
Left: unit.Px(float32(left)),
|
||||||
|
Right: unit.Px(float32(right)),
|
||||||
}
|
}
|
||||||
if w.stage >= system.StageRunning {
|
if w.stage >= system.StageRunning {
|
||||||
w.draw(env, true)
|
w.draw(env, true)
|
||||||
|
|||||||
+1
-1
@@ -157,9 +157,9 @@ func (w *window) draw(sync bool) {
|
|||||||
},
|
},
|
||||||
Insets: system.Insets{
|
Insets: system.Insets{
|
||||||
Top: unit.Px(float32(params.top)),
|
Top: unit.Px(float32(params.top)),
|
||||||
Right: unit.Px(float32(params.right)),
|
|
||||||
Bottom: unit.Px(float32(params.bottom)),
|
Bottom: unit.Px(float32(params.bottom)),
|
||||||
Left: unit.Px(float32(params.left)),
|
Left: unit.Px(float32(params.left)),
|
||||||
|
Right: unit.Px(float32(params.right)),
|
||||||
},
|
},
|
||||||
Metric: unit.Metric{
|
Metric: unit.Metric{
|
||||||
PxPerDp: float32(params.dpi) * inchPrDp,
|
PxPerDp: float32(params.dpi) * inchPrDp,
|
||||||
|
|||||||
+2
-1
@@ -609,7 +609,8 @@ func (w *window) draw(sync bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *window) getConfig() (image.Point, system.Insets, unit.Metric) {
|
func (w *window) getConfig() (image.Point, system.Insets, unit.Metric) {
|
||||||
return image.Pt(w.config.Size.X, w.config.Size.Y), system.Insets{
|
return image.Pt(w.config.Size.X, w.config.Size.Y),
|
||||||
|
system.Insets{
|
||||||
Bottom: unit.Px(w.inset.Y),
|
Bottom: unit.Px(w.inset.Y),
|
||||||
Right: unit.Px(w.inset.X),
|
Right: unit.Px(w.inset.X),
|
||||||
}, unit.Metric{
|
}, unit.Metric{
|
||||||
|
|||||||
+1
-1
@@ -113,7 +113,7 @@ func (c Constraints) Constrain(size image.Point) image.Point {
|
|||||||
// constraints. The minimum constraints will be adjusted to ensure
|
// constraints. The minimum constraints will be adjusted to ensure
|
||||||
// they do not exceed the maximum.
|
// they do not exceed the maximum.
|
||||||
type Inset struct {
|
type Inset struct {
|
||||||
Top, Right, Bottom, Left unit.Value
|
Top, Bottom, Left, Right unit.Value
|
||||||
}
|
}
|
||||||
|
|
||||||
// Layout a widget.
|
// Layout a widget.
|
||||||
|
|||||||
Reference in New Issue
Block a user