On Hover over the cell view, it is showing clear button when mouse leaves the cell view and still hovering the clear button the table cell view is still in hover state i.e clear button is not removed . In my table view I have achieved the clear button using a custom view and its hover state using mouseEnter and mouseEnter functions. But as soon as I leave table cell view boundary. But it should not happen it my mouse pointer is still on clear button view and outside the table cell view the table cell view should be in hover state.
Code:
public func mouseEntered(in rowView: NSTableRowView)
{
showCellFrame(rowView: rowView)
//other handling
}
func showCellFrame(rowView: NSTableRowView) {
let cellFrame = tableView.frameOfCell(atColumn: 0, row: tableView.row(for: rowView))
let convertedFrame = tableView.convert(cellFrame, to: self)
hoveredRowIndex = tableView.row(for: rowView)
if !isRowPartiallyVisible(mouseInRow) || convertedFrame.minY < 72, (convertedFrame.minY + convertedFrame.height) < ((scrollView.contentView.frameHeight) + 10) {
showFloatingView(xValue: convertedFrame.minX + convertedFrame.width, yValue: (convertedFrame.minY + convertedFrame.height) - 8)
}
func showFloatingView(xValue : CGFloat, yValue: CGFloat) {
floatingView.frame.origin = CGPoint(x: xValue, y: yValue)
floatingView.isHidden = false
}
//Initialization
var floatingView: NSView = {
var view = NSView(frame: NSRect(x: 0, y: 0, width: 16, height: 16))
let shadow = NSShadow()
shadow.shadowColor = .black.withAlphaComponent(0.3)
shadow.shadowBlurRadius = 1.5
shadow.shadowOffset = NSMakeSize(0, -0.5)
view.shadow = shadow
return view
}()