Skip to content

Commit

Permalink
Fix toggle info box without wobble (#777)
Browse files Browse the repository at this point in the history
toggle visibility without view jumping

---------

Co-authored-by: Tobias Koch <[email protected]>
  • Loading branch information
sven1103 and KochTobi authored Aug 13, 2024
1 parent 26742f5 commit a0fe53d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.value.ValueChangeMode;
import com.vaadin.flow.dom.Style.Visibility;
import com.vaadin.flow.router.BeforeEnterEvent;
import com.vaadin.flow.router.BeforeEnterObserver;
import com.vaadin.flow.router.Route;
Expand Down Expand Up @@ -536,7 +537,11 @@ private void routeToRawData(ComponentEvent<?> componentEvent) {
private void setSelectedMeasurementsInfo(int selectedMeasurements) {
String text = "%s measurements are currently selected.".formatted(
String.valueOf(selectedMeasurements));
measurementsSelectedInfoBox.setVisible(selectedMeasurements > 0);
if (selectedMeasurements > 0) {
measurementsSelectedInfoBox.getStyle().setVisibility(Visibility.INITIAL);
} else {
measurementsSelectedInfoBox.getStyle().setVisibility(Visibility.HIDDEN);
}
measurementsSelectedInfoBox.setText(text);
}
}

0 comments on commit a0fe53d

Please sign in to comment.