Browse Source

Fix map edge scrolling after swiping usage

Ivan Savenko 2 years ago
parent
commit
81b9aec527
3 changed files with 4 additions and 14 deletions
  1. 3 1
      client/gui/EventDispatcher.cpp
  2. 1 8
      client/mapView/MapView.cpp
  3. 0 5
      client/mapView/MapView.h

+ 3 - 1
client/gui/EventDispatcher.cpp

@@ -63,7 +63,9 @@ void EventDispatcher::dispatchTimer(uint32_t msPassed)
 	EventReceiversList hlp = timeinterested;
 	for (auto & elem : hlp)
 	{
-		if(!vstd::contains(timeinterested,elem)) continue;
+		if(!vstd::contains(timeinterested,elem))
+			continue;
+
 		elem->tick(msPassed);
 	}
 }

+ 1 - 8
client/mapView/MapView.cpp

@@ -90,7 +90,6 @@ void MapView::show(Canvas & to)
 
 MapView::MapView(const Point & offset, const Point & dimensions)
 	: BasicMapView(offset, dimensions)
-	, isSwiping(false)
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
 	actions = std::make_shared<MapViewActions>(*this, model);
@@ -110,21 +109,15 @@ void MapView::onMapLevelSwitched()
 
 void MapView::onMapScrolled(const Point & distance)
 {
-	if(!isSwiping)
+	if(!isGesturing())
 		controller->setViewCenter(model->getMapViewCenter() + distance, model->getLevel());
 }
 
 void MapView::onMapSwiped(const Point & viewPosition)
 {
-	isSwiping = true;
 	controller->setViewCenter(model->getMapViewCenter() + viewPosition, model->getLevel());
 }
 
-void MapView::onMapSwipeEnded()
-{
-	isSwiping = false;
-}
-
 void MapView::onCenteredTile(const int3 & tile)
 {
 	controller->setViewCenter(tile);

+ 0 - 5
client/mapView/MapView.h

@@ -48,8 +48,6 @@ class MapView : public BasicMapView
 {
 	std::shared_ptr<MapViewActions> actions;
 
-	bool isSwiping;
-
 public:
 	void show(Canvas & to) override;
 
@@ -64,9 +62,6 @@ public:
 	/// Moves current view to specified position, in pixels
 	void onMapSwiped(const Point & viewPosition);
 
-	/// Ends swiping mode and allows normal map scrolling once again
-	void onMapSwipeEnded();
-
 	/// Moves current view to specified tile
 	void onCenteredTile(const int3 & tile);