Skip to content

Commit 1e86f95

Browse files
authored
Merge pull request #2397 from gwdevhub/fix/mission-map-remove-pan-easing
fix(mission-map): remove pan easing causing overlay lag while dragging
2 parents a5e6ccd + bbe3e2e commit 1e86f95

1 file changed

Lines changed: 2 additions & 25 deletions

File tree

GWToolboxdll/Widgets/MissionMapWidget.cpp

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ namespace {
4949
float bx, by;
5050
bool valid = false;
5151
bool has_basis = false;
52-
bool has_origin = false;
53-
clock_t last_rebuild = TIMER_INIT();
5452

5553
float cached_basis_zoom = 0.f;
5654
void Rebuild();
@@ -174,29 +172,8 @@ namespace {
174172
const GW::Vec2f player_screen = {mm_scaled.x * mission_map_zoom + mission_map_screen_pos.x,
175173
mm_scaled.y * mission_map_zoom + mission_map_screen_pos.y};
176174

177-
const float target_ox = player_screen.x - px * ax - py * bx;
178-
const float target_oy = player_screen.y - px * ay - py * by;
179-
180-
// GW's own mission-map background pans with a follow-cam ease rather than snapping
181-
// instantly to the player; matching that here (instead of tracking the raw position
182-
// exactly) keeps our overlays visually glued to the backdrop instead of swimming
183-
// against it. Snap instead of easing on the first frame or after a big jump (map
184-
// change/teleport/zoom) so it doesn't visibly slide in from a stale position.
185-
constexpr float SNAP_THRESHOLD_PX = 300.f;
186-
const float dt_ms = static_cast<float>(TIMER_DIFF(last_rebuild));
187-
last_rebuild = TIMER_INIT();
188-
189-
if (!has_origin || fabsf(target_ox - ox) > SNAP_THRESHOLD_PX || fabsf(target_oy - oy) > SNAP_THRESHOLD_PX) {
190-
ox = target_ox;
191-
oy = target_oy;
192-
has_origin = true;
193-
}
194-
else {
195-
constexpr float TAU_MS = 120.f;
196-
const float alpha = 1.f - expf(-dt_ms / TAU_MS);
197-
ox += (target_ox - ox) * alpha;
198-
oy += (target_oy - oy) * alpha;
199-
}
175+
ox = roundf(player_screen.x - px * ax - py * bx);
176+
oy = roundf(player_screen.y - px * ay - py * by);
200177
valid = true;
201178
}
202179

0 commit comments

Comments
 (0)