Skip to content

Commit

Permalink
Fix image crop when using stem table
Browse files Browse the repository at this point in the history
  • Loading branch information
Spayralbe committed Nov 22, 2023
1 parent f26d572 commit 4f43f5b
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public class MappingPanel extends JPanel implements MouseListener, MouseMotionLi
public static final int MIN_SPACE_BETWEEN_COLUMNS = 200;
public static final int ARROW_START_WIDTH = 50;
public static final int BORDER_HEIGHT = 25;
// Extra margin between header and first item when using stem table
public static final int STEM_HEIGHT_MARGIN = ITEM_HEIGHT / 2;

private int sourceX;
private int cdmX;
Expand Down Expand Up @@ -240,7 +242,7 @@ private void setLabeledRectanglesLocation(List<LabeledRectangle> components, int
int y = HEADER_HEIGHT + HEADER_TOP_MARGIN;
if (ObjectExchange.etl.hasStemTable()) {
// Move all non-stem items
y = HEADER_TOP_MARGIN + ITEM_HEIGHT;
y += STEM_HEIGHT_MARGIN;
}
for (LabeledRectangle component : components) {
// Exception for laying out the stem table
Expand All @@ -264,8 +266,11 @@ private void setLabeledRectanglesLocation(List<LabeledRectangle> components, int
public Dimension getMinimumSize() {
Dimension dimension = new Dimension();
dimension.width = 2 * (ITEM_WIDTH + MARGIN) + MIN_SPACE_BETWEEN_COLUMNS;
dimension.height = Math.min(HEADER_HEIGHT + HEADER_TOP_MARGIN + Math.max(sourceComponents.size(), cdmComponents.size()) * (ITEM_HEIGHT + MARGIN),
maxHeight);
int componentsHeight = Math.max(sourceComponents.size(), cdmComponents.size()) * (ITEM_HEIGHT + MARGIN);
dimension.height = Math.min(HEADER_HEIGHT + HEADER_TOP_MARGIN + componentsHeight, maxHeight);
if (ObjectExchange.etl.hasStemTable()) {
dimension.height += STEM_HEIGHT_MARGIN;
}

return dimension;
}
Expand Down

0 comments on commit 4f43f5b

Please sign in to comment.