mirror of
https://github.com/badvision/jace.git
synced 2024-11-24 15:30:51 +00:00
Fixed mouse drag support and issue where mouse events were obscured by the status panel on the bottom -- Mouse is now 100%
This commit is contained in:
parent
879f1516fc
commit
d488932dff
@ -30,7 +30,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javafx.event.EventHandler;
|
import javafx.event.EventHandler;
|
||||||
import javafx.event.EventType;
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
@ -223,14 +222,10 @@ public class JaceUIController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addMouseListener(EventHandler<MouseEvent> handler) {
|
public void addMouseListener(EventHandler<MouseEvent> handler) {
|
||||||
appleScreen.addEventHandler(MouseEvent.MOUSE_MOVED, handler);
|
appleScreen.addEventHandler(MouseEvent.ANY, handler);
|
||||||
appleScreen.addEventHandler(MouseEvent.MOUSE_PRESSED, handler);
|
|
||||||
appleScreen.addEventHandler(MouseEvent.MOUSE_RELEASED, handler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeMouseListener(EventHandler<MouseEvent> handler) {
|
public void removeMouseListener(EventHandler<MouseEvent> handler) {
|
||||||
appleScreen.removeEventHandler(MouseEvent.MOUSE_MOVED, handler);
|
appleScreen.removeEventHandler(MouseEvent.ANY, handler);
|
||||||
appleScreen.removeEventHandler(MouseEvent.MOUSE_PRESSED, handler);
|
|
||||||
appleScreen.removeEventHandler(MouseEvent.MOUSE_RELEASED, handler);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,11 +104,12 @@ public class CardAppleMouse extends Card {
|
|||||||
EventHandler<MouseEvent> mouseHandler = this::processMouseEvent;
|
EventHandler<MouseEvent> mouseHandler = this::processMouseEvent;
|
||||||
|
|
||||||
private void processMouseEvent(MouseEvent event) {
|
private void processMouseEvent(MouseEvent event) {
|
||||||
if (event.getEventType() == MouseEvent.MOUSE_MOVED) {
|
if (event.getEventType() == MouseEvent.MOUSE_MOVED || event.getEventType() == MouseEvent.MOUSE_DRAGGED) {
|
||||||
Node source = (Node) event.getSource();
|
Node source = (Node) event.getSource();
|
||||||
updateLocation(event.getSceneX(), event.getSceneY(), source.getBoundsInLocal());
|
updateLocation(event.getSceneX(), event.getSceneY(), source.getBoundsInLocal());
|
||||||
event.consume();
|
event.consume();
|
||||||
} else if (event.getEventType() == MouseEvent.MOUSE_PRESSED) {
|
}
|
||||||
|
if (event.getEventType() == MouseEvent.MOUSE_PRESSED || event.getEventType() == MouseEvent.MOUSE_DRAGGED) {
|
||||||
mousePressed(event);
|
mousePressed(event);
|
||||||
event.consume();
|
event.consume();
|
||||||
} else if (event.getEventType() == MouseEvent.MOUSE_RELEASED) {
|
} else if (event.getEventType() == MouseEvent.MOUSE_RELEASED) {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<StackPane fx:id="stackPane" prefHeight="384.0" prefWidth="560.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<StackPane fx:id="stackPane" prefHeight="384.0" prefWidth="560.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<children>
|
<children>
|
||||||
<ImageView fx:id="appleScreen" fitHeight="384.0" fitWidth="560.0" pickOnBounds="true" />
|
<ImageView fx:id="appleScreen" fitHeight="384.0" fitWidth="560.0" pickOnBounds="true" />
|
||||||
<HBox fx:id="notificationBox" alignment="BOTTOM_RIGHT" blendMode="SCREEN" fillHeight="false" maxHeight="45.0" prefHeight="45.0" prefWidth="560.0" StackPane.alignment="BOTTOM_CENTER" />
|
<HBox fx:id="notificationBox" alignment="BOTTOM_RIGHT" blendMode="SCREEN" fillHeight="false" maxHeight="45.0" mouseTransparent="true" prefHeight="45.0" prefWidth="560.0" StackPane.alignment="BOTTOM_CENTER" />
|
||||||
</children>
|
</children>
|
||||||
</StackPane>
|
</StackPane>
|
||||||
</children>
|
</children>
|
||||||
|
Loading…
Reference in New Issue
Block a user