# HG changeset patch # User Peter Hofer # Date 1321628409 -3600 # Node ID bb3337727ab6145c32b31baa8e0788a77e0c98e1 # Parent 3c31c42c0cd3db0b07500e47f97882e624b60f36 IdealGraphVisualizer: scroll wheel pans now and zooms only with Ctrl pressed diff -r 3c31c42c0cd3 -r bb3337727ab6 src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java --- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java Fri Nov 18 14:24:27 2011 +0100 +++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramScene.java Fri Nov 18 16:00:09 2011 +0100 @@ -58,6 +58,7 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; @@ -287,11 +288,13 @@ setSelectedObjects(selectedObjects); } }; - + private MouseWheelListener mouseWheelListener = new MouseWheelListener() { public void mouseWheelMoved(MouseWheelEvent e) { - DiagramScene.this.relayoutWithoutLayout(null); + if (e.isControlDown()) { + DiagramScene.this.relayoutWithoutLayout(null); + } } }; @@ -409,17 +412,16 @@ this.setCheckClipping(true); - this.getInputBindings().setZoomActionModifiers(0); + scrollPane = createScrollPane(); - scrollPane = createScrollPane(); + hoverAction = createObjectHoverAction(); // This panAction handles the event only when the left mouse button is // pressed without any modifier keys, otherwise it will not consume it - // and the selection action will handle the event + // and the selection action (below) will handle the event panAction = new CustomizablePanAction(~0, MouseEvent.BUTTON1_DOWN_MASK); this.getActions().addAction(panAction); - hoverAction = createObjectHoverAction(); selectAction = createSelectAction(); this.getActions().addAction(selectAction); @@ -445,10 +447,13 @@ this.setLayout(LayoutFactory.createAbsoluteLayout()); + this.getInputBindings().setZoomActionModifiers(KeyEvent.CTRL_MASK); zoomAction = ActionFactory.createMouseCenteredZoomAction(1.2); this.getActions().addAction(zoomAction); this.getView().addMouseWheelListener(mouseWheelListener); this.getActions().addAction(ActionFactory.createPopupMenuAction(popupMenuProvider)); + + this.getActions().addAction(ActionFactory.createWheelPanAction()); LayerWidget selectLayer = new LayerWidget(this); this.addChild(selectLayer);