Skip to content

Improve resize on tooltip content change - use appropriate corner to pin tooltip, depending on gravity #31

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

Closed
puzrin opened this issue Aug 31, 2012 · 9 comments
Assignees
Labels
Feature Software improvements that involve implementing new features.
Milestone

Comments

@puzrin
Copy link

puzrin commented Aug 31, 2012

This issue is followup to #27.

Pinning point should be selected, depending on popover location. Then, if content grows, popover will change in proper direction without additional position recalulation.

1. Use-case for corners:

example

We load content in 2 stages:

  • show dummy popup with "loading" progress
  • substitute content

If popup grows on second step, then it overlap link (now). So, now we have to call recacculation, to move it up. But if you pin popup with bottom left corner, then it will automatically extend in proper direction (up and right).

IMHO, in practice, it would be very convenient to select "proper" pinned corner for each gravity option. Then it will change inproper direction without additional JS call.

2. Comments about side-placed (left-right-top-bottom) popups:

For side-placed tooltip there are no unique pinning solution. But it's limited to 2 possible choices, instead of 4. I don't have strong opinion, how to choose the best corner of 2.

IMHO, rigth now you can select any of 2, and if someone will have the real case in practice, then you could improve it. IMHO, if someone have top or bottom placed popup, he will fix width. Then content change will only affect height - no problem.

@stevenbenner
Copy link
Owner

This is on the to-do. Thanks for creating the issue!

@stevenbenner
Copy link
Owner

I've started working on this, and it has become apparent that using the bottom CSS attribute makes PowerTip vastly more vulnerable to body tag styling.

Because of the static position of the body tag, and the way it inherits the unique properties of the html tag, the bottom attribute for a child of body is relative to the window height. For example, setting bottom to 0px on a completely un-styled body tag will result in the element being placed at a position of however tall the view port is, not however tall the document is. (See: example)

This means that if anyone sets the position on the body tag to relative (or fixed, or absolute) it will totally break tooltip positioning.

Styling the body tag can already have some negative effects on tooltip placement, but none so devastating or difficult for a developer implementing PowerTip to diagnose.

I'm debating whether this is worth the risk.

@puzrin
Copy link
Author

puzrin commented Sep 7, 2012

Got your point. Honestly, i'm not enougth competent, to guarantee good solution without risks. I think, it's better to postpone this issues to next milestone. May be, after 1-2 months we'll get better ideas, or someone with stronger experiance will decide to help.

@stevenbenner
Copy link
Owner

Update on this issue: The tooltip positioning was changed to use right positioning for w, nw, sw, ne-alt, and se-alt in commits f6b60c2 and 8be25f5.

stevenbenner referenced this issue Feb 26, 2013
stevenbenner added a commit that referenced this issue Feb 27, 2013
@ghost ghost assigned stevenbenner Mar 8, 2013
stevenbenner added a commit that referenced this issue Mar 30, 2013
stevenbenner added a commit that referenced this issue Mar 30, 2013
stevenbenner added a commit that referenced this issue Mar 30, 2013
stevenbenner added a commit that referenced this issue Mar 30, 2013
stevenbenner added a commit that referenced this issue Mar 30, 2013
stevenbenner added a commit that referenced this issue Mar 31, 2013
stevenbenner added a commit that referenced this issue Mar 31, 2013
@stevenbenner
Copy link
Owner

I decided to change northern tooltips (n, ne, nw, ne-alt, and nw-alt) to use bottom position after all. Tooltip placement is already vulnerable to problems if people set the position on the body tag to anything other than the default, there's just no way to work around that. So it just makes sense to use the most logical placement for each tooltip.

This task has been completed.

@puzrin
Copy link
Author

puzrin commented Mar 31, 2013

No problems. Steven, when do you plan tp release 1.2.0 ? I'd like to synk my codebase with latest version from bower

@stevenbenner
Copy link
Owner

@puzrin Soon. I'll probably tag and release it either today or tomorrow.

Also, since you're using bower I should let you know: The component that Bower will pull for version 1.2.0 won't include built or minified files. You'll have to npm install && grunt build:release on the downloaded component to get the dist/jquery.powertip.js file.

See the discussion in issue #54 for more.

@puzrin
Copy link
Author

puzrin commented Mar 31, 2013

That's ok. I need unpacked file indeed. Our project uses Mincer to care automatically about minification. So, bower is used to manage clienside scripts, like npm manages serverside. I know, that bower is not ideal, but it's much better than nothing :)

@stevenbenner
Copy link
Owner

@puzrin Well the PowerTip source code is split up into several files in the src folder, but you should be able to work around that. Let me know if you run into any problems and I'll be happy to offer any help I can.

And I do want PowerTip to work correctly with Bower. That project has a lot of potential, it just doesn't support projects structured like PowerTip (or jQuery). I should be able to fix PowerTip for Bower installs once Bower 0.9 is released.

jasco pushed a commit to jasco/jquery-powertip that referenced this issue Oct 17, 2016
As requested in stevenbenner#151 referencing issue stevenbenner#31 for rationale
jasco pushed a commit to jasco/jquery-powertip that referenced this issue Oct 17, 2016
As requested in stevenbenner#151 referencing issue stevenbenner#31 for rationale
jasco pushed a commit to jasco/jquery-powertip that referenced this issue Feb 14, 2017
As requested in stevenbenner#151 referencing issue stevenbenner#31 for rationale
jasco pushed a commit to jasco/jquery-powertip that referenced this issue Jun 16, 2017
As requested in stevenbenner#151 referencing issue stevenbenner#31 for rationale
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Software improvements that involve implementing new features.
Projects
None yet
Development

No branches or pull requests

2 participants