Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting of arbitrary viewport on initialization #800

Open
locomo opened this issue Mar 20, 2020 · 2 comments
Open

Allow setting of arbitrary viewport on initialization #800

locomo opened this issue Mar 20, 2020 · 2 comments

Comments

@locomo
Copy link

locomo commented Mar 20, 2020

Along the lines of this issue: #758

I'm wondering if it is currently possible (or if not, could it be a possible enhancement) to setup viewport position/dimensions when tooltipster gets initialized?

I understand that we can do this with functionPosition .. but this is fairly complex. It would be nice to just be able to specify either an element or specific dimensions during initialization and then just let tooltipster continue to do the heavy lifting of calculating tooltip position as normal.

My use case is that I need the tooltips to appear in side of a canvas element that is zoomable/draggable within my website layout.

thanks!

@louisameline
Copy link
Collaborator

Hello there! Thank you for your message.
This is feasible and should be made with the help of a plugin, because this is not a mainstream use case.
A plugin gets the proposed position in input, an may return a different position in output. So you'd want to write a plugin that would have an "arbitrary viewport" parameter, and that would make sure that the position returned is always within this viewport.
You can see how existing plugins were made, it's not hard.
If you write the plugin, we'll mention it in the documentation! Thank you

@locomo
Copy link
Author

locomo commented Mar 31, 2020

ok sounds good .. i'll take a stab at this

would you suggest i base my code on the '__reposition' function as a starting point for calculating position within the viewport?

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

No branches or pull requests

2 participants