mirror of
https://github.com/yairm210/Unciv.git
synced 2024-12-23 01:04:24 +07:00
cleanup: Copy Zero vectors before passing to localToStageCoordinates (#10048)
This commit is contained in:
parent
7597447b7e
commit
55a3fa2a75
@ -128,7 +128,7 @@ fun Actor.getAscendant(predicate: (Actor) -> Boolean): Actor? {
|
||||
|
||||
/** The actors bounding box in stage coordinates */
|
||||
val Actor.stageBoundingBox: Rectangle get() {
|
||||
val bottomLeft = localToStageCoordinates(Vector2.Zero)
|
||||
val bottomLeft = localToStageCoordinates(Vector2.Zero.cpy())
|
||||
val topRight = localToStageCoordinates(Vector2(width, height))
|
||||
return Rectangle(
|
||||
bottomLeft.x,
|
||||
|
@ -11,16 +11,17 @@ import com.badlogic.gdx.scenes.scene2d.Actor
|
||||
import com.badlogic.gdx.scenes.scene2d.InputEvent
|
||||
import com.badlogic.gdx.scenes.scene2d.InputListener
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.dev.FasterUIDevelopment.DevElement
|
||||
import com.unciv.logic.files.UncivFiles
|
||||
import com.unciv.logic.multiplayer.throttle
|
||||
import com.unciv.ui.components.FontFamilyData
|
||||
import com.unciv.ui.components.FontImplementation
|
||||
import com.unciv.ui.components.Fonts
|
||||
import com.unciv.ui.components.extensions.center
|
||||
import com.unciv.ui.components.extensions.toLabel
|
||||
import com.unciv.ui.images.ImageGetter
|
||||
import com.unciv.ui.images.ImageWithCustomSize
|
||||
import com.unciv.ui.screens.basescreen.BaseScreen
|
||||
import com.unciv.ui.components.FontFamilyData
|
||||
import com.unciv.ui.components.Fonts
|
||||
import com.unciv.ui.components.FontImplementation
|
||||
import com.unciv.ui.components.extensions.center
|
||||
import com.unciv.ui.components.extensions.toLabel
|
||||
import com.unciv.utils.Concurrency
|
||||
import java.awt.Font
|
||||
import java.awt.RenderingHints
|
||||
@ -109,7 +110,7 @@ object FasterUIDevelopment {
|
||||
fun addBorder(actor: Actor, color: Color) {
|
||||
val border = ImageWithCustomSize(skinStrings.getUiBackground("", tintColor = color))
|
||||
border.zIndex = curBorderZ++
|
||||
val stageCoords = actor.localToStageCoordinates(Vector2.Zero)
|
||||
val stageCoords = actor.localToStageCoordinates(Vector2.Zero.cpy())
|
||||
border.x = stageCoords.x - 1
|
||||
border.y = stageCoords.y - 1
|
||||
border.width = actor.width + 2
|
||||
|
Loading…
Reference in New Issue
Block a user