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
+3 -3
View File
@@ -129,7 +129,7 @@ func (e *Editor) processPointer(gtx layout.Context) {
axis = gesture.Vertical
smin, smax = sbounds.Min.Y, sbounds.Max.Y
}
sdist := e.scroller.Scroll(gtx, gtx, gtx.Now, axis)
sdist := e.scroller.Scroll(gtx.Metric, gtx, gtx.Now, axis)
var soff int
if e.SingleLine {
e.scrollRel(sdist, 0)
@@ -143,7 +143,7 @@ func (e *Editor) processPointer(gtx layout.Context) {
case evt.Type == gesture.TypePress && evt.Source == pointer.Mouse,
evt.Type == gesture.TypeClick && evt.Source == pointer.Touch:
e.blinkStart = gtx.Now
e.moveCoord(gtx, image.Point{
e.moveCoord(gtx.Metric, image.Point{
X: int(math.Round(float64(evt.Position.X))),
Y: int(math.Round(float64(evt.Position.Y))),
})
@@ -426,7 +426,7 @@ func (e *Editor) scrollAbs(x, y int) {
}
}
func (e *Editor) moveCoord(c unit.Converter, pos image.Point) {
func (e *Editor) moveCoord(c unit.Metric, pos image.Point) {
var (
prevDesc fixed.Int26_6
carLine int