Added option to Pan using tile coordinates.

Fixed incorrect panning.
This commit is contained in:
Sander Schobers 2020-05-23 11:02:12 +02:00
parent 7793fe823f
commit cdc999ad42

View File

@ -83,7 +83,12 @@ func (p *IsometricProjection) MoveCenterTo(tile geom.PointF32) {
// Pan translates the center of the projection with the given delta in view coordinates. // Pan translates the center of the projection with the given delta in view coordinates.
func (p *IsometricProjection) Pan(delta geom.PointF32) { func (p *IsometricProjection) Pan(delta geom.PointF32) {
p.MoveCenterTo(p.center.Add(delta.Mul(p.zoomInverse))) p.PanTile(p.ViewToTileRelative(delta))
}
// PanTile translates the center of the projection with the given delta in tile coordinates.
func (p *IsometricProjection) PanTile(delta geom.PointF32) {
p.MoveCenterTo(p.center.Add(delta))
} }
// SetTileSize sets the size of a single tile (maximum width & height difference of its corners). // SetTileSize sets the size of a single tile (maximum width & height difference of its corners).