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

Tooltip is on wrong side of cursor #2717

Closed
a123qwertz567 opened this Issue Jun 12, 2017 · 6 comments

Comments

Projects
None yet
5 participants
@a123qwertz567

a123qwertz567 commented Jun 12, 2017

For me, the tooltip is on the wrong side of the cursor (right side on the image). Any way to toggle the location? Would be great to know what the building costs and consumes before building it :)

uh_tooltip1

@LinuxDonald

This comment has been minimized.

Show comment
Hide comment
@LinuxDonald

LinuxDonald Jun 12, 2017

Member

Yeah I have seen this bug too. We must fix that in the future.

Member

LinuxDonald commented Jun 12, 2017

Yeah I have seen this bug too. We must fix that in the future.

@LinuxDonald LinuxDonald added this to the 2017.3 milestone Jun 12, 2017

@LinuxDonald LinuxDonald added the A-gui label Jun 12, 2017

@squiddy squiddy added the B-bug label Jun 12, 2017

@AndyMender

This comment has been minimized.

Show comment
Hide comment
@AndyMender

AndyMender Jun 13, 2017

Member

@a123qwertz567 I'm afraid this might be a side-effect of disallowing tooltips to reposition upon mouse hover over a highlightable widget.

Member

AndyMender commented Jun 13, 2017

@a123qwertz567 I'm afraid this might be a side-effect of disallowing tooltips to reposition upon mouse hover over a highlightable widget.

@squiddy

This comment has been minimized.

Show comment
Hide comment
@squiddy

squiddy Jun 17, 2017

Member

I'll have a look at this.

Member

squiddy commented Jun 17, 2017

I'll have a look at this.

@squiddy squiddy self-assigned this Jun 17, 2017

@jmdejong

This comment has been minimized.

Show comment
Hide comment
@jmdejong

jmdejong Mar 26, 2018

Contributor

When close to the screen edge the tooltips are supposed to be on the left side of the cursor.

This code is responsible for that:

if (widget_position[0] + self.gui.size[0] + offset) > screen_width:

Unfortunately most of the time it doesn't work because the witdht of the tooltip gui (self.gui.size[0]) is set to 0.

I haven't been able to find out what is supposed to set this size, but I hope that someone who knows could figure that out.

Sometimes it does actually work (randomly).
It also works for the settlement names on the minimap.
Still, it first shows the tooltip on the wrong side, and later on the correct side.
Because of this I think this is indeed related to disallowing tooltips to reposition on mouse hover (at the initial placement the size is unknown, but when repositioning it is known).

Contributor

jmdejong commented Mar 26, 2018

When close to the screen edge the tooltips are supposed to be on the left side of the cursor.

This code is responsible for that:

if (widget_position[0] + self.gui.size[0] + offset) > screen_width:

Unfortunately most of the time it doesn't work because the witdht of the tooltip gui (self.gui.size[0]) is set to 0.

I haven't been able to find out what is supposed to set this size, but I hope that someone who knows could figure that out.

Sometimes it does actually work (randomly).
It also works for the settlement names on the minimap.
Still, it first shows the tooltip on the wrong side, and later on the correct side.
Because of this I think this is indeed related to disallowing tooltips to reposition on mouse hover (at the initial placement the size is unknown, but when repositioning it is known).

@AndyMender

This comment has been minimized.

Show comment
Hide comment
@AndyMender

AndyMender Mar 26, 2018

Member

I explicitly disabled tooltip repositioning on mouse hover some time ago, because it would crash Python (and effectively the game) very often. It's unfortunate, but that was the quickest solution. Increasing the cooldown between ON and OFF states did not help back then.

Unfortunately, there is a couple of limitations in our GUI we have to live with, I think.

Member

AndyMender commented Mar 26, 2018

I explicitly disabled tooltip repositioning on mouse hover some time ago, because it would crash Python (and effectively the game) very often. It's unfortunate, but that was the quickest solution. Increasing the cooldown between ON and OFF states did not help back then.

Unfortunately, there is a couple of limitations in our GUI we have to live with, I think.

jmdejong added a commit to jmdejong/unknown-horizons that referenced this issue Mar 26, 2018

Fix #2717 - tooltips are now on correct side of cursor
Tooltips were always shown right of the cursor, even when the cursor was too close to the right edge of the screen.
This is now fixed: when the tooltip would be out of the screen it is shown left of the cursor instead.
This is done by postponing positioning of the tooltip until its size is known.

jmdejong added a commit to jmdejong/unknown-horizons that referenced this issue Mar 26, 2018

fix tooltip positioning near edge (#2717)
Tooltips are now shown on the left of the cursor when they would otherwise be partly off-screen
These changes are much simpler than my earlier attempt to fix this.

AndyMender added a commit that referenced this issue Mar 26, 2018

Merge pull request #2780 from jmdejong/tooltipposition
Fix tooltip position when close to edge of screen (#2717)

jmdejong added a commit to jmdejong/unknown-horizons that referenced this issue Mar 26, 2018

always display the tooltip below the button (workaround for #2776)
Hovering a tooltip overlaying a button makes the button unclickable.
This fix makes sure that the tooltip doesn't overlay the button.

This commit does reintroduce #2717 though: tooltips can be partially off-screen

jmdejong added a commit to jmdejong/unknown-horizons that referenced this issue Mar 26, 2018

make sure tooltips aren't horizontally- off-screen (#2717)
Have a maximum and minimum x position so that the tooltips are always on the screen again.
Tooltips for buildings are still messed up.
@jmdejong

This comment has been minimized.

Show comment
Hide comment
@jmdejong

jmdejong Mar 27, 2018

Contributor

I have fixed this problem.

The code to position the tooltip was after the code that would set the size of the tooltip.
Turning these things around fixed it.

Since it's merged into master now I think this can be closed

Contributor

jmdejong commented Mar 27, 2018

I have fixed this problem.

The code to position the tooltip was after the code that would set the size of the tooltip.
Turning these things around fixed it.

Since it's merged into master now I think this can be closed

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