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

Numbers on the sliders in QuickSettingView not centered #4941

Open
1 task done
uiryuu opened this issue May 24, 2024 · 1 comment
Open
1 task done

Numbers on the sliders in QuickSettingView not centered #4941

uiryuu opened this issue May 24, 2024 · 1 comment
Assignees
Labels
bug: hig Human Interface Guidelines Deviation feature: window

Comments

@uiryuu
Copy link
Member

uiryuu commented May 24, 2024

System and IINA version:

  • macOS 14.5 (23F79)
  • IINA 1.3.4

Expected behavior:
Numbers are centered to the knob in the slides.

Actual behavior:
Numbers are not centered. This is more obvious when the strings are short. Example:

image

This also effects other 2 sliders for delay:

image
image

Corresponding code for generating the constraint:

private func redraw(indicator: NSTextField, constraint: NSLayoutConstraint, slider: NSSlider, value: String) {
indicator.stringValue = value
let offset: CGFloat = 6
let sliderInnerWidth = slider.frame.width - offset * 2
constraint.constant = offset + sliderInnerWidth * CGFloat((slider.doubleValue - slider.minValue) / (slider.maxValue - slider.minValue))
view.layout()
}

My guess is that this piece of code used to work in older macOS version, but due to macOS UI updates, the offset (or width of the slider) changes, so it broke the UI. Manually subtracting 2 from constraint.constant seems fix the problem, but that introduces even more magic numbers.

Steps to reproduce:
Open quicksettingview and navigate to the related pages.

  • MPV does not have this problem.

How often does this happen?
Always.

@uiryuu uiryuu added feature: window bug: hig Human Interface Guidelines Deviation labels May 24, 2024
@low-batt
Copy link
Contributor

I noticed this when working on #4904, but did not address it. Was going to ask about it.

Details about the changes Apple made to sliders can be found here: macOS Big Sur changes for developers / Controls

The changes will need to be conditionalized to preserve the alignment in older macOS versions. This is what it looks like in macOS 10.15.7:
slider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: hig Human Interface Guidelines Deviation feature: window
Projects
None yet
Development

No branches or pull requests

3 participants