You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BrowserWindow's "will-resize" event's callback is provided with bizarre newBounds value #19611
I agree to follow the Code of Conduct that this project adheres to.
I have searched the issue tracker for an issue that matches the one I want to file, without success.
Issue Details
Electron Version:
6.0.0
Operating System:
MacOS any
Last Known Working Electron version:
none that I know of
Expected Behavior
The actual new bounds (correct x, y, width and height) to be provided as the new bounds to the callback of will-resize event
Actual Behavior
On mac (and only mac) it provides some very bizarre values. It seems that the y and x are actually calculated from the BOTTOM-RIGHT corner of the DISPLAY bounds to the BOTTOM-RIGHT of the window bounds. Instead of the usual (by that I mean what you get from getBounds) x and y that is calculated from the TOP-LEFT of the DISPLAY to the TOP-LEFT of the window.
in other words imagine this:
My display is 100x100 and I have a window at 10, 20 with width: 30, and height 40
the getBounds function gives me (10, 20, 30, 40) all good.
when I resize from the TOP, UP for 1 pixel, the new bounds would be: (10, 19, 10, 41)
because the height is increased by one, while the y is reduced by one.
however the will-resize event on MAC gives me: (60, 40, 10, 41)
60 is the display.width - bounds.width - bounds.x.
40 is the display.height - bounds.height - bounds.y. why?!
and what's worse? there is no way to transform these, because not only the x and the y are wrong, they never reflect what is going on, that means, even if I resize from BOTTOM in the UP direction, it still gives me the same WRONG newBounds.
this means, there is absolutely no way to even work around this issue. I have no way of knowing whether the user dragged the TOP edge down or the BOTTOM edge down. the data is so bizarre that I spent a whole day trying to figure out what the values meant and how I could fix them. there is no way. It has to be fixed here
To Reproduce
Simply listen to will-resize of any window and log the newBounds argument.
Activity
pouyakary commentedon Aug 3, 2019
@deermichel — I guess another thing you can checkout
deermichel commentedon Aug 5, 2019
Yeah i guess the same strange things happen with
Tray- let's see what i can do...alitaheri commentedon Aug 6, 2019
@deermichel Thank you for taking care of this on such short notice 👍
pouyakary commentedon Aug 9, 2019
thanks a lot @deermichel 😍