Skip to content

Commit f485f78

Browse files
authored
CATROID-1613 Fix ColorDetection ignoring z-index (#5041)
1 parent a48e805 commit f485f78

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

catroid/src/main/java/org/catrobat/catroid/sensing/ColorAtXYDetection.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ class ColorAtXYDetection(
186186
}
187187

188188
private fun rgbaColorToRGBHexString(color: Color): String =
189-
COLOR_HEX_PREFIX + color.toString().substring(RGBA_START_INDEX, RGBA_END_INDEX)
189+
COLOR_HEX_PREFIX + color.toString().substring(RGBA_START_INDEX, RGBA_END_INDEX).uppercase()
190190

191191
private fun argbColorToRGBHexString(color: Color): String =
192-
COLOR_HEX_PREFIX + color.toString().substring(ARGB_START_INDEX, ARGB_END_INDEX)
192+
COLOR_HEX_PREFIX + color.toString().substring(ARGB_START_INDEX, ARGB_END_INDEX).uppercase()
193193

194194
private fun convertStageToBitmapCoordinate(
195195
position: Int,

catroid/src/main/java/org/catrobat/catroid/sensing/ColorDetection.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ abstract class ColorDetection(
8585
}
8686

8787
private fun drawSprites(lookList: List<Look>, batch: SpriteBatch) {
88-
lookList.forEach { it.draw(batch, 1f) }
88+
val sortedLookList = lookList.sortedBy { it.zIndex }
89+
sortedLookList.forEach { it.draw(batch, 1f) }
8990
}
9091

9192
protected fun createViewport(

0 commit comments

Comments
 (0)