feat(control): allow subbuttons of free orientation drawer change size

This commit is contained in:
DreamOneX 2023-08-02 14:26:08 +08:00 committed by ArtDev
parent 403c962ed2
commit 67a3cc5dc0
2 changed files with 6 additions and 4 deletions

View File

@ -88,7 +88,7 @@ public class ControlDrawer extends ControlButton {
private void resizeButtons(){ private void resizeButtons(){
if (buttons == null) return; if (buttons == null || drawerData.orientation == ControlDrawerData.Orientation.FREE) return;
for(ControlSubButton subButton : buttons){ for(ControlSubButton subButton : buttons){
subButton.mProperties.setWidth(mProperties.getWidth()); subButton.mProperties.setWidth(mProperties.getWidth());
subButton.mProperties.setHeight(mProperties.getHeight()); subButton.mProperties.setHeight(mProperties.getHeight());

View File

@ -21,8 +21,10 @@ public class ControlSubButton extends ControlButton {
} }
private void filterProperties(){ private void filterProperties(){
mProperties.setHeight(parentDrawer.getProperties().getHeight()); if (parentDrawer != null && parentDrawer.drawerData.orientation != ControlDrawerData.Orientation.FREE) {
mProperties.setWidth(parentDrawer.getProperties().getWidth()); mProperties.setHeight(parentDrawer.getProperties().getHeight());
mProperties.setWidth(parentDrawer.getProperties().getWidth());
}
mProperties.isDynamicBtn = false; mProperties.isDynamicBtn = false;
setProperties(mProperties, false); setProperties(mProperties, false);
@ -35,7 +37,7 @@ public class ControlSubButton extends ControlButton {
@Override @Override
public void setLayoutParams(ViewGroup.LayoutParams params) { public void setLayoutParams(ViewGroup.LayoutParams params) {
if(parentDrawer != null){ if(parentDrawer != null && parentDrawer.drawerData.orientation != ControlDrawerData.Orientation.FREE){
params.width = (int)parentDrawer.mProperties.getWidth(); params.width = (int)parentDrawer.mProperties.getWidth();
params.height = (int)parentDrawer.mProperties.getHeight(); params.height = (int)parentDrawer.mProperties.getHeight();
} }