CtlCandidateTDK // Reset window origin on updateDisplay().

This commit is contained in:
ShikiSuen 2023-06-17 14:42:08 +08:00
parent 20368fcd91
commit e5c7505bdd
1 changed files with 19 additions and 13 deletions

View File

@ -106,6 +106,11 @@ public class CtlCandidateTDK: CtlCandidate, NSWindowDelegate {
} }
delegate?.candidatePairHighlightChanged(at: highlightedIndex) delegate?.candidatePairHighlightChanged(at: highlightedIndex)
DispatchQueue.main.async { [self] in DispatchQueue.main.async { [self] in
updateNSWindowModern(window)
}
}
func updateNSWindowModern(_ window: NSWindow) {
window.isOpaque = false window.isOpaque = false
window.backgroundColor = .clear window.backgroundColor = .clear
viewCheck: do { viewCheck: do {
@ -119,7 +124,7 @@ public class CtlCandidateTDK: CtlCandidate, NSWindowDelegate {
} }
window.contentView = Self.currentView window.contentView = Self.currentView
window.setContentSize(Self.currentView.fittingSize) window.setContentSize(Self.currentView.fittingSize)
} delegate?.resetCandidateWindowOrigin()
} }
func updateNSWindowLegacy(_ window: NSWindow) { func updateNSWindowLegacy(_ window: NSWindow) {
@ -139,6 +144,7 @@ public class CtlCandidateTDK: CtlCandidate, NSWindowDelegate {
Self.currentView.addSubview(viewToDraw) Self.currentView.addSubview(viewToDraw)
window.contentView = Self.currentView window.contentView = Self.currentView
window.setContentSize(outerSize) window.setContentSize(outerSize)
delegate?.resetCandidateWindowOrigin()
} }
override public func scrollWheel(with event: NSEvent) { override public func scrollWheel(with event: NSEvent) {