trackeditor: scroll by dragging with scroll wheel button down
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9305 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
parent
c5bcd12fca
commit
d92eeccc8a
|
@ -9,6 +9,7 @@ import java.awt.Color;
|
|||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
@ -40,6 +41,8 @@ import javax.swing.JComponent;
|
|||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.JViewport;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.event.PopupMenuEvent;
|
||||
import javax.swing.event.PopupMenuListener;
|
||||
|
||||
|
@ -146,6 +149,8 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
private boolean reliefDragging = false;
|
||||
private Point2D.Double reliefOffset = new Point2D.Double();
|
||||
|
||||
/** mouse presses point */
|
||||
private Point origin = new Point();
|
||||
/** mouse pressed point, in meters */
|
||||
Point2D.Double clickPoint = new Point2D.Double(0, 0);
|
||||
/** mouse current point, in meters */
|
||||
|
@ -739,6 +744,8 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
{
|
||||
if (editorFrame.getTrackData() == null)
|
||||
return;
|
||||
|
||||
origin = e.getPoint();
|
||||
|
||||
if (e.getButton() == MouseEvent.BUTTON3)
|
||||
{
|
||||
|
@ -1017,7 +1024,7 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
if (editorFrame.getTrackData() == null)
|
||||
return;
|
||||
|
||||
if (e.getModifiers() == 4)
|
||||
if (e.getModifiers() == 4) // right button
|
||||
{
|
||||
if (objectShape != null && objectDragging == true)
|
||||
{
|
||||
|
@ -1082,6 +1089,21 @@ public class CircuitView extends JComponent implements KeyListener, MouseListene
|
|||
repaint();
|
||||
}
|
||||
}
|
||||
else if (e.getModifiers() == 8) // middle button
|
||||
{
|
||||
JViewport viewPort = (JViewport) SwingUtilities.getAncestorOfClass(JViewport.class, this);
|
||||
if (viewPort != null)
|
||||
{
|
||||
int deltaX = origin.x - e.getX();
|
||||
int deltaY = origin.y - e.getY();
|
||||
|
||||
Rectangle view = viewPort.getViewRect();
|
||||
view.x += deltaX;
|
||||
view.y += deltaY;
|
||||
|
||||
scrollRectToVisible(view);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
screenToReal(e, mousePoint);
|
||||
|
|
|
@ -34,7 +34,7 @@ public class Properties
|
|||
private static Properties instance = new Properties();
|
||||
private Vector<ActionListener> propertiesListeners = new Vector<ActionListener>();
|
||||
public final String title = "sd2-trackeditor";
|
||||
public final String version = "1.4.32";
|
||||
public final String version = "1.4.33";
|
||||
private String path;
|
||||
|
||||
private double imageScale = 1;
|
||||
|
|
Loading…
Reference in New Issue