boolean applyToAllViews = false;
- // Controller controller;
public RotatableCanvas(AlignmentPanel ap)
{
this.av = ap.av;
addMouseWheelListener(new MouseWheelListener()
{
+ @Override
public void mouseWheelMoved(MouseWheelEvent e)
{
- if (e.getWheelRotation() > 0)
+ double wheelRotation = e.getPreciseWheelRotation();
+ if (wheelRotation > 0)
{
+ /*
+ * zoom in
+ */
scale = (float) (scale * 1.1);
repaint();
}
-
- else
+ else if (wheelRotation < 0)
{
+ /*
+ * zoom out
+ */
scale = (float) (scale * 0.9);
repaint();
}
boolean first = true;
+ @Override
public void setPoints(Vector points, int npoint)
{
this.points = points;
dim = height;
}
- return (float) ((dim * scalefactor) / (2 * maxwidth));
+ return (dim * scalefactor) / (2 * maxwidth);
}
/**
*
* @return DOCUMENT ME!
*/
+ @Override
public Dimension getPreferredSize()
{
if (prefsize != null)
*
* @return DOCUMENT ME!
*/
+ @Override
public Dimension getMinimumSize()
{
return getPreferredSize();
* @param g
* DOCUMENT ME!
*/
+ @Override
public void paintComponent(Graphics g1)
{
for (int i = 0; i < npoint; i++)
{
SequencePoint sp = (SequencePoint) points.elementAt(i);
- int x = (int) ((float) (sp.coord[0] - centre[0]) * scale) + halfwidth;
- int y = (int) ((float) (sp.coord[1] - centre[1]) * scale)
+ int x = (int) ((sp.coord[0] - centre[0]) * scale) + halfwidth;
+ int y = (int) ((sp.coord[1] - centre[1]) * scale)
+ halfheight;
float z = sp.coord[1] - centre[2];
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void keyTyped(KeyEvent evt)
{
}
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void keyReleased(KeyEvent evt)
{
}
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void keyPressed(KeyEvent evt)
{
if (evt.getKeyCode() == KeyEvent.VK_UP)
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseClicked(MouseEvent evt)
{
}
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseEntered(MouseEvent evt)
{
}
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseExited(MouseEvent evt)
{
}
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseReleased(MouseEvent evt)
{
}
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mousePressed(MouseEvent evt)
{
int x = evt.getX();
// controller.handleSequenceSelectionEvent(new
// SequenceSelectionEvent(this,sel));
// }
+ @Override
public void mouseMoved(MouseEvent evt)
{
SequenceI found = findPoint(evt.getX(), evt.getY());
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseDragged(MouseEvent evt)
{
mx = evt.getX();
{
rotmat.setIdentity();
- rotmat.rotate((float) (my - omy), 'x');
- rotmat.rotate((float) (mx - omx), 'y');
+ rotmat.rotate(my - omy, 'x');
+ rotmat.rotate(mx - omx, 'y');
for (int i = 0; i < npoint; i++)
{
{
SequencePoint sp = (SequencePoint) points.elementAt(i);
int tmp1 = (int) (((sp.coord[0] - centre[0]) * scale)
- + ((float) getWidth() / 2.0));
+ + (getWidth() / 2.0));
int tmp2 = (int) (((sp.coord[1] - centre[1]) * scale)
- + ((float) getHeight() / 2.0));
+ + (getHeight() / 2.0));
if ((tmp1 > x1) && (tmp1 < x2) && (tmp2 > y1) && (tmp2 < y2))
{
for (int i = 0; i < npoint; i++)
{
SequencePoint sp = (SequencePoint) points.elementAt(i);
- int px = (int) ((float) (sp.coord[0] - centre[0]) * scale)
+ int px = (int) ((sp.coord[0] - centre[0]) * scale)
+ halfwidth;
- int py = (int) ((float) (sp.coord[1] - centre[1]) * scale)
+ int py = (int) ((sp.coord[1] - centre[1]) * scale)
+ halfheight;
if ((Math.abs(px - x) < 3) && (Math.abs(py - y) < 3))