Line | Hits | Source |
---|---|---|
1 | /* | |
2 | * Copyright (c) 2005, the JUNG Project and the Regents of the University of | |
3 | * California All rights reserved. | |
4 | * | |
5 | * This software is open-source under the BSD license; see either "license.txt" | |
6 | * or http://jung.sourceforge.net/license.txt for a description. | |
7 | * | |
8 | * Created on Aug 15, 2005 | |
9 | */ | |
10 | ||
11 | package edu.uci.ics.jung.visualization.control; | |
12 | ||
13 | import java.awt.event.MouseWheelEvent; | |
14 | import java.awt.geom.Point2D; | |
15 | ||
16 | import edu.uci.ics.jung.visualization.VisualizationViewer; | |
17 | import edu.uci.ics.jung.visualization.transform.MutableTransformer; | |
18 | ||
19 | /** | |
20 | * Overrides ScalingGraphMousePlugin so that mouse events in the | |
21 | * satellite view will cause scaling in the main view | |
22 | * | |
23 | * @see ScalingGraphMousePlugin | |
24 | * @author Tom Nelson - RABA Technologies | |
25 | * | |
26 | */ | |
27 | public class SatelliteScalingGraphMousePlugin extends ScalingGraphMousePlugin { | |
28 | ||
29 | public SatelliteScalingGraphMousePlugin(ScalingControl scaler, int modifiers) { | |
30 | 0 | super(scaler, modifiers); |
31 | 0 | } |
32 | ||
33 | public SatelliteScalingGraphMousePlugin(ScalingControl scaler, int modifiers, float in, float out) { | |
34 | 0 | super(scaler, modifiers, in, out); |
35 | 0 | } |
36 | ||
37 | /** | |
38 | * zoom the master view display in or out, depending on the direction of the | |
39 | * mouse wheel motion. | |
40 | */ | |
41 | public void mouseWheelMoved(MouseWheelEvent e) { | |
42 | 0 | boolean accepted = checkModifiers(e); |
43 | 0 | if(accepted == true) { |
44 | 0 | VisualizationViewer vv = (VisualizationViewer)e.getSource(); |
45 | ||
46 | 0 | if(vv instanceof SatelliteVisualizationViewer) { |
47 | 0 | VisualizationViewer vvMaster = |
48 | ((SatelliteVisualizationViewer)vv).getMaster(); | |
49 | ||
50 | 0 | int amount = e.getWheelRotation(); |
51 | ||
52 | 0 | if(amount > 0) { |
53 | 0 | scaler.scale(vvMaster, in, vvMaster.getCenter()); |
54 | ||
55 | 0 | } else if(amount < 0) { |
56 | 0 | scaler.scale(vvMaster, out, vvMaster.getCenter()); |
57 | } | |
58 | 0 | e.consume(); |
59 | 0 | vv.repaint(); |
60 | } | |
61 | } | |
62 | 0 | } |
63 | ||
64 | ||
65 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |