-
Notifications
You must be signed in to change notification settings - Fork 365
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
setSize need reset the position #349
Comments
solution:
use showWindow reset position |
but still need to work out, here are some solution: |
I'm doing it manually for my app. Before setting the size, you can position the window using import { taskbarLocation } from 'menubar';
import { is } from 'electron-util';
import { menubar } from './main';
const [x, y] = menubar.window?.getPosition();
const newHeight = 400;
const newWidth = 200;
const barLocation = taskbarLocation(menubar.tray);
const [width, height] = menubar.window?.getSize() || [];
// mac will always be on top so we don't have to do anything for mac
if (is.windows || is.linux) {
let newX, newY;
const [x, y] = menubar.window?.getPosition() || [];
newX = x;
newY = y;
// Workaround for the window positioning issue
if (barLocation !== 'top') {
if (!newHeight) newY = y;
else newY = y - (newHeight - height);
}
menubar.window?.setBounds({
x: newX,
y: newY,
width: newWidth || width,
height: h || height,
});
}
menubar.window?.setSize(newWidth || width, newHeight || height, true); |
thanks |
Description
when i use mb.window.setSize(150, height) change the size, it need to reset the position
Steps to Reproduce the Problem
Expected Behaviour
reset the position when setSize()
Actual Behaviour
Specifications
electron -v
ornode_modules/.bin/electron -v
to get it)Other information
The text was updated successfully, but these errors were encountered: