Skip to content

Commit

Permalink
Fixed an issue where you could move the overlays with middle, and rig…
Browse files Browse the repository at this point in the history
…ht click.
  • Loading branch information
karakasis committed Mar 9, 2019
1 parent 516a4f2 commit 82bdd8f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/poe/level/data/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public void run() {
}

public static boolean LOCK; //locs all overlays and keybinds
public static boolean PRESS; //locs all overlays and keybinds
public int playerLevel;
public String playerName;
public int monsterLevel;
Expand Down Expand Up @@ -210,6 +211,7 @@ public static double findxpmulti(int playerlvl,int arealvl){
//public Controller(Stage zone, Stage xp, Stage level, Build build) {
public Controller(boolean zone_b, boolean xp, boolean level, Build build) {
LOCK = false;
PRESS = false;
instance = this;
Rectangle2D primScreenBounds = Screen.getPrimary().getVisualBounds();
height = primScreenBounds.getHeight();
Expand Down
8 changes: 5 additions & 3 deletions src/poe/level/fx/overlay/GemOverlayBeta_Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public void hookStage(Stage stage){
final Delta dragDelta = new Delta();
rootDrag.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
if(!Controller.LOCK) {
if(!Controller.LOCK && mouseEvent.isPrimaryButtonDown()) {
Controller.PRESS = true;
// record a delta distance for the drag and drop operation.
dragDelta.x = stage.getX() - mouseEvent.getScreenX();
dragDelta.y = stage.getY() - mouseEvent.getScreenY();
Expand All @@ -40,7 +41,7 @@ public void hookStage(Stage stage){
});
rootDrag.setOnMouseDragged(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
if(!Controller.LOCK) {
if(!Controller.LOCK && mouseEvent.isPrimaryButtonDown()) {
stage.setX(mouseEvent.getScreenX() + dragDelta.x);
stage.setY(mouseEvent.getScreenY() + dragDelta.y);
GemOverlay_Stage.prefX = mouseEvent.getScreenX() + dragDelta.x;
Expand All @@ -50,8 +51,9 @@ public void hookStage(Stage stage){
});
rootDrag.setOnMouseReleased(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
if(!Controller.LOCK) {
if(!Controller.LOCK && Controller.PRESS) {
//update the prop file
Controller.PRESS = false;
Preferences_Controller.updateGemsPos(GemOverlay_Stage.prefX, GemOverlay_Stage.prefY);
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/poe/level/fx/overlay/GemOverlay_Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ public void hookStage(Stage stage){
final Delta dragDelta = new Delta();
gem_overlay_container.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
if(!Controller.LOCK) {
if(!Controller.LOCK && mouseEvent.isPrimaryButtonDown()) {
// record a delta distance for the drag and drop operation.
Controller.PRESS = true;
dragDelta.x = stage.getX() - mouseEvent.getScreenX();
dragDelta.y = stage.getY() - mouseEvent.getScreenY();
}
}
});
gem_overlay_container.setOnMouseDragged(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
if(!Controller.LOCK) {
if(!Controller.LOCK && mouseEvent.isPrimaryButtonDown()) {
stage.setX(mouseEvent.getScreenX() + dragDelta.x);
stage.setY(mouseEvent.getScreenY() + dragDelta.y);
GemOverlay_Stage.prefX = mouseEvent.getScreenX() + dragDelta.x;
Expand All @@ -55,8 +56,9 @@ public void hookStage(Stage stage){
});
gem_overlay_container.setOnMouseReleased(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
if(!Controller.LOCK) {
if(!Controller.LOCK && Controller.PRESS) {
//update the prop file
Controller.PRESS = false;
Preferences_Controller.updateGemsPos(GemOverlay_Stage.prefX, GemOverlay_Stage.prefY);
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/poe/level/fx/overlay/LevelOverlay_Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ public void hookStage(Stage stage){
root.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
// record a delta distance for the drag and drop operation.
if(!Controller.LOCK) {
if(!Controller.LOCK && mouseEvent.isPrimaryButtonDown()) {
Controller.PRESS = true;
dragDelta.x = stage.getX() - mouseEvent.getScreenX();
dragDelta.y = stage.getY() - mouseEvent.getScreenY();
}
}
});
root.setOnMouseDragged(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
if(!Controller.LOCK) {
if(!Controller.LOCK && mouseEvent.isPrimaryButtonDown()) {
stage.setX(mouseEvent.getScreenX() + dragDelta.x);
stage.setY(mouseEvent.getScreenY() + dragDelta.y);
LevelOverlay_Stage.prefX = mouseEvent.getScreenX() + dragDelta.x;
Expand All @@ -69,7 +70,8 @@ public void hookStage(Stage stage){
});
root.setOnMouseReleased(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
if(!Controller.LOCK) {
if(!Controller.LOCK && Controller.PRESS) {
Controller.PRESS = false;
Preferences_Controller.updateLevelPos(LevelOverlay_Stage.prefX, LevelOverlay_Stage.prefY);
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/poe/level/fx/overlay/ZoneOverlay_Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public void hookStage(Stage stage){
container.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
// record a delta distance for the drag and drop operation.
if(!Controller.LOCK){
if(!Controller.LOCK && mouseEvent.isPrimaryButtonDown()){
Controller.PRESS = true;
dragDelta.x = stage.getX() - mouseEvent.getScreenX();
dragDelta.y = stage.getY() - mouseEvent.getScreenY();
}
Expand All @@ -77,7 +78,7 @@ public void hookStage(Stage stage){
container.setOnMouseDragged(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent mouseEvent) {
if(!Controller.LOCK) {
if(!Controller.LOCK && mouseEvent.isPrimaryButtonDown()) {
stage.setX(mouseEvent.getScreenX() + dragDelta.x);
stage.setY(mouseEvent.getScreenY() + dragDelta.y);
ZoneOverlay_Stage.prefX = mouseEvent.getScreenX() + dragDelta.x;
Expand All @@ -87,7 +88,8 @@ public void handle(MouseEvent mouseEvent) {
});
container.setOnMouseReleased(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
if(!Controller.LOCK) {
if(!Controller.LOCK && Controller.PRESS) {
Controller.PRESS = false;
Preferences_Controller.updateZonesPos(ZoneOverlay_Stage.prefX, ZoneOverlay_Stage.prefY);
}
}
Expand Down

0 comments on commit 82bdd8f

Please sign in to comment.