summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 969518f)
raw | patch | inline | side by side (parent: 969518f)
author | fredboy <fredboy@protonmail.com> | |
Tue, 23 Apr 2024 21:47:26 +0000 (04:47 +0700) | ||
committer | fredboy <fredboy@protonmail.com> | |
Tue, 23 Apr 2024 21:47:26 +0000 (04:47 +0700) |
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CreativeInventoryScrollMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CreativeInventoryScrollMouseInputHandler.kt
index 52e9f627071ea971fc8c148ed97730f316be6514..01cc4e23a5c1f78a38c7dd2ee6a4a8b47ef2e9b9 100644 (file)
package ru.deadsoftware.cavedroid.game.input.handler.mouse
import com.badlogic.gdx.math.MathUtils
+import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameItemsHolder
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.game.GameUiWindow
@GameScope
class CreativeInventoryScrollMouseInputHandler @Inject constructor(
+ private val mainConfig: MainConfig,
private val gameWindowsManager: GameWindowsManager,
private val gameItemsHolder: GameItemsHolder,
) : IGameInputHandler<MouseInputAction> {
}
private fun checkStartDragConditions(action: MouseInputAction): Boolean {
- return action.actionKey is MouseInputActionKey.Left &&
+ return (action.actionKey is MouseInputActionKey.Touch) &&
!action.actionKey.touchUp && !gameWindowsManager.isDragging
}
private fun checkEndDragConditions(action: MouseInputAction): Boolean {
- return action.actionKey is MouseInputActionKey.Left &&
+ return action.actionKey is MouseInputActionKey.Touch &&
action.actionKey.touchUp && gameWindowsManager.isDragging
}
private fun checkDragConditions(action: MouseInputAction): Boolean {
- return action.actionKey is MouseInputActionKey.Dragged &&
+ return mainConfig.isTouch && action.actionKey is MouseInputActionKey.Dragged &&
abs(action.screenY - dragStartY) >= DRAG_SENSITIVITY
}
override fun handle(action: MouseInputAction) {
when (action.actionKey) {
- is MouseInputActionKey.Left -> handleStartOrEndDrag(action)
+ is MouseInputActionKey.Touch -> handleStartOrEndDrag(action)
is MouseInputActionKey.Dragged -> handleDrag(action)
is MouseInputActionKey.Scroll -> handleScroll(action)
else -> return
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectCreativeInventoryItemMouseInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectCreativeInventoryItemMouseInputHandler.kt
index ddd71c4418cbae9603214f0c8985b84083564f13..e6fb732c2fb118e83ab118a548e76edcf7b8c50e 100644 (file)
override fun checkConditions(action: MouseInputAction): Boolean {
return gameWindowsManager.getCurrentWindow() == GameUiWindow.CREATIVE_INVENTORY &&
!gameWindowsManager.isDragging &&
- action.actionKey is MouseInputActionKey.Left &&
+ (action.actionKey is MouseInputActionKey.Left || action.actionKey is MouseInputActionKey.Touch) &&
action.actionKey.touchUp && isInsideWindow(action, creativeInventoryTexture)
}