src/sap.ui.ux3/src/sap/ui/ux3/ToolPopup.js
function (oThis) {

                // do not mirror the arrow direction here in RTL mode, because otherwise the offset is calculated wrong
                // (Because the offset mirroring happens inside popup)
                // the arrow is later mirrored at the output...

                // this is the default case if no match was found
                var sDirection = "Left";

                // if 'my' is not set check if it was previously set via 'setPosition'
                var my = oThis._my;
                var at = oThis._at;
                if (!my && oThis.oPopup) {
                    my = oThis.oPopup._oPosition.my;
                }
                if (!at && oThis.oPopup) {
                    at = oThis.oPopup._oPosition.at;
                }

                oThis._bHorizontalArrow = false;

                if (my && at) {
                    var aMy = my.split(" ");
                    var aAt = at.split(" ");
                    // create a rule like "my:top|left at:left|top"
                    var sRule = "my:" + aMy[0] + "|" + aMy[1];
                    sRule += " at:" + aAt[0] + "|" + aAt[1];

                    if (ToolPopup.ARROW_LEFT.exec(sRule)) {
                        oThis._bHorizontalArrow = true;
                        sDirection = "Left";
                    } else if (ToolPopup.ARROW_RIGHT.exec(sRule)) {
                        oThis._bHorizontalArrow = true;
                        sDirection = "Right";
                    } else if (ToolPopup.ARROW_UP.exec(sRule)) {
                        sDirection = "Up";
                    } else if (ToolPopup.ARROW_DOWN.exec(sRule)) {
                        sDirection = "Down";
                    }

                    if (oThis.getDomRef() && oThis.isOpen()) {
                        var $This = oThis.$();
                        // jQuery Plugin "rect"
                        var oPopRect = $This.rect();
                        var $Opener = jQuery(document.getElementById(oThis.getOpener()));
                        // jQuery Plugin "rect"
                        var oOpenerRect = $Opener.rect();

                        if (oOpenerRect) {
                            // check if the ToolPopup was positioned at another side relative to the opener due to any collision.
                            if (oThis._bHorizontalArrow) {
                                // left/right arrow
                                var iPopRight = oPopRect.left + $This.outerWidth(true) + oThis.iArrowWidth;
                                var iOpenerRight = oOpenerRect.left + $Opener.outerWidth(true);

                                if (iPopRight <= iOpenerRight) {
                                    sDirection = "Right";

                                } else {
                                    sDirection = "Left";
                                }
                            } else {
                                // up/down arrow
                                var iPopBottom = oPopRect.top + $This.outerHeight(true) + oThis.iArrowWidth;
                                var iOpenerBottom = oOpenerRect.top + $Opener.outerHeight(true);

                                if (iPopBottom <= iOpenerBottom) {
                                    sDirection = "Down";
                                } else {
                                    sDirection = "Up";
                                }
                            }
                        }
                    }
                }

                return sDirection;
            }
function (oThis) {

                // do not mirror the arrow direction here in RTL mode, because otherwise the offset is calculated wrong
                // (Because the offset mirroring happens inside popup)
                // the arrow is later mirrored at the output...

                // this is the default case if no match was found
                var sDirection = "Left";

                // if 'my' is not set check if it was previously set via 'setPosition'
                var my = oThis._my;
                var at = oThis._at;
                if (!my && oThis.oPopup) {
                    my = oThis.oPopup._oPosition.my;
                }
                if (!at && oThis.oPopup) {
                    at = oThis.oPopup._oPosition.at;
                }

                oThis._bHorizontalArrow = false;

                if (my && at) {
                    var aMy = my.split(" ");
                    var aAt = at.split(" ");
                    // create a rule like "my:top|left at:left|top"
                    var sRule = "my:" + aMy[0] + "|" + aMy[1];
                    sRule += " at:" + aAt[0] + "|" + aAt[1];

                    if (ToolPopup.ARROW_LEFT.exec(sRule)) {
                        oThis._bHorizontalArrow = true;
                        sDirection = "Left";
                    } else if (ToolPopup.ARROW_RIGHT.exec(sRule)) {
                        oThis._bHorizontalArrow = true;
                        sDirection = "Right";
                    } else if (ToolPopup.ARROW_UP.exec(sRule)) {
                        sDirection = "Up";
                    } else if (ToolPopup.ARROW_DOWN.exec(sRule)) {
                        sDirection = "Down";
                    }

                    if (oThis.getDomRef() && oThis.isOpen()) {
                        var $This = oThis.$();
                        // jQuery Plugin "rect"
                        var oPopRect = $This.rect();
                        var $Opener = jQuery(document.getElementById(oThis.getOpener()));
                        // jQuery Plugin "rect"
                        var oOpenerRect = $Opener.rect();

                        if (oOpenerRect) {
                            // check if the ToolPopup was positioned at another side relative to the opener due to any collision.
                            if (oThis._bHorizontalArrow) {
                                // left/right arrow
                                var iPopRight = oPopRect.left + $This.outerWidth(true) + oThis.iArrowWidth;
                                var iOpenerRight = oOpenerRect.left + $Opener.outerWidth(true);

                                if (iPopRight <= iOpenerRight) {
                                    sDirection = "Right";

                                } else {
                                    sDirection = "Left";
                                }
                            } else {
                                // up/down arrow
                                var iPopBottom = oPopRect.top + $This.outerHeight(true) + oThis.iArrowWidth;
                                var iOpenerBottom = oOpenerRect.top + $Opener.outerHeight(true);

                                if (iPopBottom <= iOpenerBottom) {
                                    sDirection = "Down";
                                } else {
                                    sDirection = "Up";
                                }
                            }
                        }
                    }
                }

                return sDirection;
            }
function ( oThis ) { // do not mirror the arrow direction here in RTL mode, because otherwise the offset is calculated wrong // (Because the offset mirroring happens inside popup) // the arrow is later mirrored at the output... // this is the default case if no match was found var sDirection = "Left" ; // if 'my' is not set check if it was previously set via 'setPosition' var my = oThis . _my ; var at = oThis . _at ; if ( ! my && oThis . oPopup ) { my = oThis . oPopup . _oPosition . my ; } if ( ! at && oThis . oPopup ) { at = oThis . oPopup . _oPosition . at ; } oThis . _bHorizontalArrow = false ; if ( my && at ) { var aMy = my . split ( " " ) ; var aAt = at . split ( " " ) ; // create a rule like "my:top|left at:left|top" var sRule = "my:" + aMy [ 0 ] + "|" + aMy [ 1 ] ; sRule += " at:" + aAt [ 0 ] + "|" + aAt [ 1 ] ; if ( ToolPopup . ARROW_LEFT . exec ( sRule ) ) { oThis . _bHorizontalArrow = true ; sDirection = "Left" ; } else if ( ToolPopup . ARROW_RIGHT . exec ( sRule ) ) { oThis . _bHorizontalArrow = true ; sDirection = "Right" ; } else if ( ToolPopup . ARROW_UP . exec ( sRule ) ) { sDirection = "Up" ; } else if ( ToolPopup . ARROW_DOWN . exec ( sRule ) ) { sDirection = "Down" ; } if ( oThis . getDomRef ( ) && oThis . isOpen ( ) ) { var $This = oThis . $ ( ) ; // jQuery Plugin "rect" var oPopRect = $This . rect ( ) ; var $Opener = jQuery ( document . getElementById ( oThis . getOpener ( ) ) ) ; // jQuery Plugin "rect" var oOpenerRect = $Opener . rect ( ) ; if ( oOpenerRect ) { // check if the ToolPopup was positioned at another side relative to the opener due to any collision. if ( oThis . _bHorizontalArrow ) { // left/right arrow var iPopRight = oPopRect . left + $This . outerWidth ( true ) + oThis . iArrowWidth ; var iOpenerRight = oOpenerRect . left + $Opener . outerWidth ( true ) ; if ( iPopRight <= iOpenerRight ) { sDirection = "Right" ; } else { sDirection = "Left" ; } } else { // up/down arrow var iPopBottom = oPopRect . top + $This . outerHeight ( true ) + oThis . iArrowWidth ; var iOpenerBottom = oOpenerRect . top + $Opener . outerHeight ( true ) ; if ( iPopBottom <= iOpenerBottom ) { sDirection = "Down" ; } else { sDirection = "Up" ; } } } } } return sDirection ; }
Calculates the desired arrow direction related to the set docking.
This only works when "my" and "at" both use the jQuery-based docking which means they are strings like "begin top".

@param {sap.ui.ux3.ToolPopup} oThis the instance of the ToolPopup
@returns {string} with arrow's direction
@private
Calculates the desired arrow direction related to the set docking . This only works when my and at both use the jQuery - based docking which means they are strings like begin top .