Skip to content

Commit

Permalink
#8 cursor over actors when drawing relations
Browse files Browse the repository at this point in the history
  • Loading branch information
raycarter committed Apr 20, 2017
1 parent 00af4c6 commit 6bc1044
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/main/java/gui/VennMakerView.java
Expand Up @@ -339,6 +339,16 @@ public RelationVector(Point end, Relation r, Point start)
*/
private Cursor cursorMovable = new Cursor(Cursor.MOVE_CURSOR);

/**
* To identify if one button for adding actors or relations is selected
*
*/
public enum ButtonSelected {
ACTOR, RELATION
};

private ButtonSelected buttonSelectedType = ButtonSelected.ACTOR;

/**
* Erzeugt eine neue Zeichenfläche fuer das angegebene Netzwerkobjekt.
* Aenderungen am Modell fuehren nicht zu einem Neuzeichnen der
Expand Down Expand Up @@ -4358,6 +4368,7 @@ public void action(MenuEvent e)
Cursor c = toolkit.createCustomCursor(image, new Point(16, 16),
"img");
this.cursorDefault = c;
this.setButtonSelectedType(ButtonSelected.ACTOR);
useDefaultCursor();
}
}
Expand All @@ -4373,6 +4384,7 @@ public void action(MenuEvent e)
Cursor c = toolkit.createCustomCursor(image, new Point(16, 16),
"img");
this.cursorDefault = c;
this.setButtonSelectedType(ButtonSelected.RELATION);
useDefaultCursor();
}
}
Expand Down Expand Up @@ -4428,4 +4440,12 @@ public void setDefaultCursor(Cursor c) {
public void setMovableCursor(Cursor c) {
this.cursorMovable = c;
}

public ButtonSelected getButtonSelectedType() {
return buttonSelectedType;
}

public void setButtonSelectedType(ButtonSelected buttonSelectedType) {
this.buttonSelectedType = buttonSelectedType;
}
}
3 changes: 2 additions & 1 deletion src/main/java/gui/VennMakerViewMouseContext.java
@@ -1,6 +1,7 @@
package gui;

import gui.VennMaker.ViewMode;
import gui.VennMakerView.ButtonSelected;

import java.awt.Cursor;
import java.awt.Point;
Expand Down Expand Up @@ -180,7 +181,7 @@ public void mouseMoved(final MouseEvent e)

if (akteur != null && akteur != tooltipAkteur)
{
if (isActorDraggable(akteur))
if (isActorDraggable(akteur) && view.getButtonSelectedType() == ButtonSelected.ACTOR)
((VennMakerView)e.getSource()).useMovableCursor();
// neuer Tooltip koennte bald kommen
if (akteur != lastHoverAkteur)
Expand Down

0 comments on commit 6bc1044

Please sign in to comment.