vega-tooltip icon indicating copy to clipboard operation
vega-tooltip copied to clipboard

Support preferred vertical and horizontal relative position used for the tooltip, if window width/height permits it

Open stenzengel opened this issue 2 years ago • 0 comments

It would be great to be able to specify the preferred vertical and/or horizontal relative position used for the tooltip, if the window width/height allows it.

Currently, if the inner width/height of the window allows it, the tooltip is displayed below and to the right of the cursor. Only if no space is available, the tooltip is displayed above and/or to the left of the cursor.

This can be uncomfortable, especially on a smartphone, where your finger often gets in the way.

I propose two news options to be able to specify the preferred vertical and horizontal position with the values above/below and left/right. The default values would remain as before.

defaults.ts:

export const DEFAULT_OPTIONS = {
  preferredHorizontalPosition: "right",
  preferredVerticalPosition: "below",
...
}

If you agree with this (or a similar) proposal, I would be happy to prepare a PR.

stenzengel avatar Feb 03 '23 13:02 stenzengel