Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 77098c0

Browse files
author
richardadjogah
committed
Add offsetX and offsetY props for manual position adjustment
1 parent add719b commit 77098c0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ const Popover = createClass({
6262
preferPlace: T.oneOf(Layout.validTypeValues),
6363
place: T.oneOf(Layout.validTypeValues),
6464
tipSize: T.number,
65+
offsetX: T.number,
66+
offsetY: T.number,
6567
refreshIntervalMs: T.oneOfType([ T.number, T.bool ]),
6668
isOpen: T.bool,
6769
onOuterAction: T.func,
@@ -82,6 +84,8 @@ const Popover = createClass({
8284
preferPlace: null,
8385
place: null,
8486
offset: 4,
87+
offsetX: 0,
88+
offsetY: 0,
8589
isOpen: false,
8690
onOuterAction: function noOperation () {},
8791
enterExitTransitionDurationMs: 500,
@@ -210,8 +214,8 @@ const Popover = createClass({
210214
/* Apply Absolute Positioning. */
211215

212216
log(`pos`, pos)
213-
this.containerEl.style.top = `${pos.y}px`
214-
this.containerEl.style.left = `${pos.x}px`
217+
this.containerEl.style.top = `${pos.y + this.props.offsetY}px`
218+
this.containerEl.style.left = `${pos.x + this.props.offsetX}px`
215219

216220
/* Calculate Tip Position */
217221

0 commit comments

Comments
 (0)