mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-12-05 13:07:33 +01:00
bug fixes around keymap
This commit is contained in:
@@ -49,7 +49,7 @@ abstract class BaseDevice {
|
||||
|
||||
String get name => _name ?? runtimeType.toString();
|
||||
|
||||
String get buttonExplanation => 'Click a button on this device to configure them.';
|
||||
String get buttonExplanation => isConnected ? 'Connecting...' : 'Click a button on this device to configure them.';
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
|
||||
@@ -296,6 +296,8 @@ class _TouchAreaSetupPageState extends State<TouchAreaSetupPage> {
|
||||
final relativeX = ((newPos.dx - _imageRect.left) / _imageRect.width).clamp(0.0, 1.0);
|
||||
final relativeY = ((newPos.dy - _imageRect.top) / _imageRect.height).clamp(0.0, 1.0);
|
||||
keyPair.touchPosition = Offset(relativeX * 100.0, relativeY * 100.0);
|
||||
keyPair.inGameAction = null;
|
||||
keyPair.inGameActionValue = null;
|
||||
setState(() {});
|
||||
},
|
||||
color: Colors.red,
|
||||
|
||||
@@ -104,14 +104,17 @@ class Keymap {
|
||||
void addNewButtons(List<ControllerButton> availableButtons) {
|
||||
final newButtons = availableButtons.filter((button) => getKeyPair(button) == null);
|
||||
for (final button in newButtons) {
|
||||
final buttonFromBase = core.settings.getTrainerApp()?.keymap.getKeyPair(button);
|
||||
addKeyPair(
|
||||
KeyPair(
|
||||
touchPosition: Offset.zero,
|
||||
touchPosition: buttonFromBase?.touchPosition ?? Offset.zero,
|
||||
buttons: [button],
|
||||
inGameAction: button.action,
|
||||
physicalKey: null,
|
||||
logicalKey: null,
|
||||
isLongPress: false,
|
||||
physicalKey: buttonFromBase?.physicalKey,
|
||||
logicalKey: buttonFromBase?.logicalKey,
|
||||
isLongPress: buttonFromBase?.isLongPress ?? false,
|
||||
inGameActionValue: buttonFromBase?.inGameActionValue,
|
||||
androidAction: buttonFromBase?.androidAction,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -247,7 +250,7 @@ class KeyPair {
|
||||
: (physicalKey != null && core.actionHandler.supportedModes.contains(SupportedMode.keyboard))
|
||||
? null
|
||||
: (touchPosition != Offset.zero && core.logic.showLocalRemoteOptions)
|
||||
? 'X:${touchPosition.dx.toInt()}, Y:${touchPosition.dy.toInt()}'
|
||||
? 'X:${touchPosition.dx.toInt()}, Y:${touchPosition.dy.toInt()}${inGameAction != null ? ' (${inGameAction!.title})' : ''}'
|
||||
: '';
|
||||
if (text != null && text.isNotEmpty) {
|
||||
return text;
|
||||
|
||||
@@ -101,9 +101,9 @@ class _KeymapExplanationState extends State<KeymapExplanation> {
|
||||
for (final devicePair in keyButtonMap.entries) ...[
|
||||
SizedBox(height: 12),
|
||||
ColoredTitle(text: devicePair.key.toString()),
|
||||
if (devicePair.value.isEmpty && devicePair.key.buttonExplanation != null)
|
||||
if (devicePair.value.isEmpty)
|
||||
Text(
|
||||
devicePair.key.buttonExplanation!,
|
||||
devicePair.key.buttonExplanation,
|
||||
style: TextStyle(height: 1),
|
||||
).muted,
|
||||
for (final keyPair in devicePair.value) ...[
|
||||
|
||||
Reference in New Issue
Block a user