CtlCandidateTDK // Use round candidate window.
This commit is contained in:
parent
4676c995ce
commit
b5abb2db4e
|
@ -63,7 +63,6 @@ public class CtlCandidateTDK: CtlCandidate {
|
|||
panel.hasShadow = true
|
||||
panel.isOpaque = false
|
||||
panel.backgroundColor = NSColor.clear
|
||||
|
||||
contentRect.origin = NSPoint.zero
|
||||
|
||||
super.init(layout)
|
||||
|
@ -104,33 +103,34 @@ public class CtlCandidateTDK: CtlCandidate {
|
|||
}
|
||||
|
||||
override open func updateDisplay() {
|
||||
guard let window = window else { return }
|
||||
switch currentLayout {
|
||||
case .horizontal:
|
||||
DispatchQueue.main.async { [self] in
|
||||
if #available(macOS 12, *) {
|
||||
let newView = NSHostingView(rootView: theViewHorizontal)
|
||||
let newView = NSHostingView(rootView: theViewHorizontal.edgesIgnoringSafeArea(.top))
|
||||
let newSize = newView.fittingSize
|
||||
window?.contentView = newView
|
||||
window?.setContentSize(newSize)
|
||||
window.contentView = newView
|
||||
window.setContentSize(newSize)
|
||||
} else {
|
||||
let newView = NSHostingView(rootView: theViewHorizontalBackports)
|
||||
let newView = NSHostingView(rootView: theViewHorizontalBackports.edgesIgnoringSafeArea(.top))
|
||||
let newSize = newView.fittingSize
|
||||
window?.contentView = newView
|
||||
window?.setContentSize(newSize)
|
||||
window.contentView = newView
|
||||
window.setContentSize(newSize)
|
||||
}
|
||||
}
|
||||
case .vertical:
|
||||
DispatchQueue.main.async { [self] in
|
||||
if #available(macOS 12, *) {
|
||||
let newView = NSHostingView(rootView: theViewVertical)
|
||||
let newView = NSHostingView(rootView: theViewVertical.edgesIgnoringSafeArea(.top))
|
||||
let newSize = newView.fittingSize
|
||||
window?.contentView = newView
|
||||
window?.setContentSize(newSize)
|
||||
window.contentView = newView
|
||||
window.setContentSize(newSize)
|
||||
} else {
|
||||
let newView = NSHostingView(rootView: theViewVerticalBackports)
|
||||
let newView = NSHostingView(rootView: theViewVerticalBackports.edgesIgnoringSafeArea(.top))
|
||||
let newSize = newView.fittingSize
|
||||
window?.contentView = newView
|
||||
window?.setContentSize(newSize)
|
||||
window.contentView = newView
|
||||
window.setContentSize(newSize)
|
||||
}
|
||||
}
|
||||
@unknown default:
|
||||
|
|
|
@ -100,11 +100,13 @@ public struct VwrCandidateHorizontal: View {
|
|||
.lineLimit(
|
||||
1)
|
||||
}
|
||||
.padding(6).foregroundColor(
|
||||
.padding(7).foregroundColor(
|
||||
.init(nsColor: tooltip.isEmpty ? .controlTextColor : .selectedMenuItemTextColor.withAlphaComponent(0.9))
|
||||
)
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
.frame(minWidth: thePool.maxWindowWidth, maxWidth: thePool.maxWindowWidth)
|
||||
.cornerRadius(10)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,10 +105,11 @@ public struct VwrCandidateVertical: View {
|
|||
.lineLimit(
|
||||
1)
|
||||
}
|
||||
.padding(6).foregroundColor(
|
||||
.padding(7).foregroundColor(
|
||||
.init(nsColor: tooltip.isEmpty ? .controlTextColor : .selectedMenuItemTextColor.withAlphaComponent(0.9))
|
||||
)
|
||||
}
|
||||
}
|
||||
.cornerRadius(10)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,11 +105,13 @@ public struct VwrCandidateHorizontalBackports: View {
|
|||
.lineLimit(
|
||||
1)
|
||||
}
|
||||
.padding(6).foregroundColor(
|
||||
.padding(7).foregroundColor(
|
||||
tooltip.isEmpty && colorScheme == .light ? Color(white: 0.1) : Color(white: 0.9)
|
||||
)
|
||||
}
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
}
|
||||
.frame(minWidth: thePool.maxWindowWidth, maxWidth: thePool.maxWindowWidth)
|
||||
.cornerRadius(10)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,10 +110,11 @@ public struct VwrCandidateVerticalBackports: View {
|
|||
.lineLimit(
|
||||
1)
|
||||
}
|
||||
.padding(6).foregroundColor(
|
||||
.padding(7).foregroundColor(
|
||||
tooltip.isEmpty && colorScheme == .light ? Color(white: 0.1) : Color(white: 0.9)
|
||||
)
|
||||
}
|
||||
}
|
||||
.cornerRadius(10)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue