mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-15 04:14:44 +07:00
Prevent MapEditor 'pinch zoom' painting tiles (#9101)
This commit is contained in:
parent
0dcc15ccc3
commit
ca36c0e6e6
@ -17,6 +17,7 @@ import com.unciv.ui.components.tilegroups.TileSetStrings
|
||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||
import com.unciv.ui.components.ZoomableScrollPane
|
||||
import com.unciv.ui.components.extensions.onClick
|
||||
import com.unciv.ui.screens.basescreen.UncivStage
|
||||
|
||||
|
||||
/**
|
||||
@ -43,10 +44,29 @@ class EditorMapHolder(
|
||||
if (editorScreen == null) touchable = Touchable.disabled
|
||||
continuousScrollingX = tileMap.mapParameters.worldWrap
|
||||
addTiles(parentScreen.stage)
|
||||
if (editorScreen != null) addCaptureListener(getDragPaintListener())
|
||||
if (editorScreen != null) {
|
||||
addCaptureListener(getDragPaintListener())
|
||||
setupZoomPanListeners()
|
||||
}
|
||||
reloadMaxZoom()
|
||||
}
|
||||
|
||||
/** See also: [WorldMapHolder.setupZoomPanListeners][com.unciv.ui.screens.worldscreen.WorldMapHolder.setupZoomPanListeners] */
|
||||
private fun setupZoomPanListeners() {
|
||||
|
||||
fun setActHit() {
|
||||
val isEnabled = !isZooming() && !isPanning
|
||||
(stage as UncivStage).performPointerEnterExitEvents = isEnabled
|
||||
tileGroupMap.shouldAct = isEnabled
|
||||
tileGroupMap.shouldHit = isEnabled
|
||||
}
|
||||
|
||||
onPanStartListener = { setActHit() }
|
||||
onPanStopListener = { setActHit() }
|
||||
onZoomStartListener = { setActHit() }
|
||||
onZoomStopListener = { setActHit() }
|
||||
}
|
||||
|
||||
private fun addTiles(stage: Stage) {
|
||||
|
||||
val tileSetStrings = TileSetStrings()
|
||||
|
@ -189,6 +189,7 @@ class MapEditorEditTab(
|
||||
|
||||
fun tileClickHandler(tile: Tile) {
|
||||
if (brushSize < -1 || brushSize > 5 || brushHandlerType == BrushHandlerType.None) return
|
||||
if (editorScreen.mapHolder.isPanning || editorScreen.mapHolder.isZooming()) return
|
||||
editorScreen.hideSelection()
|
||||
|
||||
when (brushHandlerType) {
|
||||
|
Loading…
Reference in New Issue
Block a user