Fixes button state on Extension Help View

This commit is contained in:
Stuart Breckenridge 2020-11-19 12:04:43 +08:00
parent 015ee0a8e0
commit f4fe19ae90
1 changed files with 9 additions and 16 deletions

View File

@ -26,22 +26,15 @@ struct EnableExtensionPointHelpView: View {
VStack { VStack {
HStack { HStack {
ForEach(0..<extensionPoints.count, content: { i in ForEach(0..<extensionPoints.count, content: { i in
Button(action: {
preferencesController?.enableExtensionPointFromSelection(extensionPoints[i])
hoveringId = nil
}, label: {
Image(nsImage: extensionPoints[i].image) Image(nsImage: extensionPoints[i].image)
.resizable() .resizable()
.frame(width: 20, height: 20, alignment: .center) .frame(width: 20, height: 20, alignment: .center)
.onTapGesture {
preferencesController?.enableExtensionPointFromSelection(extensionPoints[i])
hoveringId = nil
}
.onHover(perform: { hovering in
if hovering {
hoveringId = extensionPoints[i].title
} else {
hoveringId = nil
}
}) })
.scaleEffect(hoveringId == extensionPoints[i].title ? 1.2 : 1) .buttonStyle(PlainButtonStyle())
.shadow(radius: hoveringId == extensionPoints[i].title ? 0.8 : 0)
}) })
if ExtensionPointManager.shared.availableExtensionPointTypes.count == 0 { if ExtensionPointManager.shared.availableExtensionPointTypes.count == 0 {