mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 08:31:47 +08:00
[mac] setPosition - adjust based on scale factor
This commit is contained in:
parent
01899adef9
commit
454d170dfb
@ -578,10 +578,14 @@ void windowSetPosition(void* nsWindow, int x, int y) {
|
|||||||
if (screen == NULL) {
|
if (screen == NULL) {
|
||||||
screen = [NSScreen mainScreen];
|
screen = [NSScreen mainScreen];
|
||||||
}
|
}
|
||||||
|
// Get the scale of the screen
|
||||||
|
CGFloat scale = [screen backingScaleFactor];
|
||||||
NSRect frame = [window frame];
|
NSRect frame = [window frame];
|
||||||
frame.origin.x = x;
|
// Scale the position
|
||||||
frame.origin.y = (screen.frame.size.height - frame.size.height) - y;
|
frame.origin.x = x / scale;
|
||||||
[window setFrame:frame display:YES];
|
frame.origin.y = (screen.frame.size.height - frame.size.height) - (y / scale);
|
||||||
|
// Set the frame
|
||||||
|
[window setFrame:frame display:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user