Skip to content

Commit

Permalink
pcorlessGH-272 Fixes AnnotationSummaryBox size update
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Tâche committed Oct 20, 2023
1 parent 01e3701 commit f34e740
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ public String getDebuggable() {
}

@Override
public void setFontSize(final int size) {
public void setFontSize(final float size) {
titleLabel.setFont(titleLabel.getFont().deriveFont(size));
creationLabel.setFont(titleLabel.getFont().deriveFont(size));
textArea.setFont(titleLabel.getFont().deriveFont(size));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public interface AnnotationSummaryComponent {
*
* @param size The new font size
*/
void setFontSize(int size);
void setFontSize(float size);

/**
* Sets the font family
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public String getDebuggable() {
}

@Override
public void setFontSize(final int size) {
public void setFontSize(final float size) {
components.forEach(c -> c.setFontSize(size));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ private class PropertyListener implements PropertyChangeListener {
@Override
public void propertyChange(final PropertyChangeEvent evt) {
final Object newValue = evt.getNewValue();
final Object oldValue = evt.getOldValue();
final String propertyName = evt.getPropertyName();
if (PropertyConstants.ANNOTATION_SUMMARY_BOX_FONT_SIZE_CHANGE.equals(propertyName)) {
final Component[] comps = panel.getDraggableAnnotationPanel().getComponents();
for (final Component component : comps) {
if (component instanceof AnnotationSummaryComponent) {
((AnnotationSummaryComponent) component).setFontSize((int) newValue);
((AnnotationSummaryComponent) component).setFontSize((float) newValue);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,15 @@ void addFontListeners() {
final ValueLabelItem tmp = (ValueLabelItem) fontSizeBox.getSelectedItem();
// fire the font size property change event.
if (tmp != null) {
final int value = (int) tmp.getValue();
if (annotationNamedColorPanels != null) {
for (final ColorLabelPanel colorLabelPanel : annotationNamedColorPanels) {
colorLabelPanel.firePropertyChange(PropertyConstants.ANNOTATION_SUMMARY_BOX_FONT_SIZE_CHANGE,
0, (int) tmp.getValue());
0, (float) value);
}
}
propertiesManager.setInt(ViewerPropertiesManager.PROPERTY_ANNOTATION_SUMMARY_FONT_SIZE,
(int) tmp.getValue());
setFontSize((int) tmp.getValue());
propertiesManager.setInt(ViewerPropertiesManager.PROPERTY_ANNOTATION_SUMMARY_FONT_SIZE, value);
setFontSize(value);
}
});
summaryPanel.getFontNameBox().addItemListener(itemEvent -> {
Expand Down

0 comments on commit f34e740

Please sign in to comment.