[archstudio-commits] svn commit: r7073 - in /calico/branches/mitchnick2/ics/uci/edu/Calico/UI: MouseInputHandler.java components/palettes/Palettes.java

archstudio-commits-owner at uci.edu archstudio-commits-owner at uci.edu
Fri May 2 16:44:35 PDT 2008


Author: nmangano
Date: Fri May  2 16:44:35 2008
New Revision: 7073

Log:
Made palettes paly nicely with zoom and pan.

Modified:
    calico/branches/mitchnick2/ics/uci/edu/Calico/UI/MouseInputHandler.java
    calico/branches/mitchnick2/ics/uci/edu/Calico/UI/components/palettes/Pa=
lettes.java

Modified: calico/branches/mitchnick2/ics/uci/edu/Calico/UI/MouseInputHandle=
r.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- calico/branches/mitchnick2/ics/uci/edu/Calico/UI/MouseInputHandler.java=
 (original)
+++ calico/branches/mitchnick2/ics/uci/edu/Calico/UI/MouseInputHandler.java=
 Fri May  2 16:44:35 2008
@@ -494,7 +494,11 @@
 							}*/
 						}
 =

-					} else {
+					} =

+					else if (bar.getIndex(mDownCanvas) > -1 && bar.getIndex(e.getCanvasPo=
sition()) > -1) {
+						bar.movePaletteItem(bar.getIndex(mDownCanvas), bar.getIndex(e.getCan=
vasPosition()));
+					}
+					else {
 						if (bar.getScrapAt(mDownCanvas, e.getPosition()) !=3D null) {
 							CellContents contents =3D bar.getScrapAt(mDownCanvas, e.getPosition=
());
 							canvas.applyAction(new AddPremadeScrap(contents.getScraps(), conten=
ts.getRelationships()));

Modified: calico/branches/mitchnick2/ics/uci/edu/Calico/UI/components/palet=
tes/Palettes.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- calico/branches/mitchnick2/ics/uci/edu/Calico/UI/components/palettes/Pa=
lettes.java (original)
+++ calico/branches/mitchnick2/ics/uci/edu/Calico/UI/components/palettes/Pa=
lettes.java Fri May  2 16:44:35 2008
@@ -632,30 +632,7 @@
 		=

 		int index =3D getIndex(p);
 		=

-		int index2 =3D getIndex(dest,true);
-		if(index2 > -1 )
-		{
-			if(isCellEmpty(index2))
-			{
-				cellContents[index2] =3D cellContents[index];
-				cellImages[index2] =3D cellImages[index];
-				=

-				cellhash.put("cell"+index2, cellhash.get("cell"+index));
-				cellhash.put("image"+index2, cellhash.get("image"+index));
-				=

-				deleteCell(index);
-				sendCell(index2);
-				=

-				canvas.applyAction(new PaletteItemMoved() );
-				=

-			}
-			else
-			{
-				debug("Cell " + index2 + " is not empty, cannot move to");
-			}
-			return new CellContents();
-		}
-		else if(index < 0)
+		if(index < 0)
 		{
 			return new CellContents();
 		}
@@ -686,6 +663,31 @@
 		}
 	}
 	=

+	public void movePaletteItem(int index, int index2) {
+		if(index < 0 || index2 < 0 )
+			return;
+		=

+		if(isCellEmpty(index2))
+		{
+			cellContents[index2] =3D cellContents[index];
+			cellImages[index2] =3D cellImages[index];
+			=

+			cellhash.put("cell"+index2, cellhash.get("cell"+index));
+			cellhash.put("image"+index2, cellhash.get("image"+index));
+			=

+			deleteCell(index);
+			sendCell(index2);
+			=

+			canvas.applyAction(new PaletteItemMoved() );
+			=

+		}
+		else
+		{
+			debug("Cell " + index2 + " is not empty, cannot move to");
+		}
+		=

+	}
+	=

 	public Point2D computeMidPoint(ArrayList<Point2D> points) {
 		double midX =3D 0, midY =3D 0;
 		for (Point2D p : points) {
@@ -833,8 +835,6 @@
 		}
 		=

 	}
-	=

-
 =

 =

 }




More information about the archstudio-commits mailing list