コード例 #1
0
  /** Calculates the x and y min and pax pos of this opject */
  private void generateMaxMinPos() {
    if (this.lanes.size() > 0) {
      float maxPos[] = {0, 0};
      float minPos[] = {
        this.lanes.get(0).getMinPos().getComponent(0), this.lanes.get(0).getMinPos().getComponent(1)
      };

      for (IUIAdapterLane<?> lane : this.lanes) {
        for (int ix = 0; ix <= 1; ix++) {
          // Max position
          if (maxPos[ix] < lane.getMaxPos().getComponent(ix)) {
            maxPos[ix] = lane.getMaxPos().getComponent(ix);
          }
          // Min position
          if (minPos[ix] > lane.getMinPos().getComponent(ix)) {
            minPos[ix] = lane.getMinPos().getComponent(ix);
          }
        }
      }
      this.maxPos = new Vector(maxPos);
      this.minPos = new Vector(minPos);
    } else {
      this.maxPos = this.minPos = new Vector(new float[] {0, 0});
    }
  }
コード例 #2
0
 @Override
 public void move(IVector pos) {
   for (IUIAdapterLane<?> lane : this.lanes) {
     lane.move(pos);
   }
   // calculate the new max and min pos
   this.generateMaxMinPos();
 }
コード例 #3
0
 @Override
 public void setScale(float scale) throws Exception {
   for (IUIAdapterLane<?> lane : this.lanes) {
     lane.setScale(scale);
   }
   // calculate the new max and min pos
   this.generateMaxMinPos();
 }