-
Notifications
You must be signed in to change notification settings - Fork 127
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
Expose frame and visibleFrame for Screen #128
Comments
…() and Screen#visibleFrameInRectangle() to Screen#flippedVisibleFrame(). Add Screen#frame() and Screen#visibleFrame() (#128).
I'm a bit confused as to when you should use which. Previously |
@mafredri This is why I originally was hesitant about exposing these (see #43). See a short description here: https://github.com/kasper/phoenix/blob/master/API.md#about-coordinates. Basically the lower level APIs use the flipped frame (the whole Accessibility API), higher level APIs (such as modals) use the “normal” frame. In most cases you will use the flipped frame, so no changes regarding this. Eventually I decided to expose these, because it’s indeed a lot more easier to position modals correctly when you can get the frame with the same coordinate system. The “default” frame in this context should definitely be the flipped frame, but unfortunately you cannot override existing methods with category extensions for |
@mafredri Coordinate systems are hard. Let me know if you have any suggestions on how to improve this. |
Thanks for the explanation, I'll have a look at the API docs! Regarding the issue of naming, how about switching them around in JavaScript? This seems to work for me, but I did not do a whole lot of testing (also, no idea what repercussions it might have 😝): (function (s) {
var _frame = s.frame;
var _visibleFrame = s.visibleFrame;
s.frame = s.flippedFrame;
s.visibleFrame = s.flippedVisibleFrame;
s.flippedFrame = _frame;
s.flippedVisibleFrame = _visibleFrame;
})(Screen.prototype); |
@mafredri Probably a bit risky. 😝 Anyway, the current naming follows Apple’s standard. The default coordinate system for Cocoa is bottom-left based, this is what Now, if you want to adjust the position of windows using the Accessibility API, you need to use a top-left based coordinate system. Brilliant! Apple refers to this as a flipped coordinate system. Basically the Unfortunately I know that this is bound to be confusing to people who are not familiar with this. It’s a drawback and mostly a documentation dilemma. |
Expose
frame
andvisibleFrame
for Screen to help position modals with the same origin based frame.Screen#frameInRectangle()
toScreen#flippedFrame()
Screen#visibleFrameInRectangle()
toScreen#flippedVisibleFrame()
Screen#frameInRectangle()
for removal in later versions and alias it toScreen#flippedFrame()
Screen#visibleFrameInRectangle()
for removal in later versions and alias it toScreen#flippedVisibleFrame()
Screen#frame()
Screen#visibleFrame()
The text was updated successfully, but these errors were encountered: