|
|
@ -433,17 +433,18 @@ |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getCenterAdaptPosition: function (combo, popup) { |
|
|
|
getCenterAdaptPosition: function (combo, popup, positionRelativeElement) { |
|
|
|
var comboOffset = combo.element.offset(); |
|
|
|
var comboRect = combo.element[0].getBoundingClientRect(), |
|
|
|
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), |
|
|
|
popupRect = popup.element[0].getBoundingClientRect(), |
|
|
|
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); |
|
|
|
positionRelativeElementRect = positionRelativeElement.getBoundingClientRect(), |
|
|
|
|
|
|
|
viewportBounds = document.documentElement.getBoundingClientRect(); |
|
|
|
var left; |
|
|
|
var left; |
|
|
|
if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) { |
|
|
|
if (comboRect.left + comboRect.width / 2 + popupRect.width / 2 > viewportBounds.width) { |
|
|
|
left = windowBounds.width - popupBounds.width; |
|
|
|
left = viewportBounds.width - comboRect.width - positionRelativeElementRect.left; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
left = comboOffset.left + comboBounds.width / 2 - popupBounds.width / 2; |
|
|
|
left = comboRect.left + (comboRect.width - popupRect.width) / 2 - positionRelativeElementRect.left; |
|
|
|
} |
|
|
|
} |
|
|
|
if (left < 0) { |
|
|
|
if (left + positionRelativeElementRect.left < 0) { |
|
|
|
left = 0; |
|
|
|
left = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
return { |
|
|
|
return { |
|
|
@ -451,17 +452,19 @@ |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getMiddleAdaptPosition: function (combo, popup) { |
|
|
|
getMiddleAdaptPosition: function (combo, popup, positionRelativeElement) { |
|
|
|
var comboOffset = combo.element.offset(); |
|
|
|
var comboRect = combo.element[0].getBoundingClientRect(), |
|
|
|
var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), |
|
|
|
popupRect = popup.element[0].getBoundingClientRect(), |
|
|
|
windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); |
|
|
|
positionRelativeElementRect = positionRelativeElement.getBoundingClientRect(), |
|
|
|
|
|
|
|
viewportBounds = document.documentElement.getBoundingClientRect(); |
|
|
|
|
|
|
|
|
|
|
|
var top; |
|
|
|
var top; |
|
|
|
if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) { |
|
|
|
if (comboRect.top + comboRect.height / 2 + popupRect.height / 2 > viewportBounds.height) { |
|
|
|
top = windowBounds.height - popupBounds.height; |
|
|
|
top = viewportBounds.height - popupRect.height - positionRelativeElementRect.top; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
top = comboOffset.top + comboBounds.height / 2 - popupBounds.height / 2; |
|
|
|
top = comboRect.top + (comboRect.height - popupRect.height) / 2 - positionRelativeElementRect.top; |
|
|
|
} |
|
|
|
} |
|
|
|
if (top < 0) { |
|
|
|
if (top + positionRelativeElementRect.top < 0) { |
|
|
|
top = 0; |
|
|
|
top = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
return { |
|
|
|
return { |
|
|
@ -681,19 +684,19 @@ |
|
|
|
switch (offsetStyle) { |
|
|
|
switch (offsetStyle) { |
|
|
|
case "center": |
|
|
|
case "center": |
|
|
|
if (position.change) { |
|
|
|
if (position.change) { |
|
|
|
var p = BI.DOM.getMiddleAdaptPosition(combo, popup); |
|
|
|
var p = BI.DOM.getMiddleAdaptPosition(combo, popup, positionRelativeElement); |
|
|
|
position.top = p.top; |
|
|
|
position.top = p.top; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var p = BI.DOM.getCenterAdaptPosition(combo, popup); |
|
|
|
var p = BI.DOM.getCenterAdaptPosition(combo, popup, positionRelativeElement); |
|
|
|
position.left = p.left; |
|
|
|
position.left = p.left; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case "middle": |
|
|
|
case "middle": |
|
|
|
if (position.change) { |
|
|
|
if (position.change) { |
|
|
|
var p = BI.DOM.getCenterAdaptPosition(combo, popup); |
|
|
|
var p = BI.DOM.getCenterAdaptPosition(combo, popup, positionRelativeElement); |
|
|
|
position.left = p.left; |
|
|
|
position.left = p.left; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var p = BI.DOM.getMiddleAdaptPosition(combo, popup); |
|
|
|
var p = BI.DOM.getMiddleAdaptPosition(combo, popup, positionRelativeElement); |
|
|
|
position.top = p.top; |
|
|
|
position.top = p.top; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|