(target, targetWindow)
| 32201 | return edge * -1; |
| 32202 | } |
| 32203 | function _getBoundsFromTargetWindow(target, targetWindow) { |
| 32204 | var segments = undefined; |
| 32205 | if (targetWindow.getWindowSegments) segments = targetWindow.getWindowSegments(); |
| 32206 | // Identify if we're dealing with single screen scenarios. |
| 32207 | if (segments === undefined || segments.length <= 1) return { |
| 32208 | top: 0, |
| 32209 | left: 0, |
| 32210 | right: targetWindow.innerWidth, |
| 32211 | bottom: targetWindow.innerHeight, |
| 32212 | width: targetWindow.innerWidth, |
| 32213 | height: targetWindow.innerHeight |
| 32214 | }; |
| 32215 | // Logic for determining dual screen scenarios. |
| 32216 | var x = 0; |
| 32217 | var y = 0; |
| 32218 | // If the target is an Element get coordinates for its center. |
| 32219 | if (target !== null && !!target.getBoundingClientRect) { |
| 32220 | var clientRect = target.getBoundingClientRect(); |
| 32221 | x = (clientRect.left + clientRect.right) / 2; |
| 32222 | y = (clientRect.top + clientRect.bottom) / 2; |
| 32223 | } else if (target !== null) { |
| 32224 | // eslint-disable-next-line deprecation/deprecation |
| 32225 | x = target.left || target.x; |
| 32226 | // eslint-disable-next-line deprecation/deprecation |
| 32227 | y = target.top || target.y; |
| 32228 | } |
| 32229 | var bounds = { |
| 32230 | top: 0, |
| 32231 | left: 0, |
| 32232 | right: 0, |
| 32233 | bottom: 0, |
| 32234 | width: 0, |
| 32235 | height: 0 |
| 32236 | }; |
| 32237 | // Define which window segment are the coordinates in and calculate bounds based on that. |
| 32238 | for(var _i = 0, segments_1 = segments; _i < segments_1.length; _i++){ |
| 32239 | var segment = segments_1[_i]; |
| 32240 | if (x && segment.left <= x && segment.right >= x && y && segment.top <= y && segment.bottom >= y) bounds = { |
| 32241 | top: segment.top, |
| 32242 | left: segment.left, |
| 32243 | right: segment.right, |
| 32244 | bottom: segment.bottom, |
| 32245 | width: segment.width, |
| 32246 | height: segment.height |
| 32247 | }; |
| 32248 | } |
| 32249 | return bounds; |
| 32250 | } |
| 32251 | function getBoundsFromTargetWindow(target, targetWindow) { |
| 32252 | return _getBoundsFromTargetWindow(target, targetWindow); |
| 32253 | } |
no outgoing calls
no test coverage detected