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

Update rectangle.md (issue #9552) #9721

Merged
merged 2 commits into from
Jun 13, 2017
Merged

Update rectangle.md (issue #9552) #9721

merged 2 commits into from
Jun 13, 2017

Conversation

brianfajardo
Copy link
Contributor

typeError is shown when floating point values are passed to the rectangle object.

For example, BrowserWindow.setBounds(5, 10, 15.5, 20.5) results in typeError

Added a small note in rectangle.md to add clarity.

Clear confusion regarding rectangle object parameter values
Copy link
Contributor

@zeke zeke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. One of the Travis builds seems flaky, so I reran it.

@vanessayuenn vanessayuenn merged commit f91409b into electron:master Jun 13, 2017
@Vegvizer
Copy link

Hi guys,
the issue is that the setBounds() can't get a float number, in order to fix it you can use the Math round function:

for example
const yPosition = process.platform === 'darwin' ? y : y - height;
const xPosition = Math.round(x - width/2);
BrowerWindow.setBounds({
x: xPosition ,
y: yPosition,
width,
height,
});

@sampalm
Copy link

sampalm commented Mar 5, 2018

@Vegvizer Thanks, you saved me a lot of time.

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

Successfully merging this pull request may close these issues.

None yet

5 participants