fix(input): edited on-screen layouts keep their places and a 100% size leaves docked controls unchanged (#3322)

This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-27 04:40:57 -05:00
1 parent f0a4b084d9
commit c0506d53c9
2 files changed
+13 -4

No files matched your search

@@ -45,9 +45,8 @@ object OnScreenLayout {
if (buttonsOnly && dock == null) return generator.buttonsOnly(stored) + fit(stored.filter { it.alwaysShown }, reference.first, reference.second, width, height, safe)
if (dock?.portrait == true && !dock.grips && !matched && layout.aspect > 0f && layout.aspect < 1f && stored.any(::isGamepad))
return scaleDocked(context, cluster(stored.filterNot { it.alwaysShown || isGamepad(it) && (it.id == KEYBOARD_ID || it.control in BAR) }, layout.aspect, width, height, safe), ControllerPrefs.read(context).size / 100f, width, height, safe)
val oppositeOrientation = layout.aspect > 0f && ((layout.aspect < 1f) != (height > width))
val generated = matched ||
dock == null && oppositeOrientation && stored.any(::isGamepad)
val generated = matched || PadKit.forOverlay(context, layout) != null && stored.any(::isGamepad) &&
(dock != null || height > width && layout.aspect >= 1f || height <= width && layout.aspect > 0f && layout.aspect < 1f)
val gamepad = if (generated) stored.filter(::isGamepad) else emptyList()
val others = fit(stored.filterNot { generated && isGamepad(it) || dock != null && it.alwaysShown }, reference.first, reference.second, width, height, safe)
val regenerated = when {
@@ -96,7 +95,7 @@ object OnScreenLayout {
.coerceIn(leftBound, (rightBound - w).coerceAtLeast(leftBound))
val y = (element.y + element.height / 2f - h / 2f)
.coerceIn(topBound, (bottomBound - h).coerceAtLeast(topBound))
element.copy(x = x, y = y, width = w, height = h).bounded()
element.copy(x = x, y = y, width = w, height = h)
}.toMutableList()
if (scale > 1f) {
val gap = 4f / width