calebjacob / tooltipster

A jQuery tooltip plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using an array for "options.distance" prevents the position of the tooltip to be correct

mcarlier-r7 opened this issue · comments

Hello,

First of all, thank you for your hard work on this plugin.

It seems that there is an issue with the calculation of the tooltip's position when the options.distance is an array.

Please take a look at those examples: https://jsfiddle.net/muhfv5gq/1/.
If the options.distance is an array of 4 items, or if it's an array of 3 or fewer items and any option is updated using .option(), the position of the tooltip is not calculated correctly.

It looks like it's related to this logic: https://github.com/iamceege/tooltipster/blob/f818f589de54165209756aa3319f49f841d708a2/src/js/plugins/tooltipster/sideTip/tooltipster-sideTip.js#L185-L197
If self.__options.distance has a length of 4, it doesn't get assigned to an object with the correct properties.

Thank you for looking into it!

I actually just had this same issue. It seems to work correctly if you define distance as an object like: distance: { top: 20, bottom: 20, left: -40, right: -110 }.

Thank you very much for your comments and for identifying the bad line.
It should be fixed now in v4.2.8.
Have a nice day!