Exemple #1
0
  @SuppressWarnings("unchecked")
  protected void updateMarquee(PInputEvent pie) {
    PBounds b = new PBounds();

    if (marqueeParent.getPiccolo() instanceof PCamera) {
      b.add(canvasPressPt);
      b.add(pie.getCanvasPosition());
    } else {
      b.add(presspt);
      b.add(pie.getPosition());
    }

    b.reset();
    b.add(presspt);
    b.add(pie.getPosition());

    PBounds marqueeBounds = (PBounds) b.clone();

    selectableParent.globalToLocal(marqueeBounds);
    marqueeParent.viewToLocal(marqueeBounds);
    // marquee.globalToLocal(b);

    marquee.setPathToRectangle(
        (float) marqueeBounds.x,
        (float) marqueeBounds.y,
        (float) marqueeBounds.width,
        (float) marqueeBounds.height);

    allObjects.clear();
    PNodeFilter filter = new BoundsFilter(b);

    Collection<PNode> items;

    items = selectableParent.getPiccolo().getAllNodes(filter, null);

    Iterator<PNode> itemsIt = items.iterator();
    while (itemsIt.hasNext()) {
      PNode next = itemsIt.next();
      if (next instanceof PiccoloNodeInWorld) {
        WorldObjectImpl wo = (WorldObjectImpl) ((PiccoloNodeInWorld) next).getWorldObject();
        allObjects.add(wo);
      }
    }
  }