Fix[control-editor]: context buttons reaching out of the screen

This commit is contained in:
Mathias Boulay 2023-10-13 22:24:41 +02:00
parent b624b3123f
commit d3263581c3

View File

@ -47,7 +47,7 @@ public class ActionRow extends LinearLayout {
};
private final ActionButtonInterface[] actionButtons = new ActionButtonInterface[3];
private View mFollowedView = null;
private final int mSide = SIDE_TOP;
private final int mSide = SIDE_AUTO;
/** Add action buttons and configure them */
private void init(){
@ -123,10 +123,7 @@ public class ActionRow extends LinearLayout {
ViewGroup parent = ((ViewGroup) mFollowedView.getParent());
if(parent == null) return mSide;//Value should not matter
int side = mFollowedView.getX() + getWidth()/2f > parent.getWidth()/2f
? SIDE_LEFT
: SIDE_RIGHT;
int side = SIDE_TOP;
float futurePos = getYPosition(side);
if(futurePos + getHeight() > (parent.getHeight() + getHeight()/2f)){
side = SIDE_TOP;