Saturday, February 10, 2007

Refactoring

I was able to talk with Dondi about how I could fix the problems I was having with the Drawable objects in Jig. Dondi suggested removing transient data from drawable objects and make a distinction from magnets and vertices.

All Drawable objects had to implement a method called haveIBeenClicked(Point p), which would return true if if the drawable had been clicked(or hovered over) and false otherwise. The problem though is that the mouse cursor can click different parts of the Drawable to cause different effects. For example, if a user clicks on a single vertex, then the user can simply move that vertex, but if the user is clicking on the Drawable as a whole, then moving would cause the whole Drawable to move. Those different functionalities can't be abstracted out of a single method. So it was decided to create a utilities class with static methods to determine what part of the Drawable had been hit.

The other change is to separate vertices from magnets. Currently there is a magnet object that tries to be both, the only problem is that vertices and magnets are different things. So Drawables will now contain Magnets and Vertices.

I'll post some javadocs on the changed classes later.

3 comments:

B.J. Johnson said...

Sounds like you are making good progress. One (late) suggestion, you can tell the different clicks apart by using different mouse buttons; left click and drag to do a simple point (vertex) move, right click and drag to move the entire shape. Something like that. . .

Dondi said...

Some notes from our 2/28 meeting:

Main milestones:
- Determine an interface for a Jig plug-in.
- Serve up POAP as a Jig plug-in.
- Serve up MOSAIC as a Jig plug-in.

Nice to do but not necessarily critical path:
- Tweak the drawing tool to revert to Pointer after an object is drawn.

Dondi said...

One more thing...before we dive into the plug-ins, let's write up the use case models for the POAP/Jig and MOSAIC/Jig plug-ins, respectively.

Doesn't have to be full-on-fancy UML; just convey complete information on what these plug-ins do, and how they tie Jig and POAP/MOSAIC together.