예제 #1
0
파일: GUI.java 프로젝트: BNHeadrick/AFM-GUI
  public void mouseClicked() {

    //  int id = camPicker.get(mouseX, mouseY);
    int id = picker.get(mouseX, mouseY);
    if (id > -1) {
      for (int i = 0; i < cameras.size(); i++) {
        if (i == id) {
          cameras.get(id).changeToSelectedColor();
          cameras.get(id).isSelected = true;
        } else {
          cameras.get(i).setDefaultColor();
          cameras.get(i).isSelected = false;
        }
      }
    }
  }
예제 #2
0
파일: GUI.java 프로젝트: BNHeadrick/AFM-GUI
  public void mouseDragged() {

    //  int id = camPicker.get(mouseX, mouseY);
    int id = picker.get(mouseX, mouseY);
    /*
    //keep objects from being selected while dragging other objects; DOESN'T FIX ANYTHING YET
     if(id > -1 && id == prevID){
     //    cameras.get(id).changeToDragColor();
     println("indragged same");
     cameras.get(id).drag(mouseX, mouseY);
     }
     */
    if (id > -1) {
      for (int i = 0; i < cameras.size(); i++) {
        if (i == id) {
          //        println("indragged diff " + " x is " + mouseX + " y is " + mouseY);
          // cameras.get(id).changeToDragColor();
          cameras.get(id).drag(mouseX, mouseY);
          prevID = id;
          break;
        }
      }

      //    int id = camPicker.get(mouseX, mouseY);

      for (int i = cameras.size(); i < cameras.size() + characters.size(); i++) {
        //        println(i + " hi " + " camSize is " + cameras.size() + " charSize is" +
        // characters.size() + " both together are " + cameras.size() + characters.size());
        if (i == id) {
          //          characters.get(id).changeToDragColor();

          characters.get(id - cameras.size()).drag(mouseX, mouseY);
          //          println("char is " + id);
          break;
        }
      }
    }
  }