List of usage examples for javafx.scene.input MouseEvent isControlDown
public final boolean isControlDown()
From source file:Main.java
private static int modifiers(final InputEvent event) { if (event instanceof MouseEvent) { final MouseEvent mouseEvent = (MouseEvent) event; int modifiers = 0; if (mouseEvent.isAltDown()) { modifiers |= java.awt.event.MouseEvent.ALT_MASK; modifiers |= java.awt.event.MouseEvent.ALT_DOWN_MASK; }// www. j a v a 2 s. c om if (mouseEvent.isControlDown()) { modifiers |= java.awt.event.MouseEvent.CTRL_MASK; modifiers |= java.awt.event.MouseEvent.CTRL_DOWN_MASK; } if (mouseEvent.isMetaDown()) { modifiers |= java.awt.event.MouseEvent.META_MASK; modifiers |= java.awt.event.MouseEvent.META_DOWN_MASK; } if (mouseEvent.isShiftDown()) { modifiers |= java.awt.event.MouseEvent.SHIFT_MASK; modifiers |= java.awt.event.MouseEvent.SHIFT_DOWN_MASK; } if (mouseEvent.isPrimaryButtonDown()) { modifiers |= java.awt.event.MouseEvent.BUTTON1_MASK; } if (mouseEvent.isMiddleButtonDown()) { modifiers |= java.awt.event.MouseEvent.BUTTON2_MASK; } if (mouseEvent.isSecondaryButtonDown()) { modifiers |= java.awt.event.MouseEvent.BUTTON3_MASK; } return modifiers; } if (event instanceof KeyEvent) { final KeyEvent keyEvent = (KeyEvent) event; int modifiers = 0; if (keyEvent.isAltDown()) { modifiers |= java.awt.event.KeyEvent.ALT_MASK; } if (keyEvent.isControlDown()) { modifiers |= java.awt.event.KeyEvent.CTRL_MASK; } if (keyEvent.isMetaDown()) { modifiers |= java.awt.event.KeyEvent.META_MASK; } if (keyEvent.isShiftDown()) { modifiers |= java.awt.event.KeyEvent.SHIFT_MASK; } return modifiers; } return 0; }
From source file:Main.java
@Override public void start(Stage primaryStage) { BorderPane root = new BorderPane(); Scene scene = new Scene(root, 300, 250, Color.WHITE); MenuBar menuBar = new MenuBar(); menuBar.getMenus().addAll(fileMenu(), cameraMenu(), alarmMenu()); root.setTop(menuBar);/*from ww w. j a v a 2 s.c o m*/ ContextMenu contextFileMenu = new ContextMenu(exitMenuItem()); primaryStage.addEventHandler(MouseEvent.MOUSE_CLICKED, (MouseEvent me) -> { if (me.getButton() == MouseButton.SECONDARY || me.isControlDown()) { contextFileMenu.show(root, me.getScreenX(), me.getScreenY()); } else { contextFileMenu.hide(); } }); primaryStage.setScene(scene); primaryStage.show(); }
From source file:de.hs.mannheim.modUro.controller.diagram.fx.interaction.AbstractMouseHandlerFX.java
/** * Returns <code>true</code> if the specified mouse event has modifier * keys that match this handler./*from www. j ava 2 s .co m*/ * * @param e the mouse event (<code>null</code> not permitted). * * @return A boolean. */ @Override public boolean hasMatchingModifiers(MouseEvent e) { boolean b = true; b = b && (this.altKey == e.isAltDown()); b = b && (this.ctrlKey == e.isControlDown()); b = b && (this.metaKey == e.isMetaDown()); b = b && (this.shiftKey == e.isShiftDown()); return b; }
From source file:nars.rl.util.ThreeDView.java
private void handleMouse(Scene scene, final Node root) { scene.setOnMousePressed(new EventHandler<MouseEvent>() { @Override//from w w w .j av a 2s . c o m public void handle(MouseEvent me) { mousePosX = me.getSceneX(); mousePosY = me.getSceneY(); mouseOldX = me.getSceneX(); mouseOldY = me.getSceneY(); } }); scene.setOnMouseDragged(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent me) { mouseOldX = mousePosX; mouseOldY = mousePosY; mousePosX = me.getSceneX(); mousePosY = me.getSceneY(); mouseDeltaX = (mousePosX - mouseOldX); mouseDeltaY = (mousePosY - mouseOldY); double modifier = 1.0; double modifierFactor = 0.1; if (me.isControlDown()) { modifier = 0.1; } if (me.isShiftDown()) { modifier = 10.0; } if (me.isPrimaryButtonDown()) { cameraXform.ry .setAngle(cameraXform.ry.getAngle() - mouseDeltaX * modifierFactor * modifier * 2.0); // + cameraXform.rx .setAngle(cameraXform.rx.getAngle() + mouseDeltaY * modifierFactor * modifier * 2.0); // - } else if (me.isSecondaryButtonDown()) { double z = camera.getTranslateZ(); double newZ = z + mouseDeltaX * modifierFactor * modifier; camera.setTranslateZ(newZ); } else if (me.isMiddleButtonDown()) { cameraXform2.t.setX(cameraXform2.t.getX() + mouseDeltaX * modifierFactor * modifier * 0.3); // - cameraXform2.t.setY(cameraXform2.t.getY() + mouseDeltaY * modifierFactor * modifier * 0.3); // - } } }); }
From source file:editeurpanovisu.EditeurPanovisu.java
private void gereSourisPanoramique(MouseEvent me) { if (me.getButton() == MouseButton.SECONDARY) { if (me.isShiftDown()) { panoChoixNord(me.getSceneX() - imagePanoramique.getLayoutX()); me.consume();/* w w w . ja va 2s . c om*/ } else if (me.isControlDown()) { } else { panoChoixRegard(me.getSceneX() - imagePanoramique.getLayoutX(), me.getSceneY()); me.consume(); } } if (me.getButton() == MouseButton.PRIMARY) { if (me.isShiftDown()) { if (!me.isControlDown()) { if (!dragDrop) { panoAjouteImage(me.getSceneX() - imagePanoramique.getLayoutX(), me.getSceneY()); } else { dragDrop = false; } } else { } } else if (!(me.isControlDown()) && estCharge) { if (!dragDrop) { panoMouseClic(me.getSceneX() - imagePanoramique.getLayoutX(), me.getSceneY()); } else { dragDrop = false; } } } }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param i/* w w w . j a v a2s.c o m*/ * @param longitude * @param latitude */ private void afficheHSImage(int i, double longitude, double latitude) { double largeur = imagePanoramique.getFitWidth(); double X = (longitude + 180.0d) * largeur / 360.0d + imagePanoramique.getLayoutX(); double Y = (90.0d - latitude) * largeur / 360.0d; Circle point = new Circle(X, Y, 5); point.setFill(Color.BLUE); point.setStroke(Color.YELLOW); point.setId("img" + i); point.setCursor(Cursor.DEFAULT); pano.getChildren().add(point); Tooltip t = new Tooltip("image n " + (i + 1)); t.setStyle(tooltipStyle); Tooltip.install(point, t); point.setOnDragDetected((MouseEvent me1) -> { point.setFill(Color.YELLOW); point.setStroke(Color.BLUE); dragDrop = true; me1.consume(); }); point.setOnMouseDragged((MouseEvent me1) -> { double XX = me1.getX() - imagePanoramique.getLayoutX(); if (XX < 0) { XX = 0; } if (XX > imagePanoramique.getFitWidth()) { XX = imagePanoramique.getFitWidth(); } point.setCenterX(XX + imagePanoramique.getLayoutX()); double YY = me1.getY(); if (YY < 0) { YY = 0; } if (YY > imagePanoramique.getFitHeight()) { YY = imagePanoramique.getFitHeight(); } point.setCenterY(YY); me1.consume(); }); point.setOnMouseReleased((MouseEvent me1) -> { String chPoint = point.getId(); chPoint = chPoint.substring(3, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); double X1 = me1.getSceneX(); double Y1 = me1.getSceneY(); double mouseX = X1 - imagePanoramique.getLayoutX(); if (mouseX < 0) { mouseX = 0; } if (mouseX > imagePanoramique.getFitWidth()) { mouseX = imagePanoramique.getFitWidth(); } double mouseY = Y1 - pano.getLayoutY() - 109; if (mouseY < 0) { mouseY = 0; } if (mouseY > imagePanoramique.getFitHeight()) { mouseY = imagePanoramique.getFitHeight(); } double longit, lat; double larg = imagePanoramique.getFitWidth(); String chLong, chLat; longit = 360.0f * mouseX / larg - 180; lat = 90.0d - 2.0f * mouseY / larg * 180.0f; panoramiquesProjet[panoActuel].getHotspotImage(numeroPoint).setLatitude(lat); panoramiquesProjet[panoActuel].getHotspotImage(numeroPoint).setLongitude(longit); point.setFill(Color.BLUE); point.setStroke(Color.YELLOW); me1.consume(); }); point.setOnMouseClicked((MouseEvent me1) -> { String chPoint = point.getId(); chPoint = chPoint.substring(3, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); Node pt; pt = (Node) pano.lookup("#img" + chPoint); if (me1.isControlDown()) { valideHS(); dejaSauve = false; stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *"); pano.getChildren().remove(pt); for (int o = numeroPoint + 1; o < numImages; o++) { pt = (Node) pano.lookup("#img" + Integer.toString(o)); pt.setId("img" + Integer.toString(o - 1)); } /** * on retire les anciennes indication de HS */ retireAffichageHotSpots(); numImages--; panoramiquesProjet[panoActuel].removeHotspotImage(numeroPoint); /** * On les cre les nouvelles */ ajouteAffichageHotspots(); me1.consume(); } else { me1.consume(); } }); }
From source file:editeurpanovisu.EditeurPanovisu.java
private void panoAjouteImage(double X, double Y) { if (X > 0 && X < imagePanoramique.getFitWidth()) { valideHS();/*from w w w . j a v a 2s. c om*/ dejaSauve = false; stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *"); double mouseX = X; double mouseY = Y - pano.getLayoutY() - 115; double longitude, latitude; double largeur = imagePanoramique.getFitWidth(); String chLong, chLat; longitude = 360.0f * mouseX / largeur - 180; latitude = 90.0d - 2.0f * mouseY / largeur * 180.0f; Circle point = new Circle(mouseX, mouseY, 5); point.setFill(Color.BLUE); point.setStroke(Color.YELLOW); point.setId("img" + numImages); point.setCursor(Cursor.DEFAULT); pano.getChildren().add(point); Tooltip t = new Tooltip("image n " + (numImages + 1)); t.setStyle(tooltipStyle); Tooltip.install(point, t); // File repert; if (repertHSImages.equals("")) { repert = new File(currentDir + File.separator); } else { repert = new File(repertHSImages); } FileChooser fileChooser = new FileChooser(); FileChooser.ExtensionFilter extFilterImages = new FileChooser.ExtensionFilter( "Fichiers Images (jpg, bmp, png)", "*.jpg", "*.bmp", "*.png"); fileChooser.setInitialDirectory(repert); fileChooser.getExtensionFilters().addAll(extFilterImages); File fichierImage = fileChooser.showOpenDialog(null); if (fichierImage != null) { repertHSImages = fichierImage.getParent(); numImages++; HotspotImage HS = new HotspotImage(); HS.setLongitude(longitude); HS.setLatitude(latitude); HS.setUrlImage(fichierImage.getAbsolutePath()); HS.setLienImg(fichierImage.getName()); HS.setInfo(fichierImage.getName().split("\\.")[0]); File repertImage = new File(repertTemp + File.separator + "images"); if (!repertImage.exists()) { repertImage.mkdirs(); } try { copieFichierRepertoire(fichierImage.getAbsolutePath(), repertImage.getAbsolutePath()); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } panoramiquesProjet[panoActuel].addHotspotImage(HS); retireAffichageHotSpots(); Pane affHS1 = affichageHS(listePano(panoActuel), panoActuel); affHS1.setId("labels"); outils.getChildren().add(affHS1); } else { String chPoint = point.getId(); chPoint = chPoint.substring(3, chPoint.length()); Node pt = (Node) pano.lookup("#img" + chPoint); pano.getChildren().remove(pt); } valideHS(); point.setOnDragDetected((MouseEvent me1) -> { point.setFill(Color.YELLOW); point.setStroke(Color.BLUE); dragDrop = true; me1.consume(); }); point.setOnMouseDragged((MouseEvent me1) -> { double XX = me1.getX() - imagePanoramique.getLayoutX(); if (XX < 0) { XX = 0; } if (XX > imagePanoramique.getFitWidth()) { XX = imagePanoramique.getFitWidth(); } point.setCenterX(XX + imagePanoramique.getLayoutX()); double YY = me1.getY(); if (YY < 0) { YY = 0; } if (YY > imagePanoramique.getFitHeight()) { YY = imagePanoramique.getFitHeight(); } point.setCenterY(YY); me1.consume(); }); point.setOnMouseReleased((MouseEvent me1) -> { String chPoint = point.getId(); chPoint = chPoint.substring(3, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); double X1 = me1.getSceneX(); double Y1 = me1.getSceneY(); double mouseX1 = X1 - imagePanoramique.getLayoutX(); if (mouseX1 < 0) { mouseX1 = 0; } if (mouseX1 > imagePanoramique.getFitWidth()) { mouseX1 = imagePanoramique.getFitWidth(); } double mouseY1 = Y1 - pano.getLayoutY() - 109; if (mouseY1 < 0) { mouseY1 = 0; } if (mouseY1 > imagePanoramique.getFitHeight()) { mouseY1 = imagePanoramique.getFitHeight(); } double longit, lat; double larg = imagePanoramique.getFitWidth(); longit = 360.0f * mouseX1 / larg - 180; lat = 90.0d - 2.0f * mouseY1 / larg * 180.0f; panoramiquesProjet[panoActuel].getHotspotImage(numeroPoint).setLatitude(lat); panoramiquesProjet[panoActuel].getHotspotImage(numeroPoint).setLongitude(longit); point.setFill(Color.BLUE); point.setStroke(Color.YELLOW); me1.consume(); }); point.setOnMouseClicked((MouseEvent me1) -> { if (me1.isControlDown()) { dejaSauve = false; stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *"); String chPoint = point.getId(); chPoint = chPoint.substring(3, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); Node pt; pt = (Node) pano.lookup("#img" + chPoint); pano.getChildren().remove(pt); for (int o = numeroPoint + 1; o < numImages; o++) { pt = (Node) pano.lookup("#img" + Integer.toString(o)); pt.setId("img" + Integer.toString(o - 1)); } /** * on retire les anciennes indication de HS */ retireAffichageHotSpots(); numImages--; panoramiquesProjet[panoActuel].removeHotspotImage(numeroPoint); /** * On les cre les nouvelles */ ajouteAffichageHotspots(); } valideHS(); me1.consume(); }); } }
From source file:editeurpanovisu.EditeurPanovisu.java
private void panoMouseClic(double X, double Y) { if (nombrePanoramiques > 1) { valideHS();/* w w w . j av a2 s . c o m*/ dejaSauve = false; stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *"); double mouseX = X; double mouseY = Y - pano.getLayoutY() - 109; if (X > 0 && X < imagePanoramique.getFitWidth()) { double longitude, latitude; double largeur = imagePanoramique.getFitWidth(); String chLong, chLat; longitude = 360.0f * mouseX / largeur - 180; latitude = 90.0d - 2.0f * mouseY / largeur * 180.0f; Circle point = new Circle(mouseX + imagePanoramique.getLayoutX(), mouseY, 5); point.setFill(Color.YELLOW); point.setStroke(Color.RED); point.setId("point" + numPoints); point.setCursor(Cursor.DEFAULT); pano.getChildren().add(point); Tooltip t = new Tooltip("point n" + (numPoints + 1)); t.setStyle(tooltipStyle); Tooltip.install(point, t); HotSpot HS = new HotSpot(); HS.setLongitude(longitude); HS.setLatitude(latitude); panoramiquesProjet[panoActuel].addHotspot(HS); retireAffichageHotSpots(); Pane affHS1 = affichageHS(listePano(panoActuel), panoActuel); affHS1.setId("labels"); outils.getChildren().add(affHS1); numPoints++; if (nombrePanoramiques > 1) { AnchorPane listePanoVig = afficherListePanosVignettes( panoramiquesProjet[panoActuel].getNombreHotspots() - 1); int largeurVignettes = 4; if (nombrePanoramiques < 4) { largeurVignettes = nombrePanoramiques; } if (mouseX + largeurVignettes * 130 > pano.getWidth()) { listePanoVig.setLayoutX(pano.getWidth() - largeurVignettes * 130); } else { listePanoVig.setLayoutX(mouseX); } listePanoVig.setLayoutY(mouseY); pano.getChildren().add(listePanoVig); valideHS(); } point.setOnDragDetected((MouseEvent me1) -> { String chPoint = point.getId(); chPoint = chPoint.substring(5, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); Node pt; pt = (Node) pano.lookup("#point" + chPoint); point.setFill(Color.RED); point.setStroke(Color.YELLOW); dragDrop = true; me1.consume(); }); point.setOnMouseDragged((MouseEvent me1) -> { double XX = me1.getX() - imagePanoramique.getLayoutX(); if (XX < 0) { XX = 0; } if (XX > imagePanoramique.getFitWidth()) { XX = imagePanoramique.getFitWidth(); } point.setCenterX(XX + imagePanoramique.getLayoutX()); double YY = me1.getY(); if (YY < 0) { YY = 0; } if (YY > imagePanoramique.getFitHeight()) { YY = imagePanoramique.getFitHeight(); } point.setCenterY(YY); me1.consume(); }); point.setOnMouseReleased((MouseEvent me1) -> { String chPoint = point.getId(); chPoint = chPoint.substring(5, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); double X1 = me1.getSceneX(); double Y1 = me1.getSceneY(); double mouseX1 = X1 - imagePanoramique.getLayoutX(); if (mouseX1 < 0) { mouseX1 = 0; } if (mouseX1 > imagePanoramique.getFitWidth()) { mouseX1 = imagePanoramique.getFitWidth(); } double mouseY1 = Y1 - pano.getLayoutY() - 109; if (mouseY1 < 0) { mouseY1 = 0; } if (mouseY1 > imagePanoramique.getFitHeight()) { mouseY1 = imagePanoramique.getFitHeight(); } double longit, lat; double larg = imagePanoramique.getFitWidth(); longit = 360.0f * mouseX1 / larg - 180; lat = 90.0d - 2.0f * mouseY1 / larg * 180.0f; panoramiquesProjet[panoActuel].getHotspot(numeroPoint).setLatitude(lat); panoramiquesProjet[panoActuel].getHotspot(numeroPoint).setLongitude(longit); point.setFill(Color.YELLOW); point.setStroke(Color.RED); me1.consume(); }); point.setOnMouseClicked((MouseEvent me1) -> { if (me1.isControlDown()) { dejaSauve = false; stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *"); String chPoint = point.getId(); chPoint = chPoint.substring(5, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); Node pt; pt = (Node) pano.lookup("#point" + chPoint); pano.getChildren().remove(pt); for (int o = numeroPoint + 1; o < numPoints; o++) { pt = (Node) pano.lookup("#point" + Integer.toString(o)); pt.setId("point" + Integer.toString(o - 1)); } /** * on retire les anciennes indication de HS */ retireAffichageHotSpots(); numPoints--; panoramiquesProjet[panoActuel].removeHotspot(numeroPoint); /** * On les cre les nouvelles */ ajouteAffichageHotspots(); valideHS(); me1.consume(); } else { if (!dragDrop) { String chPoint = point.getId(); chPoint = chPoint.substring(5, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); if (nombrePanoramiques > 1) { AnchorPane listePanoVig = afficherListePanosVignettes(numeroPoint); int largeurVignettes = 4; if (nombrePanoramiques < 4) { largeurVignettes = nombrePanoramiques; } if (mouseX + largeurVignettes * 130 > pano.getWidth()) { listePanoVig.setLayoutX(pano.getWidth() - largeurVignettes * 130); } else { listePanoVig.setLayoutX(mouseX); } listePanoVig.setLayoutY(mouseY); pano.getChildren().add(listePanoVig); } } else { dragDrop = false; } valideHS(); me1.consume(); } }); } } }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param i/*from ww w . j a v a2 s . c om*/ * @param longitude * @param latitude */ private void afficheHS(int i, double longitude, double latitude) { double largeur = imagePanoramique.getFitWidth(); double X = (longitude + 180.0d) * largeur / 360.0d + imagePanoramique.getLayoutX(); double Y = (90.0d - latitude) * largeur / 360.0d; Circle point = new Circle(X, Y, 5); point.setFill(Color.YELLOW); point.setStroke(Color.RED); point.setId("point" + i); point.setCursor(Cursor.DEFAULT); pano.getChildren().add(point); Tooltip t = new Tooltip("point n " + (i + 1)); t.setStyle(tooltipStyle); Tooltip.install(point, t); point.setOnDragDetected((MouseEvent me1) -> { point.setFill(Color.RED); point.setStroke(Color.YELLOW); dragDrop = true; me1.consume(); }); point.setOnMouseDragged((MouseEvent me1) -> { double XX = me1.getX() - imagePanoramique.getLayoutX(); if (XX < 0) { XX = 0; } if (XX > imagePanoramique.getFitWidth()) { XX = imagePanoramique.getFitWidth(); } point.setCenterX(XX + imagePanoramique.getLayoutX()); double YY = me1.getY(); if (YY < 0) { YY = 0; } if (YY > imagePanoramique.getFitHeight()) { YY = imagePanoramique.getFitHeight(); } point.setCenterY(YY); me1.consume(); }); point.setOnMouseReleased((MouseEvent me1) -> { String chPoint = point.getId(); chPoint = chPoint.substring(5, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); double X1 = me1.getSceneX(); double Y1 = me1.getSceneY(); double mouseX = X1 - imagePanoramique.getLayoutX(); if (mouseX < 0) { mouseX = 0; } if (mouseX > imagePanoramique.getFitWidth()) { mouseX = imagePanoramique.getFitWidth(); } double mouseY = Y1 - pano.getLayoutY() - 109; if (mouseY < 0) { mouseY = 0; } if (mouseY > imagePanoramique.getFitHeight()) { mouseY = imagePanoramique.getFitHeight(); } double longit, lat; double larg = imagePanoramique.getFitWidth(); String chLong, chLat; longit = 360.0f * mouseX / larg - 180; lat = 90.0d - 2.0f * mouseY / larg * 180.0f; panoramiquesProjet[panoActuel].getHotspot(numeroPoint).setLatitude(lat); panoramiquesProjet[panoActuel].getHotspot(numeroPoint).setLongitude(longit); point.setFill(Color.YELLOW); point.setStroke(Color.RED); me1.consume(); }); point.setOnMouseClicked((MouseEvent me1) -> { double mouseX = me1.getSceneX() - imagePanoramique.getLayoutX(); if (mouseX < 0) { mouseX = 0; } if (mouseX > imagePanoramique.getFitWidth()) { mouseX = imagePanoramique.getFitWidth(); } double mouseY = me1.getSceneY() - pano.getLayoutY() - 115; if (mouseY < 0) { mouseY = 0; } if (mouseY > imagePanoramique.getFitHeight()) { mouseY = imagePanoramique.getFitHeight(); } String chPoint = point.getId(); chPoint = chPoint.substring(5, chPoint.length()); int numeroPoint = Integer.parseInt(chPoint); Node pt; pt = (Node) pano.lookup("#point" + chPoint); if (me1.isControlDown()) { dejaSauve = false; stPrincipal.setTitle(stPrincipal.getTitle().replace(" *", "") + " *"); pano.getChildren().remove(pt); for (int o = numeroPoint + 1; o < numPoints; o++) { pt = (Node) pano.lookup("#point" + Integer.toString(o)); pt.setId("point" + Integer.toString(o - 1)); } /** * on retire les anciennes indication de HS */ retireAffichageHotSpots(); numPoints--; panoramiquesProjet[panoActuel].removeHotspot(numeroPoint); /** * On les cre les nouvelles */ ajouteAffichageHotspots(); me1.consume(); valideHS(); } else { if (!dragDrop) { if (nombrePanoramiques > 1) { AnchorPane listePanoVig = afficherListePanosVignettes(numeroPoint); int largeurVignettes = 4; if (nombrePanoramiques < 4) { largeurVignettes = nombrePanoramiques; } if (mouseX + largeurVignettes * 130 > pano.getWidth()) { listePanoVig.setLayoutX(pano.getWidth() - largeurVignettes * 130); } else { listePanoVig.setLayoutX(mouseX); } listePanoVig.setLayoutY(mouseY); pano.getChildren().add(listePanoVig); } } else { dragDrop = false; } valideHS(); me1.consume(); } }); }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param mouseEvent/*from w w w .jav a 2 s.c o m*/ */ private static void gereSourisPanoramique(MouseEvent mouseEvent) { if (mouseEvent.getButton() == MouseButton.SECONDARY) { if (mouseEvent.isShiftDown()) { panoChoixNord(mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX()); mouseEvent.consume(); } else if (mouseEvent.isControlDown()) { } else { panoChoixRegard(mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX(), mouseEvent.getSceneY() - getiDecalageMac()); mouseEvent.consume(); } } if (mouseEvent.getButton() == MouseButton.PRIMARY) { if (!(mouseEvent.isControlDown()) && bEstCharge) { if (!bDragDrop) { panePanoramique.setCursor(Cursor.DEFAULT); panePanoramique.setOnMouseClicked((me) -> { }); Circle c1 = new Circle(mouseEvent.getSceneX(), mouseEvent.getSceneY() - panePanoramique.getLayoutY() - 130 - getiDecalageMac(), 3); panePanoramique.getChildren().add(c1); ListView<String> lvMenuChoixTypeHotspot = new ListView<>(); double tailleFenetre = 70; if (getiNombrePanoramiques() > 1) { lvMenuChoixTypeHotspot.getItems().add("Panoramique"); tailleFenetre += 20; } lvMenuChoixTypeHotspot.getItems().add("Image"); if (getiNombreDiapo() > 0) { lvMenuChoixTypeHotspot.getItems().add("Diaporama"); tailleFenetre += 20; } lvMenuChoixTypeHotspot.getItems().add("HTML"); lvMenuChoixTypeHotspot.getItems().add("Annuler"); lvMenuChoixTypeHotspot.setMaxHeight(tailleFenetre); lvMenuChoixTypeHotspot.setPrefHeight(tailleFenetre); lvMenuChoixTypeHotspot.setMinHeight(tailleFenetre); lvMenuChoixTypeHotspot.setPrefWidth(120); lvMenuChoixTypeHotspot.setCursor(Cursor.DEFAULT); lvMenuChoixTypeHotspot.setLayoutX(mouseEvent.getSceneX()); lvMenuChoixTypeHotspot.setLayoutY( mouseEvent.getSceneY() - panePanoramique.getLayoutY() - 104 - getiDecalageMac()); panePanoramique.getChildren().add(lvMenuChoixTypeHotspot); lvMenuChoixTypeHotspot.getSelectionModel().selectedItemProperty() .addListener((ov, ancValeur, nouvValeur) -> { panePanoramique.getChildren().remove(lvMenuChoixTypeHotspot); panePanoramique.getChildren().remove(c1); switch (nouvValeur) { case "Panoramique": panoMouseClic(mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX(), mouseEvent.getSceneY()); break; case "Image": panoAjouteImage(mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX(), mouseEvent.getSceneY()); break; case "HTML": panoAjouteHTML(mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX(), mouseEvent.getSceneY()); break; case "Diaporama": panoAjouteDiaporama(mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX(), mouseEvent.getSceneY()); break; case "Annuler": break; } panePanoramique.setCursor(Cursor.CROSSHAIR); panePanoramique.setOnMouseClicked((me) -> { gereSourisPanoramique(me); }); }); } else { bDragDrop = false; } } } }