Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#212] Remove extra white-space in PersonListCard #213

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/resources/view/PersonListCard.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<padding>
<Insets top="5" right="5" bottom="5" left="15" />
</padding>
<HBox spacing="5" alignment="CENTER_LEFT">
<HBox spacing="0.5" alignment="CENTER_LEFT">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still curious how changing 5 -> 0.5 results in halving of the spacing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@damithc

The spacing attribute in the HBox only affects the horizontal space between the direct child elements of the HBox, not the spacing within the content of those child elements. In your case, the HBox contains two Label elements: one for the ID and one for the name. The spacing attribute adjusts the space between these two Label elements, not the space between characters within the text of each Label.

  1. HBox Spacing: The spacing="0.5" in the HBox affects the space between its direct children, which are the Label elements with fx:id="id" and fx:id="name". This means it reduces the space between the ID and the name labels.

  2. Text Content: The spacing within the text content of a Label (such as spaces between words or characters) is not affected by the HBox’s spacing attribute. This spacing is managed by the text rendering engine and the font metrics, which are not controlled by the HBox.

  3. Effect on Layout:

    • Between Labels: The reduced spacing value (0.5) decreases the space between the two Label elements, making them appear closer together.
    • Within Labels: The spacing between words or characters within the text of each Label remains unchanged because it’s controlled by the font and text properties.

In summary, the spacing attribute in the HBox controls the space between its child elements (the Labels), not the space within the text content of those child elements. This is why changing the spacing value only affects the distance between the ID and name labels, not the spacing within the words in the labels.

Copy link
Contributor Author

@baskargopinath baskargopinath Jun 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is why the spacing between words is fine but the issue was only between the index and name

(Index) [SPACE] (name)

Also the changing of the value to 0.5 is not by some exact form of calculation or formula,

it was more through reducing the value and seeing the reflected change in the UI until the reduction resulted in what looked like a halving of the space

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was thinking if i should add this to the commit message body but i didnt want it to be too long

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was thinking if i should add this to the commit message body but i didnt want it to be too long

You can mention it briefly i.e., you are adjusting the spacing attribute, which determines the spacing between child elements, and the value 0.5 seems to produce the desired gap.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay will do it @damithc

<Label fx:id="id" styleClass="cell_big_label">
<minWidth>
<!-- Ensures that the label text is never truncated -->
Expand Down