From 81e130c317e47d1aff8400d7db162d601595aec4 Mon Sep 17 00:00:00 2001 From: "DESKTOP-SB1K7TM\\Madeeha Hasan" Date: Tue, 16 Jan 2018 19:33:04 +0500 Subject: [PATCH 1/4] return toggle state --- README.md | 2 +- src/index.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e47fff..aa977c0 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/src/index.js b/src/index.js index 3f45312..15d4042 100644 --- a/src/index.js +++ b/src/index.js @@ -437,6 +437,7 @@ class PopoverTooltip extends React.PureComponent { } else { this.openModal(); } + return this.state.isModalOpen; } } From 232685980cb381625468fcbeba53cb7da918b697 Mon Sep 17 00:00:00 2001 From: Madeeha Hasan Date: Mon, 22 Jan 2018 12:38:20 +0500 Subject: [PATCH 2/4] tooltip position on x axis handled --- src/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.js b/src/index.js index 15d4042..c0ccf12 100644 --- a/src/index.js +++ b/src/index.js @@ -179,6 +179,10 @@ class PopoverTooltip extends React.PureComponent { ? pageY - tooltipContainerHeight - 20 : pageY + tooltipContainerHeight - 20; let tooltipTriangleDown = this.state.tooltipTriangleDown; + + if( tooltipContainerX_final < 0 ) { + tooltipContainerX_final = 0; + } if (pageY - tooltipContainerHeight - 20 < 0) { tooltipContainerY_final = pageY + height + 20; tooltipTriangleDown = false; From 41af955b2f47f35c67d781b6117bbe4e31d2c4b4 Mon Sep 17 00:00:00 2001 From: Madeeha Hasan Date: Mon, 22 Jan 2018 14:19:03 +0500 Subject: [PATCH 3/4] Tooltip handling added on x axis --- src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index c0ccf12..0a22928 100644 --- a/src/index.js +++ b/src/index.js @@ -175,14 +175,15 @@ class PopoverTooltip extends React.PureComponent { const 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; From f44d9e49285d3d26982f45de0e8b55567010990e Mon Sep 17 00:00:00 2001 From: Madeeha Hasan Date: Mon, 22 Jan 2018 18:47:48 +0500 Subject: [PATCH 4/4] tooltipContainer set to let --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 0a22928..df1e44f 100644 --- a/src/index.js +++ b/src/index.js @@ -172,7 +172,7 @@ class PopoverTooltip extends React.PureComponent { 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