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:
Elias Naur
2020-06-17 11:47:14 +02:00
parent 1603a6f3ee
commit 596e321610
15 changed files with 86 additions and 85 deletions
+6 -5
View File
@@ -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,
}
}