简体   繁体   中英

Undecorated Stage jump for different screen scales in windows

I have two monitors. one is at 100% windows 10 scale and the other is at 200%. When dragging my javafx stage from one window to the other I have a big jump when the mouse crosses from one screen to the other.

I monitored the x positions of my stage while dragging and it seems that at some point the second screen initial x position is 0 instead of my other screen resolution.

This is what I have on my on mouse pressed callback:

xOffset = stage.getX() - mouseEvent.getScreenX();
yOffset = stage.getY() - mouseEvent.getScreenY();

and this is how I handle the dragging for my stage:

stage.setX(event.getScreenX() + xOffset);
stage.setY(event.getScreenY() + yOffset);

This was fixed in version later than java 8.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM