Here are my codes for the relevant methods:
/** Returns true if the point (u, v) is on top of the shape */
public boolean on(double u, double v) {
if((u < wd && u > x) && (v < ht && v > y)){
return true;
}
else{
return false;
}
}
/** Changes the position of the shape by dx and dy.
If it was positioned at (x, y), it will now be at (x+dx, y+dy)*/
public void moveBy(double dx, double dy) {
x += dx;
y += dy;
wd += dx;
ht += dy;
}
/** Moves the current shape (if there is one)
to where the mouse was released.
Ie, change its position by (toX-fromX) and (toY-fromY)
*/
public void moveShape(double changeX, double changeY){
UI.println("Hello bitches"); //Ignore this :lol:
Trace.printf("Moving shape by (%.2f, %.2f)\n", changeX, changeY); //for debugging
shapes[currentShapeIndex].moveBy(changeX-pressedX, changeY-pressedY);
currentShapeIndex = -1;
this.drawDrawing();
}
If you wanna see any other methods, just ask.
Thanks


Sign In
Create Account

Back to top









