← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/switch_direction into lp:widelands

 

SirVer has proposed merging lp:~widelands-dev/widelands/switch_direction into lp:widelands.

Commit message:
Immediately change animation direction when new target is given.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/switch_direction/+merge/315432
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/switch_direction into lp:widelands.
=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc	2017-01-23 08:10:02 +0000
+++ src/wui/mapview.cc	2017-01-24 07:44:12 +0000
@@ -441,10 +441,14 @@
 }
 
 void MapView::scroll_to_map_pixel(const Vector2f& pos, const Transition& transition) {
-	const TimestampedView current = animation_target_view();
-	const Rectf area = get_view_area(current.view, get_w(), get_h());
+	const TimestampedView target = animation_target_view();
+	const Rectf area = get_view_area(target.view, get_w(), get_h());
 	const Vector2f target_view = pos - Vector2f(area.w / 2.f, area.h / 2.f);
-	set_view(View{target_view, current.view.zoom}, transition);
+
+	// Immediately start moving towards this new 'target'.
+	view_plans_.clear();
+
+	set_view(View{target_view, target.view.zoom}, transition);
 }
 
 MapView::ViewArea MapView::view_area() const {


Follow ups