Skip to content

Commit

Permalink
fix: Don't show the device menu icon unless the row is highlighted (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbmorley authored Oct 17, 2022
1 parent f229a8e commit fc80977
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion macos/TinyBoard/Views/DeviceRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ struct DeviceRow: View {

@ObservedObject var device: Device

@State var hover = false

var body: some View {
Button {
guard !device.isConnected else {
Expand All @@ -47,7 +49,7 @@ struct DeviceRow: View {
}
Text(device.name)
Spacer()
if device.isConnected {
if device.isConnected && hover {
Menu {
Toggle("Send Key Events", isOn: $device.isEnabled)
Divider()
Expand All @@ -62,6 +64,9 @@ struct DeviceRow: View {
}
}
}
.onHover { hover in
self.hover = hover
}
.buttonStyle(MenuItemButtonStyle())
}

Expand Down

0 comments on commit fc80977

Please sign in to comment.