Skip to content

Commit

Permalink
Fix issue where pixels would be off by 50% on macOS
Browse files Browse the repository at this point in the history
Uses not-yet-released Fyne API, will be in v1.2.3.
Fixes #1
  • Loading branch information
andydotxyz committed Feb 8, 2020
1 parent d989168 commit 62cd54a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/ui/raster.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ func (r *interactiveRaster) TappedSecondary(*fyne.PointEvent) {

func (r *interactiveRaster) locationForPosition(pos fyne.Position) (int, int) {
c := fyne.CurrentApp().Driver().CanvasForObject(r.img)
scale := float32(1.0)
x, y := pos.X, pos.Y
if c != nil {
scale = c.Scale()
x, y = c.PixelCoordinateForPosition(pos)
}

return int(float32(pos.X)*scale) / r.edit.zoom, int(float32(pos.Y)*scale) / r.edit.zoom
return x / r.edit.zoom, y / r.edit.zoom
}

func newInteractiveRaster(edit *editor) *interactiveRaster {
Expand Down

0 comments on commit 62cd54a

Please sign in to comment.