Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,4 @@ class App extends React.Component {

| Property | Description |
|----------------|---------------|
| toggle | Open or hide popover tooltip |
| toggle | Open or hide popover tooltip and returns the state of the modal |
8 changes: 7 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,18 @@ class PopoverTooltip extends React.PureComponent<Props, State> {
componentWrapper.measure((x, y, width, height, pageX, pageY) => {
const fullWidth = pageX + tooltipContainerWidth
+ (width - tooltipContainerWidth) / 2;
const tooltipContainerX_final = fullWidth > window.width
let tooltipContainerX_final = fullWidth > window.width
? window.width - tooltipContainerWidth
: pageX + (width - tooltipContainerWidth) / 2;
//tooltip handling for right side
let tooltipContainerY_final = this.state.tooltipTriangleDown
? pageY - tooltipContainerHeight - 20
: pageY + tooltipContainerHeight - 20;
let tooltipTriangleDown = this.state.tooltipTriangleDown;
if( tooltipContainerX_final < 0 ) {
tooltipContainerX_final = 0;
}
//tooltip handling added to left side
if (pageY - tooltipContainerHeight - 20 < 0) {
tooltipContainerY_final = pageY + height + 20;
tooltipTriangleDown = false;
Expand Down Expand Up @@ -437,6 +442,7 @@ class PopoverTooltip extends React.PureComponent<Props, State> {
} else {
this.openModal();
}
return this.state.isModalOpen;
}

}
Expand Down