Skip to content

Commit aeb4f35

Browse files
authored
Merge pull request #136 from UCSDOalads/addMoreMouseFunctionality
Add mouse scroll Zoom implemented by dyb previously
2 parents cbb4888 + a9cdb97 commit aeb4f35

15 files changed

Lines changed: 76 additions & 854 deletions

?/.java/fonts/1.8.0_121/fcinfo-1-its-cseb260-28.ucsd.edu-null-null-en.properties

Lines changed: 0 additions & 834 deletions
This file was deleted.

src/actions/ZoomAction.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ public ZoomAction(PaintPanel panel) {
1212
super(panel);
1313
centerX = panel.getWidth() / 2;
1414
centerY = panel.getHeight() / 2;
15+
1516
}
1617

1718
public boolean canPerformAction() {
1819
return true;
1920
}
2021

2122
public void performAction() {
23+
24+
2225
for ( PaintComponent com: panel.getPaintComponents() ) {
2326
int xDifference = com.getX() - centerX;
2427
int yDifference = com.getY() - centerY;

src/actions/ZoomInAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class ZoomInAction extends ZoomAction {
77

88
public ZoomInAction (PaintPanel panel) {
99
super(panel);
10-
this.setZoomValue(0.5);
10+
this.setZoomValue(0.1);
1111
}
1212

1313
@Override

src/actions/ZoomOutAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public class ZoomOutAction extends ZoomAction {
77

88
public ZoomOutAction (PaintPanel panel) {
99
super(panel);
10-
this.setZoomValue(-0.5);
10+
this.setZoomValue(-0.1);
1111
}
1212

1313
@Override

src/painttools/toolbar/ToolBar.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import javax.swing.SwingConstants;
1313

1414
import buttons.ToolButton;
15-
1615
import painttools.tools.AddClassTool;
1716
import painttools.tools.AddInputBoxTool;
1817
import painttools.tools.AddOutputBoxTool;

src/painttools/tools/AddClassTool.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.awt.event.ActionEvent;
44
import java.awt.event.MouseEvent;
5+
import java.awt.event.MouseWheelEvent;
56

67
import actions.AddLazyJavaClassAction;
78
import buttons.ToolButton;
@@ -101,14 +102,17 @@ public void mouseMoved(MouseEvent e) {
101102

102103
}
103104

105+
@Override
106+
public void mouseWheelMoved(MouseWheelEvent e) {
107+
// TODO Auto-generated method stub
108+
109+
}
110+
104111
/**
105112
* change the cursor when add button is clicked
106113
*/
107114
@Override
108115
public void actionPerformed(ActionEvent e) {
109116
panel.setNewCursor (CustomCursors.addComponentcursor());
110117
}
111-
112-
113-
114118
}

src/painttools/tools/AddInputBoxTool.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.awt.event.ActionEvent;
44
import java.awt.event.MouseEvent;
5+
import java.awt.event.MouseWheelEvent;
56

67
import actions.AddDataInputBoxAction;
78
import buttons.ToolButton;
@@ -101,6 +102,12 @@ public void mouseMoved(MouseEvent e) {
101102

102103
}
103104

105+
@Override
106+
public void mouseWheelMoved(MouseWheelEvent e) {
107+
// TODO Auto-generated method stub
108+
109+
}
110+
104111
/**
105112
* change the cursor when add button is clicked
106113
*/
@@ -110,7 +117,4 @@ public void actionPerformed(ActionEvent e) {
110117
panel.setNewCursor (CustomCursors.addComponentcursor());
111118

112119
}
113-
114-
115-
116120
}

src/painttools/tools/AddMethodTool.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.awt.event.ActionEvent;
44
import java.awt.event.ActionListener;
55
import java.awt.event.MouseEvent;
6+
import java.awt.event.MouseWheelEvent;
67

78
import javax.swing.ImageIcon;
89

@@ -112,8 +113,10 @@ public void actionPerformed(ActionEvent e) {
112113

113114
}
114115

115-
116-
117-
116+
@Override
117+
public void mouseWheelMoved(MouseWheelEvent e) {
118+
// TODO Auto-generated method stub
119+
120+
}
118121

119122
}

src/painttools/tools/AddOutputBoxTool.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.awt.event.ActionEvent;
44
import java.awt.event.MouseEvent;
5+
import java.awt.event.MouseWheelEvent;
56

67
import actions.AddDataDisplayBoxAction;
78
import buttons.ToolButton;
@@ -102,6 +103,12 @@ public void mouseMoved(MouseEvent e) {
102103

103104
}
104105

106+
@Override
107+
public void mouseWheelMoved(MouseWheelEvent e) {
108+
// TODO Auto-generated method stub
109+
110+
}
111+
105112
/**
106113
* change the cursor when add button is clicked
107114
*/
@@ -111,5 +118,4 @@ public void actionPerformed(ActionEvent e) {
111118
}
112119

113120

114-
115121
}

src/painttools/tools/DotTool.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package painttools.tools;
22

33
import java.awt.event.MouseEvent;
4+
import java.awt.event.MouseWheelEvent;
45

56
import buttons.ToolButton;
67
import paintcomponents.SimplePoint;
@@ -48,7 +49,8 @@ public void mouseClicked(MouseEvent e) {
4849
panel.getSelectTool().selectComponent(pointToAdd);
4950

5051
panel.addPaintComponent(pointToAdd);
51-
//panel.toolSelected(panel.getSelectTool());
52+
panel.toolSelected(panel.getSelectTool());
53+
5254
}
5355

5456
@Override
@@ -95,6 +97,10 @@ public void reset() {
9597

9698
}
9799

98-
100+
@Override
101+
public void mouseWheelMoved(MouseWheelEvent e) {
102+
// TODO Auto-generated method stub
103+
104+
}
99105

100106
}

0 commit comments

Comments
 (0)