Skip to content

Commit

Permalink
Fix the text that gets cut off if it occupies 2 lines in imagetext
Browse files Browse the repository at this point in the history
* Add a workaround for the alignment bug
  • Loading branch information
Zailer43 committed Sep 7, 2024
1 parent 75f5a68 commit 060f425
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,15 @@ protected void setupButtonsCallbacks(FlowLayout rootComponent) {
FlowLayout algorithmOptionsLayout = rootComponent.childById(FlowLayout.class, "algorithm-options-layout");
BaseFzmmScreen.checkNull(algorithmOptionsLayout, "layout", "algorithm-options-layout");

FlowLayout imageModeLayout = rootComponent.childById(FlowLayout.class, "image-mode-layout");
BaseFzmmScreen.checkNull(imageModeLayout, "layout", "image-mode-layout");

Animation<Sizing> imageLayoutAnimation = imageOptionsLayout.horizontalSizing().animate(100, Easing.LINEAR, Sizing.expand(100));
Animation<Sizing> algorithmLayoutAnimationHorizontal = algorithmOptionsLayout.horizontalSizing().animate(100, Easing.LINEAR, Sizing.expand(100));
Animation<Sizing> algorithmLayoutAnimationVertical = algorithmOptionsLayout.verticalSizing().animate(100, Easing.LINEAR, Sizing.content());
this.smallGuiAnimation = Animation.compose(imageLayoutAnimation, algorithmLayoutAnimationHorizontal, algorithmLayoutAnimationVertical);
// workaround to fix alignment issue (owo-lib sizing rounds up related)
Animation<Sizing> imageModeFixAnimation = imageModeLayout.horizontalSizing().animate(100, Easing.LINEAR, Sizing.expand(100));
this.smallGuiAnimation = Animation.compose(imageLayoutAnimation, algorithmLayoutAnimationHorizontal, algorithmLayoutAnimationVertical, imageModeFixAnimation);

this.setSmallGuiAnimation(this.width);
}
Expand Down
24 changes: 8 additions & 16 deletions src/main/resources/assets/fzmm/owo_ui/imagetext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</fzmm.styled-flow-layout>
</children>

<gap>2</gap>
<gap>6</gap>
</fzmm.styled-flow-layout>

<fzmm.styled-flow-layout direction="vertical">
Expand All @@ -79,7 +79,7 @@
<horizontal method="expand">100</horizontal>
</sizing>

<gap>2</gap>
<gap>6</gap>
</fzmm.styled-flow-layout>

<fzmm.boolean-button id="preserveImageAspectRatio">
Expand Down Expand Up @@ -118,7 +118,7 @@
</template>

</children>
<gap>3</gap>
<gap>6</gap>

<padding>
<all>6</all>
Expand All @@ -135,7 +135,7 @@
causing them to occupy 2 lines instead of 1
-->
<horizontal method="fill">49</horizontal>
<vertical method="fixed">148</vertical>
<vertical method="fixed">170</vertical>
</sizing>
</fzmm.styled-flow-layout>

Expand Down Expand Up @@ -165,6 +165,7 @@
<id>characters-text-box</id>
</template>
</children>

</fzmm.screen-tab>
<fzmm.screen-tab>
<id>algorithm.braille</id>
Expand All @@ -191,6 +192,7 @@
<margins>
<bottom>1</bottom>
</margins>

</fzmm.screen-tab>

</children>
Expand All @@ -205,12 +207,12 @@

<sizing>
<horizontal method="fill">50</horizontal>
<vertical method="fixed">148</vertical>
<vertical method="fixed">170</vertical>
</sizing>
</fzmm.styled-flow-layout>

<!-- image mode -->
<fzmm.styled-flow-layout direction="vertical">
<fzmm.styled-flow-layout direction="vertical" id="image-mode-layout">
<children>
<fzmm.context-menu-button id="mode-button">
<text translate="true">fzmm.gui.imagetext.tab.mode</text>
Expand Down Expand Up @@ -468,10 +470,6 @@
<text translate="true">fzmm.gui.imagetext.option.{{translation-id}}</text>
<tooltip-text translate="true">fzmm.gui.imagetext.option.{{translation-id}}.tooltip</tooltip-text>

<margins>
<top>4</top>
</margins>

<sizing>
<horizontal method="fixed">125</horizontal>
</sizing>
Expand All @@ -486,9 +484,6 @@
<gap>2</gap>
<vertical-alignment>top</vertical-alignment>

<sizing>
<vertical method="fixed">18</vertical>
</sizing>
</fzmm.styled-flow-layout>
</small-option>

Expand All @@ -500,9 +495,6 @@
</small-checkbox>
</children>

<sizing>
<vertical method="expand">100</vertical>
</sizing>
<vertical-alignment>center</vertical-alignment>
</fzmm.styled-flow-layout>
</checkbox-option-type>
Expand Down

0 comments on commit 060f425

Please sign in to comment.