Skip to content

Fixes & improvements to Settings > UI > OSC toolbar preview & drag/drop #4165

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

Merged
merged 2 commits into from
Jul 8, 2024

Conversation

svobs
Copy link
Contributor

@svobs svobs commented Jan 8, 2023


Before:

OSC-DragAndDrop-Old.mp4

After:

OSC-DragAndDrop-New.mp4

Description:

Note: requires #4107 to be merged first.

The settings toolbar icon (looks more like a chat bubble to me) comes from the MacOS system icons, whereas all the other OSC toolbar icons are built into IINA. It looks like probably when Apple changed its icon, its displayed size got messed up in IINA. This fix started from an attempt to fix that, which was surprisingly challenging because I wanted to avoid hard-coding an icon size. Along the way I added some more improvements, detailed below.

The settings toolbar icon is drawn in 6 different places:

  1. The Player window
  2. Settings > UI > On Screen Controller > Toolbar preview
  3. Settings > UI > On Screen Controller > Toolbar > Customize window > Current Items view
  4. Settings > UI > On Screen Controller > Toolbar > Customize window > Available Items view
  5. Settings > UI > On Screen Controller > Toolbar > Customize window > Dragging from Current Items view
  6. Settings > UI > On Screen Controller > Toolbar > Customize window > Dragging from Available Items view

Only the 1st location was the correct size; the others were too big. It turns out that the Player window was drawing it inside of a button, which fixed its size; the others were just using naked NSImages.

My fix was to replace the naked images with "dead" buttons (disabled but not grayed out visually), which guarantees that the drawing will be the same.

  1. Fixed oversized settings toolbar icon so it matches the other icons.
  2. Color of dragged icon (items 5 and 6 above) was always black, which made it hard to see in Dark Mode. Changed it so that the color is light in Dark mode (& matches its non-dragged color).
  3. Changed drag start coordinates so that the icon does a move animation from its visual location to under the user's cursor.
  4. Added standard MacOS "poof" animation when dragging out of the toolbar.
  5. Generally improved the layout strategy of the toolbar icons so that they will be super robust to changes in icon size (and should make it much easier to swap the icons for different sizes in the future, if the desire ever arises.)

@svobs svobs force-pushed the pr-pref-osc-toolbar-fixes branch from 0195243 to a6ac95e Compare April 3, 2023 21:03
@svobs svobs force-pushed the pr-pref-osc-toolbar-fixes branch from a6ac95e to 28fc4ee Compare April 30, 2023 22:51
@svobs
Copy link
Contributor Author

svobs commented Apr 30, 2023

Updated to resolve conflicts

@svobs svobs force-pushed the pr-pref-osc-toolbar-fixes branch 2 times, most recently from 0e036ca to 935f616 Compare July 18, 2023 06:04
@svobs svobs force-pushed the pr-pref-osc-toolbar-fixes branch from 935f616 to 6c69507 Compare July 6, 2024 06:02
@svobs
Copy link
Contributor Author

svobs commented Jul 6, 2024

Rebased and fixed conflicts, improved layout further, improved commit message.

Copy link
Member

@lhc70000 lhc70000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, only have one small suggestion

svobs added 2 commits July 7, 2024 11:17
Details:
• Fix oversized Settings icon
• Fix incorrect color of dragged item in Dark Mode
• Improve drag start animation & add "poof" animation for items dragged
  out of toolbar
• Modify layout so that toolbar icons of any size above 8x can be used
  in the future
@svobs svobs force-pushed the pr-pref-osc-toolbar-fixes branch from 6c69507 to a9f741b Compare July 7, 2024 18:29
@lhc70000 lhc70000 merged commit f860b74 into iina:develop Jul 8, 2024
@uiryuu
Copy link
Member

uiryuu commented Jul 8, 2024

@svobs This PR causes a bug where the volume control and the toolbar buttons are not shown in the floating OSC.

image

It seems like a constraint issue, but I failed to find out the root cause.

@svobs
Copy link
Contributor Author

svobs commented Jul 8, 2024 via email

@lhc70000
Copy link
Member

lhc70000 commented Jul 8, 2024

I've already found the reason, can fix it if you don't mind.

@svobs
Copy link
Contributor Author

svobs commented Jul 8, 2024 via email

lhc70000 added a commit that referenced this pull request Jul 8, 2024
@low-batt low-batt mentioned this pull request Jul 16, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants