left button : open a path
right button : open only this path ( close other ways ).
This commit is contained in:
@@ -12,6 +12,7 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.io.File;
|
||||
@@ -703,10 +704,18 @@ public class Display extends JFrame
|
||||
}
|
||||
path=LabyModel.getDirection(last.getPosition(),newPosition);
|
||||
last.setDirection(path);
|
||||
// button 1 : add direction; button 2 : replace with direction.
|
||||
if ( ( e.getModifiersEx() & InputEvent.BUTTON1_DOWN_MASK ) != 0 )
|
||||
{
|
||||
map.addDirection(last.getPosition().getX(),last.getPosition().getY(),path);
|
||||
}
|
||||
else
|
||||
{
|
||||
map.setDirection(last.getPosition().getX(),last.getPosition().getY(),path);
|
||||
}
|
||||
}
|
||||
last = new DirectionPosition((short) 0,newPosition);
|
||||
System.out.println("Mouse dragged Cell " + newPosition);
|
||||
System.out.println("Mouse dragged Cell " + newPosition + " Button " + e.getModifiersEx() + " " + InputEvent.BUTTON1_DOWN_MASK);
|
||||
drawingPath.addLast(last);
|
||||
// map.noWalls(pX,pY);
|
||||
changed(null,null,map);
|
||||
@@ -811,6 +820,7 @@ public class Display extends JFrame
|
||||
public void resetWallsProvider(LabyModel map)
|
||||
{
|
||||
this.map = map;
|
||||
solvedPath=null;
|
||||
}
|
||||
|
||||
public void setWallSize(int size)
|
||||
|
||||
Reference in New Issue
Block a user