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

window.moveTo(x, y) resizes window when global UI scaling is > 100% (Windows 10) #7113

Closed
Luzzifus opened this issue Jul 15, 2019 · 4 comments

Comments

@Luzzifus
Copy link

NWJS Version: 0.39.2 (and also earlier versions), 0.40.0 beta1
Operating System: Windows 10

Expected behavior

window.moveTo(x, y) moves the window to the designated screen position with no side effects.

Actual behavior

When the global UI scaling of Windows 10 is set to something bigger than 100%, window.moveTo(x, y) also resizes the window. It becomes bigger each call.

How to reproduce

I wrote a few lines of code which makes it possible to move the nw.js window by dragging a handle element. During dragging, the described behavior occurs.

Fully functional example code:

moveTo_bug.zip

@Luzzifus
Copy link
Author

Luzzifus commented Aug 23, 2019

Another observation:

Even at default Windows UI scaling (100%), moving the window via .moveTo will resize it, if the size is below a certain threshold. For me that is 64px. If the window has a height of 64px or below when calling .moveTo, .moveTo will decrease the height with each call until it hits zero. Changes below min_height are not visible, but are still reported by the window resize event.

Also, contrary to the initial bug behaviour, this can't even be prevented by setting win.setResizable(false) while moving the window. The only option I have seems to be to record the size on drag start and reapplying it after drag end.

Btw. any kind of reaction would be appreciated.

@Luzzifus
Copy link
Author

Luzzifus commented Jan 1, 2020

@rogerwang

This issue still persists in 0.43.x and the latest nightly build. It is reproducible across multiple PCs for me and is even more pronounced with nw2, so I'll reference this to #7230 . Before nw2, I was compensating this by setting the window to be non-resizable during dragging, but with nw2 that workaround has no effect anymore.

I use win.moveTo() to implement a custom app title bar with window dragging functionality. This has now become an app breaking issue for me. Another minimal demonstration code example is attached, as well as a gif of the behaviour.

dragTest
dragTest.zip

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

@rogerwang
Copy link
Member

The nightly build for this issue is available at https://dl.nwjs.io/live-build/nw43/20200107-162000/36d4d26c4

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

No branches or pull requests

2 participants