import javax.swing.JPanel;
import jalview.api.AlignViewportI;
+import jalview.bin.Cache;
/**
* DOCUMENT ME!
AlignmentPanel ap;
- private boolean manuallyAdjusted = false;
-
/**
* Creates a new IdwidthAdjuster object.
*
/*
* don't drag below minimum width
*/
- if (newWidth < MIN_ID_WIDTH)
+ if (newWidth < MIN_ID_WIDTH || newWidth > this.ap.getWidth())
{
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;
}
+
+ // TODO JAL-4260 - work out how to trigger recomputation of wrapped pages !
+ int curCol = viewport.getRanges().getStartRes()
+ + viewport.getRanges().getViewportWidth();
+
viewport.setIdWidth(newWidth);
+
ap.validateAnnotationDimensions(false);
+ if (viewport.getWrapAlignment())
+ {
+ viewport.getRanges().scrollToWrappedVisible(
+ curCol - viewport.getRanges().getViewportWidth());
+ }
ap.paintAlignment(true, false);
- manuallyAdjusted = true;
+ ap.getIdPanel().getIdCanvas().setManuallyAdjusted(true);
}
public void setWidth(int newWidth)
{
- if (newWidth < MIN_ID_WIDTH)
+ if (newWidth < MIN_ID_WIDTH
+ || ap.getIdPanel().getIdCanvas().isManuallyAdjusted())
{
return;
}
public boolean manuallyAdjusted()
{
- return manuallyAdjusted;
+ return ap.getIdPanel().getIdCanvas().isManuallyAdjusted();
}
@Override
@Override
public void paintComponent(Graphics g)
{
+ int width = getWidth();
+ int height = getHeight();
g.setColor(Color.white);
- g.fillRect(0, 0, getWidth(), getHeight());
+ g.fillRect(0, 0, width, height);
+
+ if (!Cache.getDefault(AnnotationLabels.RESIZE_MARGINS_MARK_PREF, false))
+ // && !ap.getAlignViewport().getWrapAlignment()) // now allowing adjustment
+ // in wrap mode
+ {
+ int spacer = Math.max(2, AnnotationLabels.HEIGHT_ADJUSTER_HEIGHT / 4);
+ g.setColor(Color.LIGHT_GRAY);
+ g.drawLine(width - 3 * spacer, 0, width - 3 * spacer, height / 2);
+ g.drawLine(width - spacer, 0, width - spacer, height / 2);
+ }
+
setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR));
}
}