From da3014bd545d5877bbf4b8793a1ae2ed16e7100c Mon Sep 17 00:00:00 2001 From: Michael <13953785+Laserlicht@users.noreply.github.com> Date: Sun, 27 Aug 2023 21:40:56 +0200 Subject: [PATCH] Haptic feedback and increased dead zone --- client/mapView/MapViewController.cpp | 9 +++++++++ client/mapView/MapViewController.h | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/client/mapView/MapViewController.cpp b/client/mapView/MapViewController.cpp index 46668da5b..5d865ec69 100644 --- a/client/mapView/MapViewController.cpp +++ b/client/mapView/MapViewController.cpp @@ -20,6 +20,7 @@ #include "../adventureMap/AdventureMapInterface.h" #include "../gui/CGuiHandler.h" #include "../gui/WindowHandler.h" +#include "../eventsSDL/InputHandler.h" #include "../../lib/CConfigHandler.h" #include "../../lib/mapObjects/CGHeroInstance.h" @@ -118,6 +119,14 @@ void MapViewController::modifyTileSize(int stepsChange) actualZoom.x = defaultTileSize; if(actualZoom.y >= defaultTileSize - zoomTileDeadArea && actualZoom.y <= defaultTileSize + zoomTileDeadArea) actualZoom.y = defaultTileSize; + + bool isInDeadZone = targetTileSize != actualZoom; + + if(!wasInDeadZone && isInDeadZone) + GH.input().hapticFeedback(); + + wasInDeadZone = isInDeadZone; + setTileSize(actualZoom); } } diff --git a/client/mapView/MapViewController.h b/client/mapView/MapViewController.h index 32db5b7c4..3a23b917e 100644 --- a/client/mapView/MapViewController.h +++ b/client/mapView/MapViewController.h @@ -51,8 +51,9 @@ class MapViewController : public IMapObjectObserver private: const int defaultTileSize = 32; - const int zoomTileDeadArea = 4; + const int zoomTileDeadArea = 5; Point targetTileSize = Point(32, 32); + bool wasInDeadZone = true; bool isEventInstant(const CGObjectInstance * obj); bool isEventVisible(const CGObjectInstance * obj);