Beispiel #1
0
 private void initSelectionListener() {
   selectionFocusListener =
       c -> {
         if (selectionModel.getSelectedItems().isEmpty())
           tertiaryRoom.setCameraCenter(rnaSequence3D.computeCenter());
         if (selectionModel.getSelectedIndices().size() > 0) selectFocus();
       };
 }
Beispiel #2
0
 private void selectFocus() {
   Point3D p = new Point3D(0, 0, 0);
   Nucleotide n =
       selectionModel
           .getItems()[
           selectionModel
               .getSelectedIndices()
               .get(selectionModel.getSelectedIndices().size() - 1)];
   p = p.add(utils.fx3d.computeCenter(n.getNucleotideCoordinates()));
   p = p.add(utils.fx3d.computeCenter(n.getBaseCoordinates()));
   p = p.multiply(1 / ((double) 2));
   // fx3d.transiteFromTOo(tertiaryRoom.getCamera(), p);
   tertiaryRoom.setCameraCenter(p);
 }
Beispiel #3
0
  private void selectionFocusBinding() {
    if (selectionFocusItem.isSelected()) {
      selectionModel.getSelectedItems().addListener(selectionFocusListener);
    }

    selectionFocusItem
        .selectedProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue == oldValue) return;
              if (newValue && !oldValue) {
                selectionModel.getSelectedItems().addListener(selectionFocusListener);
              } else {
                selectionModel.getSelectedItems().removeListener(selectionFocusListener);
              }
            });
  }
Beispiel #4
0
 private void initKeyEventHandler() {
   keyPressedEventHandler =
       event -> {
         if (event.getCode() == KeyCode.LEFT) {
           System.out.println("LEFT");
           int focus = selectionModel.getFocusIndex();
           selectionModel.deselect(focus);
           if (focus - 1 >= 0) {
             selectionModel.select(focus - 1);
           }
           event.consume();
         }
         if (event.getCode() == KeyCode.RIGHT) {
           System.out.println("RIGHT");
           int focus = selectionModel.getFocusIndex();
           selectionModel.deselect(focus);
           if (focus + 1 < selectionModel.getItems().length) {
             selectionModel.select(focus + 1);
           }
           event.consume();
         }
       };
 }