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

Is it possible to adjust the position of title or seekbar tooltip? #295

Closed
jiangzhenjerry opened this issue Jan 5, 2025 · 18 comments · Fixed by #298
Closed

Is it possible to adjust the position of title or seekbar tooltip? #295

jiangzhenjerry opened this issue Jan 5, 2025 · 18 comments · Fixed by #298
Labels
feature request New feature or request

Comments

@jiangzhenjerry
Copy link

Expected behavior of the wanted feature

For context, I'm using a 27" 4K monitor and I set the followings:

vidscale = "",
scalewindowed = 1.5,
scalefullscreen = 1.5,

For this setup, the minimum font size (for any element) for my comfortable viewing is 18. Therefore I change the tooltip font size to 18 (it used to follow time_font_size but it's separate now, which is fine and not the focus of this request.) However, the top of the seekbar tooltip overlaps with the title (Screenshot 1). Even if I change the tooltip font size to 16, it still looks off (Screenshot 2). And apparently, I'm too old for the default value of 14.

Can you point me as to where I can either move the tooltip down a little or move the title up a little? That'd make my day. Thanks.

Screenshot 1, where tooltip font size is set to be 18:
1

Screenshot 2, where tooltip font size is set to be 16:
2

@jiangzhenjerry jiangzhenjerry added the feature request New feature or request label Jan 5, 2025
@Samillion
Copy link
Owner

Samillion commented Jan 5, 2025

Adjust title height here:

ModernZ/modernz.lua

Lines 1722 to 1723 in 743f45d

-- Title
geo = {x = 25, y = refY - (chapter_index and 102 or 90), an = 1, w = osc_geo.w - 50 - (loop_button and 45 or 0) - (speed_button and 45 or 0), h = 35}

Specifically, in y = refY - (chapter_index and 102 or 90):

  • The 102 height refers to when a chapter title exists
  • 90 with no chapters (like your screenshots)

I've been trying to think of a way to scale for font size, like adding additional height/width. I can't think of something solid. Hopefully I will soon.

I'll try to look up used methods instead of re-inventing the wheel.

@Samillion
Copy link
Owner

Samillion commented Jan 5, 2025

There is a solution where it allows users to control, inspired by your request here, but I'm not sure if it's a viable one to be honest.

Adding height/size user options for elements that are affected by font size, so that you can adjust them in modernz.conf and it won't be affected by updates (ie: you don't have to change them every time you update).

Examples:

# these options are useful for adjusting elements display
# for example, when you use bigger font size
title_height=y
title_with_chapter_height=y
chapter_title_height=y
time_codes_height=y
tooltip_height=y

# depending on locale, if tooltip contains many characters, it is moved to the left
tooltip_left_offset=x

# when portrait window elements is triggered
time_codes_centered_height=y

# window width in pixels
portrait_window_trigger=950
hide_volume_bar_trigger=1150
# ...etc

@Samillion
Copy link
Owner

CC @Keith94 as he might be interested as well

@Samillion
Copy link
Owner

the tooltip font size to 18 (it used to follow time_font_size

Self reminder: add this back if the solution above is applied, or consider adding a tooltip_font_size option

@jiangzhenjerry
Copy link
Author

jiangzhenjerry commented Jan 5, 2025

Thank you very much! I don't really depend on modernz.conf because there are a few other things that I have to manually edit anyway (like the size of the mpv logo when idle). I can sleep well as long as I know where to edit the things I want.

Self reminder: add this back if the solution above is applied, or consider adding a tooltip_font_size option

If you ever decide to add this back, please consider surfacing chapter_title_font_size as well. It is also hard-coded as 14 as of now.

@Samillion
Copy link
Owner

If you ever decide to add this back, please consider surfacing chapter_title_font_size as well. It is also hard-coded as 14 as of now.

Will do.

I don't really depend on modernz.conf because there are a few other things that I have to manually edit anyway

Would the options I suggested help or be a hassle? Genuinely asking.

Also, I'd love to know any other elements you adjust based on font size, to list them with the options above.

@jiangzhenjerry
Copy link
Author

jiangzhenjerry commented Jan 5, 2025

Would the options I suggested help or be a hassle? Genuinely asking.

For me, it'd definitely be super helpful.

Also, I'd love to know any other elements you adjust based on font size, to list them with the options above.

I think you've covered it all. I'll keep you updated if I notice anything else.

@Keith94
Copy link
Contributor

Keith94 commented Jan 5, 2025

So the issue stems from a lack of visual separation between the two text elements.

Can you add a solid/semi-transparent background to the tooltip? Or add a thicker text outline to help it stand out more.

On a side note the top margin of the title should likely be increased anyway; it looks a bit misaligned compared to buttons below the seekbar but I'd have to check.

Would the options I suggested help or be a hassle? Genuinely asking.

Personally I would say these features are better handled by the script itself and not the user, that is unless another solution isn't found.

@Samillion
Copy link
Owner

Can you add a solid/semi-transparent background to the tooltip? Or add a thicker text outline to help it stand out more.

Good point, I'll tinker with that solution soon.

On a side note the top margin of the title should likely be increased anyway; it looks a bit misaligned compared to buttons below the seekbar but I'd have to check.

Sounds good. By any chance do you have a height suggestion for the default values?

Personally I would say these features are better handled by the script itself and not the user, that is unless another solution isn't found.

Agreed, but I think only because I rarely adjust the font size stuff, and I can't deny that there are scenarios where font size increase/decrease would make sense.

The suggestion basically adds a default value to these user options, so the script will manage them. Only adjusted when there is a scenario of different font type or size that cause overlap.

I honestly can't think of any other solution that would address all scales, sizes, window width, monitor realestate and so on. I'm not saying there isn't one, I just can't think of one lol.

@Keith94
Copy link
Contributor

Keith94 commented Jan 5, 2025

Sounds good. By any chance do you have a height suggestion for the default values?

Title

- geo = {x = 25, y = refY - (chapter_index and 102 or 90), an = 1, w = osc_geo.w - 50 - (loop_button and 45 or 0) - (speed_button and 45 or 0), h = 35}
+ geo = {x = 27, y = refY - (chapter_index and 108 or 96), an = 1, w = osc_geo.w - 50 - (loop_button and 45 or 0) - (speed_button and 45 or 0), h = 27}

Chapter Title

- lo.geometry = {x = 26, y = refY -87, an = 1, w = osc_geo.w / 2, h = 20}
+ lo.geometry = {x = 27, y = refY -91, an = 1, w = osc_geo.w / 2, h = 16}

I tried to adjust their x margins to better match the audio track button.

Reduced height because of the randomly huge hitboxes.
Should adjust osc_height_offset but I didn't fully understand how it works.

@Keith94
Copy link
Contributor

Keith94 commented Jan 6, 2025

play_pause should be changed from h = 45 to h = 28. It's too close to the timecode for vertical videos.

@Samillion
Copy link
Owner

Terribly sorry about the delay, I got myself stuck in an attempt to switch to Linux.

Will start working on this today.

@jiangzhenjerry
Copy link
Author

Thanks for the update and enjoy the Linux ride! Said a fan of rclone (but not so much of Fedora 🙄)

@Samillion
Copy link
Owner

Samillion commented Jan 8, 2025

Test script: elements_display/modernz.lua
Commit: 618d4a4

Changes:

  • Add chapter_title_font_size option
  • Add tooltip_font_size option
  • Apply title, chapter title and play button suggestions and fix by @Keith94
  • Add new elements position options
# Elements Position
# Useful when adjusting font size or type

# title height position above seekbar
title_height=96
# title height position if a chapter title is below it
title_with_chapter_height=108
# chapter title height position above seekbar
chapter_title_height=91
# time codes height position
time_codes_height=35
# time codes height position with portrait window
time_codes_centered_height=57
# tooltip height position offset
tooltip_height_offset=2
# if tooltip contains many characters, it is moved to the left by offset
tooltip_left_offset=3
# if cache speed is enabled, adjust the main tooltip for cache
tooltip_cache_speed_offset=5
# portrait window width trigger to move some elements
portrait_window_trigger=930
# hide volume bar trigger window width
hide_volume_bar_trigger=1150

@Samillion
Copy link
Owner

Please let me know if all works well or if there is anything that needs adjusting.

The main idea behind this PR is to give the user reasonable control when adjusting font size and type for elements display and position.

@jiangzhenjerry
Copy link
Author

Did a quick test (with most but not all added options) and it seems fine. Thanks!

@Samillion
Copy link
Owner

Updated: elements_display/modernz.lua
Commits:

Changes:

  • Adjusted osc_height_offset to match recent changes.
  • Added more element display and position options
# osc height offset if title above seekbar is disabled
notitle_osc_h_offset=25
# osc height offset if chapter title is disabled or doesn't exist
nochapter_osc_h_offset=10
# seek hover timecodes tooltip height position offset
seek_hover_tooltip_h_offset=0

@Samillion
Copy link
Owner

Samillion commented Jan 10, 2025

Updated: elements_display/modernz.lua
Commits: d48a6a5 - b57eeb8 - 1fcc12f

Changes:

  • Add osc_height option
  • Adjust default values for title and chapter title offsets
  • Match title and chapter title height with their font size for a more accurate hitbox
# osc height offset if title above seekbar is disabled
notitle_osc_h_offset=25
# osc height offset if chapter title is disabled or doesn't exist
nochapter_osc_h_offset=10
# osc height without offsets
osc_height=132

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

Successfully merging a pull request may close this issue.

3 participants