Skip to content

fix: dispatch mouseLeave to the tracked widget on chart leave - #848

Open
NemeZZiZZ wants to merge 1 commit into
klinecharts:mainfrom
NemeZZiZZ:fix/mouseleave-widget-dispatch
Open

fix: dispatch mouseLeave to the tracked widget on chart leave#848
NemeZZiZZ wants to merge 1 commit into
klinecharts:mainfrom
NemeZZiZZ:fix/mouseleave-widget-dispatch

Conversation

@NemeZZiZZ

Copy link
Copy Markdown
Contributor

Problem

Event.mouseLeaveEvent (the chart-level leave, fired from the container's mouseleave) clears the crosshair but never tells the tracked widget that the pointer left:

mouseLeaveEvent(): boolean {
  this._chart.getChartStore().setCrosshair()
  return true
}

Meanwhile mouseMoveEvent maintains _mouseMoveTriggerWidgetInfo and dispatches mouseEnterEvent/mouseLeaveEvent to widgets as the pointer moves between them (Event.ts:352-356) — but on leaving the whole chart, that machinery is skipped.

Impact

SeparatorWidget._mouseLeaveEvent is the only place that restores the separator's background to transparent. Hover a pane separator and move the cursor out of the chart: the separator stays highlighted. _mouseMoveTriggerWidgetInfo also goes stale, so re-entering the same widget does not re-fire mouseEnterEvent (the widget still believes the pointer is inside).

Fix

Before clearing the crosshair, dispatch mouseLeaveEvent to the tracked widget (with a widget-local event, via _makeWidgetEvent) and reset _mouseMoveTriggerWidgetInfo — mirroring the move path. The method now accepts the compat event EventHandler already passes to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant