Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Provide coords on keypress
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansampson committed Apr 2, 2017
1 parent 6c4d8a5 commit 9a77992
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/renderer/components/browserActionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@ class BrowserActionButton extends ImmutableComponent {
windowActions.setPopupWindowDetail()
return
}
let centerX
let centerY
if (!e.nativeEvent.x || !e.nativeEvent.y) {
// Handles case where user focuses button, and presses Enter
let { top: offsetTop, left: offsetLeft } = e.target.getBoundingClientRect()
centerX = offsetLeft + e.target.offsetWidth * 0.5
centerY = offsetTop + e.target.offsetHeight * 0.5
}
let props = {
x: e.nativeEvent.x,
y: e.nativeEvent.y,
x: e.nativeEvent.x || centerX,
y: e.nativeEvent.y || centerY,
screenX: e.nativeEvent.screenX,
screenY: e.nativeEvent.screenY,
offsetX: e.nativeEvent.offsetX,
Expand Down

0 comments on commit 9a77992

Please # to comment.