|
@@ -103,27 +103,29 @@ import AppKit
|
|
|
}
|
|
|
|
|
|
func showToolTips(_ isMode: Bool = false) {
|
|
|
-
|
|
|
- var point = self.convert(self.contentView.frame.origin, to: self.window?.contentView)
|
|
|
- point.y += CGRectGetHeight(self.frame)
|
|
|
-
|
|
|
- if toolTipView == nil {
|
|
|
- toolTipView = ComponentToolTip()
|
|
|
- }
|
|
|
- let properties: ComponentTooltipProperty = ComponentTooltipProperty(arrowPosition: .bottom_Center,
|
|
|
- title: self.toolTipString ?? "")
|
|
|
-
|
|
|
- toolTipView?.properties = properties
|
|
|
-
|
|
|
- if let tipView = toolTipView {
|
|
|
- point.x += CGRectGetWidth(self.frame)/2
|
|
|
- point.x -= CGRectGetWidth(tipView.frame)/2
|
|
|
+ if let string = toolTipString, string.count > 0 {
|
|
|
+ var point = self.convert(self.contentView.frame.origin, to: self.window?.contentView)
|
|
|
+ point.y += CGRectGetHeight(self.frame)
|
|
|
+
|
|
|
+ if toolTipView == nil {
|
|
|
+ toolTipView = ComponentToolTip()
|
|
|
+ }
|
|
|
+ let properties: ComponentTooltipProperty = ComponentTooltipProperty(arrowPosition: .bottom_Center,
|
|
|
+ title: self.toolTipString ?? "")
|
|
|
+
|
|
|
+ toolTipView?.properties = properties
|
|
|
+
|
|
|
+ if let tipView = toolTipView {
|
|
|
+ point.x += CGRectGetWidth(self.frame)/2
|
|
|
+ point.x -= CGRectGetWidth(tipView.frame)/2
|
|
|
+ }
|
|
|
+ toolTipView?.showWithPoint(point, inView: self.window?.contentView)
|
|
|
+
|
|
|
+ // if isMode {
|
|
|
+ // ComponentManager.manager.isTooltipMode = true
|
|
|
+ // }
|
|
|
+
|
|
|
}
|
|
|
- toolTipView?.showWithPoint(point, inView: self.window?.contentView)
|
|
|
-
|
|
|
-// if isMode {
|
|
|
-// ComponentManager.manager.isTooltipMode = true
|
|
|
-// }
|
|
|
}
|
|
|
|
|
|
func hideToolTips() {
|
|
@@ -136,7 +138,7 @@ import AppKit
|
|
|
public override func mouseEntered(with event: NSEvent) {
|
|
|
super.mouseEntered(with: event)
|
|
|
|
|
|
- if self.toolTipString != nil {
|
|
|
+ if let string = toolTipString, string.count > 0 {
|
|
|
//Tooltips
|
|
|
let newWorkItem = DispatchWorkItem {
|
|
|
self.showToolTips(true)
|
|
@@ -160,7 +162,7 @@ import AppKit
|
|
|
public override func mouseExited(with event: NSEvent) {
|
|
|
super.mouseExited(with: event)
|
|
|
|
|
|
- if toolTipString != nil {
|
|
|
+ if let string = toolTipString, string.count > 0 {
|
|
|
workItem.cancel()
|
|
|
|
|
|
hideToolTips()
|