Example #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);
      }
    }
  }
Example #2
0
  ///////////////////////////////////////////////////////////////////////////
  /// Marquee
  protected void initializeMarquee(PInputEvent e) {
    marquee = PPath.createRectangle((float) presspt.getX(), (float) presspt.getY(), 0, 0);
    marquee.setPaint(marqueePaint);
    marquee.setTransparency(marqueePaintTransparency);
    marquee.setStrokePaint(marqueeStrokePaint);
    marquee.setStroke(strokes[0]);

    marqueeParent.getPiccolo().addChild(marquee);

    marqueeObjects.clear();
  }