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

Any way to specify default x and y? #26

Open
synic opened this issue Oct 1, 2017 · 1 comment
Open

Any way to specify default x and y? #26

synic opened this issue Oct 1, 2017 · 1 comment

Comments

@synic
Copy link

synic commented Oct 1, 2017

The docs do not show it, and I couldn't glean it from reading the code (I'm a JS noob).

Can we also specify the default coordinates?

@benkeen
Copy link

benkeen commented Oct 3, 2017

No, it doesn't look like it. But agreed: it seems reasonable for the app to provide a default x, y in the same manner that it does width and height. Perhaps placed in the center of the screen.

But you can easily code around it: just check to see if the x, y values returned in windowStateKeeper(...) are undefined or not, if they are, set them. For all future updates, that info will be automatically saved in state by the library.

Something like this:

const { x, y, height, width } = windowStateKeeper({
  defaultWidth: 1000,
  defaultHeight: 500
});
if (x === undefined) {
  x = 100;
}
if (y === undefined) {
  y = 100;
}

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