Skip to content

fix: axis drag stops when cursor leaves the axis widget bounding box - #824

Open
dylansproule wants to merge 1 commit into
klinecharts:mainfrom
dylansproule:fix/axis-drag-capture
Open

fix: axis drag stops when cursor leaves the axis widget bounding box#824
dylansproule wants to merge 1 commit into
klinecharts:mainfrom
dylansproule:fix/axis-drag-capture

Conversation

@dylansproule

Copy link
Copy Markdown

Fixes #794

Problem

Dragging the X/Y axis to scroll or zoom stops as soon as the cursor moves outside the widget's bounding box, because the drag handlers are driven by _findWidgetByEvent in Event.ts, which only resolves a widget when the pointer is over it.

Change

Moved the axis drag scaling logic out of Event.ts into the axis widgets themselves (mirroring the existing SeparatorWidget pattern):

  • YAxisWidget now owns Y-axis drag scaling, manual-axis range sync, and the double-click reset (zoomYAxis / resetYAxisAndManualYAxes), registering mouseDownEvent / pressedMouseMoveEvent / mouseUpEvent handlers.
  • XAxisWidget now owns X-axis zoom-on-drag with the same handlers.
  • Event.ts routes X_AXIS/Y_AXIS mouse and touch down/move/up events through this._mouseDownWidget so the drag target is fixed at pointer-down and the handlers continue firing regardless of where the cursor is.
  • mouseWheelVertEvent and mouseDoubleClickEvent now delegate to the widget public methods.

Notes

  • _processMainScrollingEvent stays in Event.ts (MAIN widget behavior unchanged).
  • Lint and type-check pass.

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.

[Bug] Axis drag (Y/X) stops when cursor leaves the widget bounding box

2 participants