-
Notifications
You must be signed in to change notification settings - Fork 36
actual pixel perfect borders (with mouseanchor) #47
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
Conversation
|
I applied the following modifications to your PR:
Background to this: This workaround actually is only necessary for the tooltip border. The mouse offset does not necessarily have to be pixel-perfect, because this isn't visually noticeable. Additionally I added an option for this, because this is only necessary for solid borders and not for "normal" border textures e.g. the default tooltip border. I think I push out a new release tomorrow with the latest fixes. After that, I continue with the next PR (#48). Again: Thank you for your input here! Without it, the pixel-perfect-border-issue would still be unsolved. 😉 |
|
It is absolutely necessary to also convert the mouse offsets, I tested it out. Otherwise either the border will be 0/2px sometimes, or the text inside will jump around very slightly on movement. It makes sense when you think about it, because without converting, you are positioning the tooltip in a non-pixelperfect position. The same thing is the case with the itemicon and auraicons in the other PR, if you don't convert it they will be positioned incorrectly even though the main tooltip is perfect, because the offsets wouldn't be. |
|
But what if the tooltip isn't mouse anchored? I think that by default the textures are snapped to pixel grid. There's a function to disable this on demand: https://www.townlong-yak.com/framexml/live/NineSlice.lua#185 During my tests, I had no problems with a 1-pixel border (under 1920x1080). |
|
It only matters if it's mouse anchored, yes |
|
I would be interested in how the current version performs in your case with regard to the tooltip borders. Can you perhaps make a test with the current version in main branch? I think that's a really interesting topic. 🙂 |
|
Sure, I made a small video for you. First it shows current mainbranch, then after a reload it shows mainbranch with the mouse offsets sent through GetNearestPixelSize(). https://files.catbox.moe/mnmau3.mp4 As you can see, the text inside sometimes jumps one pixel forward even though the tooltip itself doesn't. After the conversion it moves perfectly. Edit: it does not seem to happen at 1080p, but that's just coincidence. |
|
After testing things from the other PR again, the conversion for the itemicon is unnecessary and I removed it. For the auraicons it's mainly needed because they usually are very small, and without converting them the errors will pile up resulting in uneven gaps that look ugly: As you can see sometimes the gap is 2 pixels, sometimes it's 3 because of errors adding up (because they are anchored in a chain). Also, for such small icons, you really want to be able to position and define offsets pixel-perfect, which you won't be able to if you don't convert them. For example you might not be able to get a 3 pixel gap because "2" will result in a 2-real-pixel gap and "3" will result in a 4-real-pixel gap. This example with the aura icons would also apply to non-mouseanchored tooltips I believe. For a truly pixel-perfect tooltip you definitely want to convert the offsets. The "normal" way to do all this, which wouldn't require any conversions of offsets is to set the scale of the tooltip itself with gtt:SetScale(ppScale), and children would then inherit that and be perfectly positioned automatically, but I ran into some problems with that because tooltips are so weird in this game. |
|
So, I've tinkered with this issue again quite extensively and have made the following modifications:
Finally, I have optimized the code a bit to prevent multiple calculations (e.g. mouse offsets snapping to pixel grid). I think I have tested all possible combinations/situations with 1 and 2 pixel borders. If this is also ok for you, I would push out a new release, because there were already 2 issues to bugs that have already been fixed. 🙈 |
|
Yes, mainbranch now works perfectly on 1440p. |
|
It's done: https://github.com/frozn/TipTac/releases/tag/v22.02.19 Next step: item/aura icon with optional (pixel perfect) border and clamping to screen 💪 |


So, the current and former versions didn't have pixel perfect borders for me by default (1440p resolution). I tried the approach I use for some of my WeakAuras, and with this I get pixel perfect borders on every resolution, in every situation I tried (even randomly resizing in windowed mode (after a /reload ofc)). Theres also no text jumping when moving the mouse.
Please test it yourself and see if you can find any edge cases, otherwise I think this is better than the current approach.