mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 06:15:58 +00:00
feat(input): controller-specific on-screen controls with editor, rotation and tablet fixes (#2988)
* feat(input): restore controller-specific overlay designs * fix(input): restore portrait controller layouts * fix(input): fix duplicates, rotation and tablet placement in the controller overlays - Hide the below-game controls while the layout editor is open, and give the editor the same cutout insets and optional Steam controls as the game view, so the editor never shows a second copy of a control. - Keep a separate portrait frame for layouts edited in portrait. A layout edited in one orientation keeps the stock kit positions in the other instead of being stretched across. - Anchor the overlay to the bottom of the screen and cap the portrait panel's physical size, so tablets keep the controls in the lower half. - Put L2/L1 and R1/R2 side by side in every kit. - List deleted stock controls in the editor's Add dialog so they can be restored, and keep removed rear buttons and trackpads removed. * fix(input): scale edited overlay layouts around the controller artwork positions * fix(input): keep stock landscape controls, color setting, keyboard action and displayed frame edits consistent * fix(input): draw the layout editor with the kit artwork at the size it will be saved The editor placed its controls in onSizeChanged, which runs during layout, so the preview canvas was rebuilt or remeasured too late: new controls were laid out at 0x0 and existing ones kept stale sizes, losing the kit D-pad artwork. Placement now happens in onMeasure, before the canvas measures its children. The editor preview used the saved button size instead of the slider value, so the slider showed a different layout from the one Done saved. D-pad pieces that joined or left the kit cross were never redrawn, so moving one piece hid all four. * fix(input): keep portrait rear buttons and trackpads where they were saved A portrait save stores the rear buttons and trackpads only in the rotated frame, but loading that frame only moved controls that already existed in the main frame, so they were regenerated at the screen edges. * fix(input): adopt the displayed portrait frame for layouts edited only in landscape Button size and reset positions now switch to the frame on screen whenever the edited layout's orientation differs from the editor, not only when a rotated frame exists, so a portrait change is saved as the portrait frame instead of overwriting the landscape edits. The tools panel stays open while that happens. * fix(input): keep a separate button size for the rotated frame * fix(input): take the shown frame's button size whenever editing switches orientation --------- Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
This commit is contained in:
1 parent
183cbd9351
commit
378175c6ac
22 files changed
+1345
-426
No files matched your search
@@ -1752,6 +1752,8 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
com.droiddeck.launcher.session.InputSysfsComponent.padTypeChanged(SessionPrefs.padType(id))
|
||||
padType = id
|
||||
onScreenControls?.reload()
|
||||
applyUnfoldedControls()
|
||||
unfoldedPanel?.reload()
|
||||
bottomInputControls?.reload()
|
||||
},
|
||||
backHold = backHold,
|
||||
@@ -4629,7 +4631,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
else "unfolded controls: game full screen")
|
||||
}
|
||||
val portrait = !com.droiddeck.launcher.session.SessionDisplay.foldable(this)
|
||||
val dock = if (SessionState.deckPad) com.droiddeck.launcher.input.OnScreenLayout.Dock.deck(portrait, deckPanelLayouts[com.droiddeck.launcher.input.DeckPanel.GAMEPAD])
|
||||
val kit = com.droiddeck.launcher.input.PadKit.forOverlay(this, primaryInputLayout)
|
||||
val dock = if (SessionState.deckPad && kit?.steam != false)
|
||||
com.droiddeck.launcher.input.OnScreenLayout.Dock.deck(portrait, deckPanelLayouts[com.droiddeck.launcher.input.DeckPanel.GAMEPAD])
|
||||
else com.droiddeck.launcher.input.OnScreenLayout.Dock(portrait, false)
|
||||
var panel = unfoldedPanel
|
||||
if (panel != null && (!wanted || panel.dock != dock)) {
|
||||
@@ -5510,6 +5514,10 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde
|
||||
.takeIf { it.isFile }
|
||||
?.let { FileUtils.readString(it)?.trim()?.lowercase() }
|
||||
?: SessionPrefs.oscMode(this, SessionState.mode == SessionService.MODE_STEAM)
|
||||
unfoldedColumn?.let { column ->
|
||||
val shown = if (inputSettingsOpen) View.INVISIBLE else View.VISIBLE
|
||||
if (column.visibility != shown) { unfoldedPanel?.releaseAll(); unfoldedDeckSurface?.releaseInputs(); column.visibility = shown }
|
||||
}
|
||||
val controls = onScreenControls ?: return
|
||||
fun showPinned() {
|
||||
controls.setPinnedOnly(true)
|
||||
|
||||
Reference in new issue
Block a user