-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix layout issues in Settings > UI (issue #4033) #4034
Conversation
2448295
to
cd3a9aa
Compare
Well that is...really strange. I ran it again and tried changing several system appearance settings, and tried different displays and scalings...and I wasn't able to see purple again. I suppose it does seem possible that two Macs might vary by a single pixel, for whatever reason...I really thought Apple had gotten that aspect nailed down. Maybe not. Looking at your screenshot though, it looks like the constraints it's complaining about are different than the original problem, and after going back and checking, I did find two vertical "equals" constraints, priority 1000, which spanned the same basic two locations but within different views, and that looked like a likely culprit. So I made some changes and was able to eliminate one of them and loosen the horizontal constraints a bit. I also found a couple of places I had missed before, where programmatic constraints were being used which were a couple pixels off, although those would have only affected drag & drop (inside the Customize popup). Updated those too. So, I pushed the updates, and hopefully it's stopped complaining now. If not...hopefully there's no if not :) |
Still getting complaints. Looks like the height of the area showing the icons is a problem. This is the errors emitted. Xcode Console
|
Ack. Alright...interesting... It looks like on your Mac, either the interior height of the box isn't 22 pixels, or the exterior height isn't 24 pixels, as it is on mine. Let me see if I can come with something which doesn't require fixed heights for one of them... |
cd3a9aa
to
3f868f7
Compare
dragItem.imageComponentsProvider = { | ||
let imageComponent = NSDraggingImageComponent(key: .icon) | ||
imageComponent.contents = self.buttonType.image() | ||
imageComponent.frame = NSRect(origin: .zero, size: NSSize(width: 14, height: 14)) | ||
imageComponent.frame = NSRect(origin: .zero, size: NSSize(width: Preference.ToolBarButton.imageWidth, height: Preference.ToolBarButton.imageHeight)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not understanding why the need to reference Preference.ToolBarButton.imageWidth and imageHeight. At this point imageComponent.contents contains the NSImage. Instead of creating a NSSize, can't this just be imageComponent.contents.size, referencing the NSImage size property?
dragItem.imageComponentsProvider = { | ||
let imageComponent = NSDraggingImageComponent(key: .icon) | ||
imageComponent.contents = self.buttonType.image() | ||
imageComponent.frame = NSRect(origin: .zero, size: NSSize(width: 14, height: 14)) | ||
imageComponent.frame = NSRect(origin: .zero, size: NSSize(width: Preference.ToolBarButton.imageWidth, height: Preference.ToolBarButton.imageHeight)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not understanding why the need to reference Preference.ToolBarButton.imageWidth and imageHeight. At this point imageComponent.contents contains the NSImage. Instead of creating a NSSize, can't this just be imageComponent.contents.size, referencing the NSImage size property?
Worked fine this time, no purple. Just confused as to why the size can not be obtained directly from the image. Glad you are tackling constraint issues. There are two known crashes due to constraint problems. |
3f868f7
to
e3f0232
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pulled locally and tested. Looks good to me.
Apparently it can be (at least now). Unlike my fix in #4029 where I scrutinized the layout of every component in the layout (have you had a chance to look at that?), with this one I haven't strayed too far from the parts which were causing obvious trouble. You were right to point this out though. Due to the 14x14 constraint, a couple of the icons were getting squished while dragging. The |
Totally overloaded. Been meaning to get to PR #4029. Just tested. Looks good to me. Since we are talking about layout constraints in preferences panels, issue #3505 is a reproducible crash in the subtitles preferences due to constraints. When you really dig deeply into software you find stuff. I'm surprised the icons are not all the same size. That seems like something that needs to be fixed. |
…yout for toolbar preview so it will always fit the box properly
No problem, and great! Was just a little nervous because I sunk an enormous amount of time and effort into that one and hadn't heard anything.
Well.. Only today noticed: the Quick Settings icon in the player window's toolbar isn't scaled to the same size as the other icons. I dug in deeper, and it looks like this icon is not consistently sized even in the player window: it's fine for my high DPI display, but slightly too small on my low-DPI display: It looks like the fix for this won't be simple, because it's using a system icon, and as noted here, that's not a good idea. If we could agree to replace it with a nice custom-made gear icon, that would solve all our problems. But will leave that for another issue. I pushed a final update for this one which managed to remove the 2 pixels of spacing I had added between each icon, so now the spacing is again identical to the MainWindow toolbar's.
I'll take a look at this. |
e3f0232
to
1cd6afe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Visually good to me
Thanks! |
Description:
I've been getting better/faster at Interface Builder layouts, and felt compelled to fix this one. Mostly due to the fact that I left visual layout debugging enabled and was starting to get haunted by the big purple miasma surrounding the page.
This update:
(never mind that the order of the icons is different between these two shots; I just did a bunch of testing and ended up with different settings between shots)