@@ -1835,7 +1835,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
1835
1835
var isMyElement = targetArray . some ( function ( ele ) {
1836
1836
return ele === e . currentTarget ;
1837
1837
} ) ;
1838
- if ( ! isMyElement || this . state . show ) return ;
1838
+ if ( ! isMyElement ) return ;
1839
1839
}
1840
1840
// Get the tooltip content
1841
1841
// calculate in this phrase so that tip width height can be detected
@@ -1888,6 +1888,7 @@ var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.de
1888
1888
_this5 . setState ( {
1889
1889
isEmptyTip : isEmptyTip
1890
1890
} ) ;
1891
+ _this5 . updatePosition ( ) ;
1891
1892
}
1892
1893
} , getContent [ 1 ] ) ;
1893
1894
}
@@ -2172,14 +2173,19 @@ Object.defineProperty(exports, "__esModule", {
2172
2173
} ) ;
2173
2174
2174
2175
exports . default = function ( e , target , node , place , desiredPlace , effect , offset ) {
2175
- var tipWidth = node . clientWidth ;
2176
- var tipHeight = node . clientHeight ;
2176
+ var _getDimensions = getDimensions ( node ) ,
2177
+ tipWidth = _getDimensions . width ,
2178
+ tipHeight = _getDimensions . height ;
2179
+
2180
+ var _getDimensions2 = getDimensions ( target ) ,
2181
+ targetWidth = _getDimensions2 . width ,
2182
+ targetHeight = _getDimensions2 . height ;
2177
2183
2178
2184
var _getCurrentOffset = getCurrentOffset ( e , target , effect ) ,
2179
2185
mouseX = _getCurrentOffset . mouseX ,
2180
2186
mouseY = _getCurrentOffset . mouseY ;
2181
2187
2182
- var defaultOffset = getDefaultPosition ( effect , target . clientWidth , target . clientHeight , tipWidth , tipHeight ) ;
2188
+ var defaultOffset = getDefaultPosition ( effect , targetWidth , targetHeight , tipWidth , tipHeight ) ;
2183
2189
2184
2190
var _calculateOffset = calculateOffset ( offset ) ,
2185
2191
extraOffset_X = _calculateOffset . extraOffset_X ,
@@ -2361,28 +2367,18 @@ exports.default = function (e, target, node, place, desiredPlace, effect, offset
2361
2367
} ;
2362
2368
} ;
2363
2369
2364
- // Get current mouse offset
2365
- var getCurrentOffset = function getCurrentOffset ( e , currentTarget , effect ) {
2366
- var boundingClientRect = currentTarget . getBoundingClientRect ( ) ;
2367
- var targetTop = boundingClientRect . top ;
2368
- var targetLeft = boundingClientRect . left ;
2369
- var targetWidth = currentTarget . clientWidth ;
2370
- var targetHeight = currentTarget . clientHeight ;
2370
+ var getDimensions = function getDimensions ( node ) {
2371
+ var _node$getBoundingClie = node . getBoundingClientRect ( ) ,
2372
+ height = _node$getBoundingClie . height ,
2373
+ width = _node$getBoundingClie . width ;
2371
2374
2372
- if ( effect === 'float' ) {
2373
- return {
2374
- mouseX : e . clientX ,
2375
- mouseY : e . clientY
2376
- } ;
2377
- }
2378
2375
return {
2379
- mouseX : targetLeft + targetWidth / 2 ,
2380
- mouseY : targetTop + targetHeight / 2
2376
+ height : parseInt ( height , 10 ) ,
2377
+ width : parseInt ( width , 10 )
2381
2378
} ;
2382
2379
} ;
2383
2380
2384
- // List all possibility of tooltip final offset
2385
- // This is useful in judging if it is necessary for tooltip to switch position when out of window
2381
+ // Get current mouse offset
2386
2382
/**
2387
2383
* Calculate the position of tooltip
2388
2384
*
@@ -2399,6 +2395,29 @@ var getCurrentOffset = function getCurrentOffset(e, currentTarget, effect) {
2399
2395
* - `newState` {Object}
2400
2396
* - `position` {OBject} {left: {Number}, top: {Number}}
2401
2397
*/
2398
+ var getCurrentOffset = function getCurrentOffset ( e , currentTarget , effect ) {
2399
+ var boundingClientRect = currentTarget . getBoundingClientRect ( ) ;
2400
+ var targetTop = boundingClientRect . top ;
2401
+ var targetLeft = boundingClientRect . left ;
2402
+
2403
+ var _getDimensions3 = getDimensions ( currentTarget ) ,
2404
+ targetWidth = _getDimensions3 . width ,
2405
+ targetHeight = _getDimensions3 . height ;
2406
+
2407
+ if ( effect === 'float' ) {
2408
+ return {
2409
+ mouseX : e . clientX ,
2410
+ mouseY : e . clientY
2411
+ } ;
2412
+ }
2413
+ return {
2414
+ mouseX : targetLeft + targetWidth / 2 ,
2415
+ mouseY : targetTop + targetHeight / 2
2416
+ } ;
2417
+ } ;
2418
+
2419
+ // List all possibility of tooltip final offset
2420
+ // This is useful in judging if it is necessary for tooltip to switch position when out of window
2402
2421
var getDefaultPosition = function getDefaultPosition ( effect , targetWidth , targetHeight , tipWidth , tipHeight ) {
2403
2422
var top = void 0 ;
2404
2423
var right = void 0 ;
0 commit comments