Skip to content

Commit e902faf

Browse files
committed
Fix map panning not working as expected on some zoom levels
1 parent b7f65b8 commit e902faf

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/gui/radar/MapView.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,10 @@ export class MapView extends BaseElement {
5151
this.relY = 15
5252
this.onClick = (cx: number, cy: number) => {
5353
if (this.entityBelowCursor) EventBroker.publish(new FollowerSetLookAtEvent(this.entityBelowCursor))
54-
const surfaceScale = this.surfaceRectSizeMin / this.surfaceRectSize
55-
this.offset.x += (cx - this.x - this.width / 2) * surfaceScale
56-
this.offset.y += (cy - this.y - this.height / 2) * surfaceScale
57-
this.offset.x = Math.max(-this.width / 2, Math.min(this.terrainWidth * this.surfaceRectSizeMin - this.width / 2, this.offset.x))
58-
this.offset.y = Math.max(-this.height / 2, Math.min(this.terrainHeight * this.surfaceRectSizeMin - this.height / 2, this.offset.y))
54+
this.offset.x += (cx - this.x - this.width / 2)
55+
this.offset.y += (cy - this.y - this.height / 2)
56+
this.offset.x = Math.max(-this.width / 2, Math.min(this.terrainWidth * this.surfaceRectSize - this.width / 2, this.offset.x))
57+
this.offset.y = Math.max(-this.height / 2, Math.min(this.terrainHeight * this.surfaceRectSize - this.height / 2, this.offset.y))
5958
this.redrawAll()
6059
}
6160
this.registerEventListener(EventKey.INIT_RADAR_MAP, (event: InitRadarMap) => {

0 commit comments

Comments
 (0)