* If max height is less than zero it returns the bounds height instead.
(targetRectangle, targetEdge, gapSpace, bounds, coverTarget)
| 32109 | /** |
| 32110 | * If max height is less than zero it returns the bounds height instead. |
| 32111 | */ function _getMaxHeightFromTargetRectangle(targetRectangle, targetEdge, gapSpace, bounds, coverTarget) { |
| 32112 | var maxHeight = 0; |
| 32113 | var directionalHint = DirectionalDictionary[targetEdge]; |
| 32114 | // If cover target is set, then the max height should be calculated using the opposite of the target edge since |
| 32115 | // that's the direction that the callout will expand in. |
| 32116 | // For instance, if the directionalhint is bottomLeftEdge then the callout will position so it's bottom edge |
| 32117 | // is aligned with the bottom of the target and expand up towards the top of the screen and the calculated max height |
| 32118 | // is (bottom of target) - (top of screen) - gapSpace. |
| 32119 | var target = coverTarget ? directionalHint.targetEdge * -1 : directionalHint.targetEdge; |
| 32120 | if (target === (0, _positioningTypes.RectangleEdge).top) maxHeight = _getEdgeValue(targetRectangle, directionalHint.targetEdge) - bounds.top - gapSpace; |
| 32121 | else if (target === (0, _positioningTypes.RectangleEdge).bottom) maxHeight = bounds.bottom - _getEdgeValue(targetRectangle, directionalHint.targetEdge) - gapSpace; |
| 32122 | else maxHeight = bounds.bottom - targetRectangle.top - gapSpace; |
| 32123 | return maxHeight > 0 ? maxHeight : bounds.height; |
| 32124 | } |
| 32125 | function _positionElementRelative(props, elementToPosition, boundingRect, previousPositions) { |
| 32126 | var gap = props.gapSpace ? props.gapSpace : 0; |
| 32127 | var targetRect = _getTargetRect(boundingRect, props.target); |
no test coverage detected