Browse Source

Fix relative cursor mode

Ivan Savenko 2 years ago
parent
commit
4e834db017
2 changed files with 6 additions and 1 deletions
  1. 1 1
      client/battle/BattleFieldController.cpp
  2. 5 0
      client/eventsSDL/InputSourceTouch.cpp

+ 1 - 1
client/battle/BattleFieldController.cpp

@@ -633,7 +633,7 @@ void BattleFieldController::show(Canvas & to)
 		auto cursorIndex = CCS->curh->get<Cursor::Combat>();
 		auto imageIndex = static_cast<size_t>(cursorIndex);
 
-		canvas.draw(attackCursors->getImage(imageIndex), hexPositionAbsolute(getHoveredHex()).center() - CCS->curh->getPivotOffsetCombat(imageIndex));
+		to.draw(attackCursors->getImage(imageIndex), hexPositionAbsolute(getHoveredHex()).center() - CCS->curh->getPivotOffsetCombat(imageIndex));
 	}
 }
 

+ 5 - 0
client/eventsSDL/InputSourceTouch.cpp

@@ -15,6 +15,8 @@
 
 #include "../../lib/CConfigHandler.h"
 #include "../CMT.h"
+#include "../CGameInfo.h"
+#include "../gui/CursorHandler.h"
 #include "../gui/CGuiHandler.h"
 #include "../gui/EventDispatcher.h"
 #include "../gui/MouseButton.h"
@@ -52,6 +54,9 @@ void InputSourceTouch::handleEventFingerMotion(const SDL_TouchFingerEvent & tfin
 			};
 
 			GH.input().moveCursorPosition(moveDistance);
+			if (CCS && CCS->curh)
+				CCS->curh->cursorMove(GH.getCursorPosition().x, GH.getCursorPosition().y);
+
 			break;
 		}
 		case TouchState::IDLE: