git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-3210 Improvements to eclipse detection. New src tree and SwingJS updated from...
[jalview.git]
/
src
/
jalview
/
viewmodel
/
OverviewDimensions.java
diff --git
a/src/jalview/viewmodel/OverviewDimensions.java
b/src/jalview/viewmodel/OverviewDimensions.java
index
0235081
..
8dc7dd8
100644
(file)
--- a/
src/jalview/viewmodel/OverviewDimensions.java
+++ b/
src/jalview/viewmodel/OverviewDimensions.java
@@
-26,7
+26,9
@@
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.HiddenSequences;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.HiddenSequences;
+import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics;
+import java.awt.Rectangle;
public abstract class OverviewDimensions
{
public abstract class OverviewDimensions
{
@@
-62,6
+64,8
@@
public abstract class OverviewDimensions
protected float heightRatio;
protected float heightRatio;
+ private Rectangle vpbox = new Rectangle();
+
/**
* Create an OverviewDimensions object
*
/**
* Create an OverviewDimensions object
*
@@
-71,17
+75,23
@@
public abstract class OverviewDimensions
* true if the annotation panel is to be shown, false otherwise
*/
public OverviewDimensions(ViewportRanges ranges,
* true if the annotation panel is to be shown, false otherwise
*/
public OverviewDimensions(ViewportRanges ranges,
- boolean showAnnotationPanel)
+ boolean showAnnotationPanel, Dimension dim)
{
{
+ if (!showAnnotationPanel)
+ {
+ graphHeight = 0;
+ }
+
// scale the initial size of overviewpanel to shape of alignment
float initialScale = (float) ranges.getAbsoluteAlignmentWidth()
/ (float) ranges.getAbsoluteAlignmentHeight();
// scale the initial size of overviewpanel to shape of alignment
float initialScale = (float) ranges.getAbsoluteAlignmentWidth()
/ (float) ranges.getAbsoluteAlignmentHeight();
- if (!showAnnotationPanel)
+ if (dim != null)
{
{
- graphHeight = 0;
+ width = dim.width;
+ sequencesHeight = dim.height;
+ return;
}
}
-
if (ranges.getAbsoluteAlignmentWidth() > ranges
.getAbsoluteAlignmentHeight())
{
if (ranges.getAbsoluteAlignmentWidth() > ranges
.getAbsoluteAlignmentHeight())
{
@@
-114,6
+124,9
@@
public abstract class OverviewDimensions
*/
public void drawBox(Graphics g)
{
*/
public void drawBox(Graphics g)
{
+ // System.out.println("OD drawBox " + boxX + " " + boxY + " " + boxWidth
+ // + " " + boxHeight);
+ updateBox();
g.drawRect(boxX, boxY, boxWidth, boxHeight);
g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2);
}
g.drawRect(boxX, boxY, boxWidth, boxHeight);
g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2);
}
@@
-178,6
+191,9
@@
public abstract class OverviewDimensions
public void setHeight(int h)
{
public void setHeight(int h)
{
+ // BH 2019 problem was that component.resize() can come
+ // after setBoxPosition().
+ // Solution was to move setting of box dimensions to paint
sequencesHeight = h - graphHeight;
heightRatio = (float) alheight / sequencesHeight;
}
sequencesHeight = h - graphHeight;
heightRatio = (float) alheight / sequencesHeight;
}
@@
-276,17
+292,22
@@
public abstract class OverviewDimensions
int vpheight)
{
resetAlignmentDims();
int vpheight)
{
resetAlignmentDims();
+ vpbox = new Rectangle(startRes, startSeq, vpwidth, vpheight);
+ updateBox();
+ }
+ public void updateBox()
+ {
// boxX, boxY is the x,y location equivalent to startRes, startSeq
// boxX, boxY is the x,y location equivalent to startRes, startSeq
- int xPos = Math.min(startRes, alwidth - vpwidth + 1);
+ int xPos = Math.min(vpbox.x, alwidth - vpbox.width + 1);
boxX = Math.round(xPos / widthRatio);
boxX = Math.round(xPos / widthRatio);
- boxY = Math.round(startSeq / heightRatio);
+ boxY = Math.round(vpbox.y / heightRatio);
// boxWidth is the width in residues translated to pixels
// boxWidth is the width in residues translated to pixels
- boxWidth = Math.round(vpwidth / widthRatio);
+ boxWidth = Math.max(1, Math.round(vpbox.width / widthRatio));
// boxHeight is the height in sequences translated to pixels
// boxHeight is the height in sequences translated to pixels
- boxHeight = Math.round(vpheight / heightRatio);
+ boxHeight = Math.max(1, Math.round(vpbox.height / heightRatio));
}
/**
}
/**