Skip to content

centerOf() returns a Promise, how to make it more convenient to use? #375

Answered by Calinou
Calinou asked this question in Q&A
Discussion options

You must be logged in to vote

I wrote my own function for it, which is pretty simple as you'd expect:

function centerOf(region) {
	return new Point(region.left + region.width * 0.5, region.top + region.height * 0.5);
}

I wonder if this could be provided in nut.js itself.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Calinou
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant