Skip to content

Commit 9fe3f0b

Browse files
committed
3.1.1
1 parent f9bd612 commit 9fe3f0b

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
## Change Log
22

3+
### 3.1.1 (2016/07/27 13:03 +00:00)
4+
- [#151](https://github.com/wwayne/react-tooltip/pull/151) Update postion calculation so that it can calculate continous tootlip (@wwayne)
5+
36
### 3.1.0 (2016/07/27 08:49 +00:00)
47
- [#149](https://github.com/wwayne/react-tooltip/pull/149) Update algorithm for get positon to fix the shake problem #146 (@wwayne)
58
- [#145](https://github.com/wwayne/react-tooltip/pull/145) fix typo (@meandavejustice)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-tooltip",
3-
"version": "3.1.0",
3+
"version": "3.1.1",
44
"description": "react tooltip component",
55
"main": "dist/index.js",
66
"scripts": {

standalone/react-tooltip.js

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,6 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
532532

533533
// If it is focus event, switch to `solid` effect
534534
var isFocus = e instanceof window.FocusEvent;
535-
536535
this.setState({
537536
placeholder: placeholder,
538537
place: e.currentTarget.getAttribute('data-place') || this.props.place || 'top',
@@ -579,8 +578,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
579578
var delayTime = show ? 0 : parseInt(delayShow, 10);
580579
var eventTarget = e.currentTarget;
581580

582-
clearTimeout(this.delayShowLoop);
583-
this.delayShowLoop = setTimeout(function () {
581+
var updateState = function updateState() {
584582
if (typeof placeholder === 'string') placeholder = placeholder.trim();
585583
if (Array.isArray(placeholder) && placeholder.length > 0 || placeholder) {
586584
_this6.setState({
@@ -591,7 +589,14 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
591589
_this6.updatePosition();
592590
});
593591
}
594-
}, delayTime);
592+
};
593+
594+
if (delayShow) {
595+
clearTimeout(this.delayShowLoop);
596+
this.delayShowLoop = setTimeout(updateState, delayTime);
597+
} else {
598+
updateState();
599+
}
595600
}
596601

597602
/**
@@ -608,14 +613,21 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
608613

609614
if (!this.mount) return;
610615

611-
this.clearTimer();
612-
this.delayHideLoop = setTimeout(function () {
616+
var resetState = function resetState(resetPlace) {
617+
var newPlace = resetPlace ? '' : _this7.state.place;
613618
_this7.setState({
614619
show: false,
615-
place: ''
620+
place: newPlace
616621
});
617622
_this7.removeScrollListener();
618-
}, parseInt(delayHide, 10));
623+
};
624+
625+
if (delayHide) {
626+
this.clearTimer();
627+
this.delayHideLoop = setTimeout(resetState, parseInt(delayHide, 10));
628+
} else {
629+
resetState(true);
630+
}
619631
}
620632

621633
/**

standalone/react-tooltip.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)