mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
all: make unit.Converter concrete and rename to Metric
An interface for scaling dp and sp is overkill, at least for all current uses. Make it a concrete struct type, and rename it to the shorter and more precise Metric. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"gioui.org/io/key"
|
||||
"gioui.org/io/pointer"
|
||||
"gioui.org/io/system"
|
||||
"gioui.org/unit"
|
||||
|
||||
_ "gioui.org/app/internal/cocoainit"
|
||||
)
|
||||
@@ -236,16 +237,16 @@ func (w *window) draw() {
|
||||
X: width,
|
||||
Y: height,
|
||||
},
|
||||
Config: &cfg,
|
||||
Metric: cfg,
|
||||
},
|
||||
Sync: true,
|
||||
})
|
||||
}
|
||||
|
||||
func configFor(scale float32) config {
|
||||
return config{
|
||||
pxPerDp: scale,
|
||||
pxPerSp: scale,
|
||||
func configFor(scale float32) unit.Metric {
|
||||
return unit.Metric{
|
||||
PxPerDp: scale,
|
||||
PxPerSp: scale,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user