示例#1
0
  /**
   * Remove an item from the screen.
   *
   * @param item the item to remove
   */
  public static void removeItem(MoveableItem item) {
    if (item instanceof Paint) paints.remove(item);
    else if (!(item instanceof Eraser)) brushes.remove(item);

    TouchClient.remove(item);
    notifyListeners(item, ITEM_REMOVED);
  }
示例#2
0
  /**
   * Add an item to the screen.
   *
   * @param item the item to add
   */
  public static void addItem(MoveableItem item) {
    if (item instanceof Paint) paints.add((Paint) item);
    else if (item instanceof Brush && !(item instanceof Eraser)) brushes.add((Brush) item);

    TouchClient.add(item);
    notifyListeners(item, ITEM_ADDED);
  }
示例#3
0
  /**
   * Set the provided Brush object as currently selected.
   *
   * @param b Brush object to mark as selected
   */
  public static void setSelectedBrush(Brush b) {
    if (b == selectedBrush) return;

    if (selectedBrush != null) selectedBrush.deselect();
    selectedBrush = b;
    if (selectedBrush != null) selectedBrush.select();

    notifyListeners(b, BRUSH_SELECTED);
  }
示例#4
0
  /**
   * Set the provided Paint object as currently selected.
   *
   * @param p Paint object to mark as selected
   */
  public static void setSelectedPaint(Paint p) {
    if (p == selectedPaint) return;

    if (selectedPaint != null) selectedPaint.deselect();
    selectedPaint = p;
    if (selectedPaint != null) selectedPaint.select();

    notifyListeners(p, PAINT_SELECTED);
  }