fix: clickOnceListener would not fired if screen is magnified

This commit is contained in:
minjaesong
2023-06-26 19:07:25 +09:00
parent 739b51af95
commit e5e8028b3f
6 changed files with 24 additions and 14 deletions

View File

@@ -190,7 +190,7 @@ abstract class UICanvas(
if (!uiItems.contains(uiItem)) uiItems.add(uiItem)
}
fun mouseInScreen(x: Int, y: Int) = x in 0 until App.scr.width && y in 0 until App.scr.height
fun mouseInScreen(x: Int, y: Int) = x in 0 until App.scr.windowW && y in 0 until App.scr.windowH
/**
* Called by the screen's InputProcessor

View File

@@ -215,6 +215,8 @@ abstract class UIItem(var parentUI: UICanvas, val initialX: Int, val initialY: I
return false
}
open fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
// FIXME does not work with magnified screen
var actionDone = false
if (parentUI.isVisible && isActive) {

View File

@@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.App
import net.torvald.terrarum.CommonResourcePool
import net.torvald.terrarum.blendNormalStraightAlpha
import net.torvald.terrarum.toInt