public void paintComponent(Graphics g)
{
invalidate(); // needed so that the id width adjuster works correctly
-
Dimension d = getIdPanel().getIdCanvas().getPreferredSize();
- idPanelHolder.setPreferredSize(d);
- hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));
+ int idWidth = d.width;
+
+ // check wrapped alignment as at least 1 residue width
+ if (av.getWrapAlignment())
+ {
+ SeqCanvas sc = this.getSeqPanel().seqCanvas;
+ if (sc != null && sc.getWidth() < sc.getMinimumWrappedCanvasWidth())
+ {
+ // need to make some adjustments
+ idWidth -= (sc.getMinimumWrappedCanvasWidth() - sc.getWidth());
+ av.setIdWidth(idWidth);
+ validateAnnotationDimensions(false);
+ }
+ }
+
+ idPanelHolder.setPreferredSize(new Dimension(idWidth, d.height));
+ hscrollFillerPanel.setPreferredSize(new Dimension(idWidth, 12));
validate(); // needed so that the id width adjuster works correctly
return;
}
+ /*
+ * don't allow residue width to be < 1 in wrapped format
+ */
+ if (viewport.getWrapAlignment())
+ {
+ SeqCanvas sc = ap.getSeqPanel().seqCanvas;
+ if (sc != null && sc.getWrappedCanvasWidth(sc.getWidth() - dif) < 1)
+ {
+ return;
+ }
+ }
+
oldX = evt.getX();
/*
return (canvasWidth - labelWidthEast - labelWidthWest) / charWidth;
}
+ public int getMinimumWrappedCanvasWidth()
+ {
+ int charWidth = av.getCharWidth();
+ FontMetrics fm = getFontMetrics(av.getFont());
+ int labelWidth = 0;
+ if (av.getScaleRightWrapped() || av.getScaleLeftWrapped())
+ {
+ labelWidth = getLabelWidth(fm);
+ }
+ labelWidthEast = av.getScaleRightWrapped() ? labelWidth : 0;
+ labelWidthWest = av.getScaleLeftWrapped() ? labelWidth : 0;
+ return labelWidthEast + labelWidthWest + charWidth;
+ }
+
/**
* Returns a pixel width sufficient to show the largest sequence coordinate
* (end position) in the alignment, calculated as the FontMetrics width of