1
2
3
4
5
6
7
8
9
10
11 package edu.uci.ics.jung.visualization.control;
12
13 import java.awt.event.MouseWheelEvent;
14
15 import edu.uci.ics.jung.visualization.VisualizationViewer;
16
17
18
19
20
21
22
23
24
25 public class SatelliteScalingGraphMousePlugin extends ScalingGraphMousePlugin {
26
27 public SatelliteScalingGraphMousePlugin(ScalingControl scaler, int modifiers) {
28 super(scaler, modifiers);
29 }
30
31 public SatelliteScalingGraphMousePlugin(ScalingControl scaler, int modifiers, float in, float out) {
32 super(scaler, modifiers, in, out);
33 }
34
35
36
37
38
39 public void mouseWheelMoved(MouseWheelEvent e) {
40 boolean accepted = checkModifiers(e);
41 if(accepted == true) {
42 VisualizationViewer vv = (VisualizationViewer)e.getSource();
43
44 if(vv instanceof SatelliteVisualizationViewer) {
45 VisualizationViewer vvMaster =
46 ((SatelliteVisualizationViewer)vv).getMaster();
47
48 int amount = e.getWheelRotation();
49
50 if(amount > 0) {
51 scaler.scale(vvMaster, in, vvMaster.getCenter());
52
53 } else if(amount < 0) {
54 scaler.scale(vvMaster, out, vvMaster.getCenter());
55 }
56 e.consume();
57 vv.repaint();
58 }
59 }
60 }
61
62
63 }