Пример #1
0
  public void mouseClicked(MouseEvent e) {
    int x;
    int y;

    e.consume();

    if (mouseEventsEnabled) {

      x = Math.round(e.getX() / scale);
      y = Math.round(e.getY() / scale);

      // allow for the canvas margin
      y -= margin;

      // System.out.println("Mouse Click: (" + x + ", " + y + ")");

      if (e.getClickCount() < 2) {
        if (nativeSelectItem(x, y)) {
          parentFTAFrame.updateFrame();
        }
      } else {
        if (nativeSelectItem(x, y)) {
          parentFTAFrame.updateFrame();
        }

        editSelected();
        parentFTAFrame.updateFrame();
      }

      if (focusEventsEnabled) {
        // tell the main Canvas to point to this coordinate
        parentFTAFrame.setCanvasFocus(x, y);
      }
    }
  }
Пример #2
0
 public int getWidth() {
   float fWidth;
   int width;
   fWidth = scale * nativeGetMaxWidth();
   width = Math.round(fWidth);
   if (parentContainer == null) {
     return width;
   } else {
     return FTAUtilities.max(width, parentContainer.getWidth());
   }
 }
Пример #3
0
 public int getHeight() {
   float fHeight;
   int height;
   fHeight = scale * nativeGetMaxDepth();
   height = Math.round(fHeight) + (2 * margin);
   if (parentContainer == null) {
     return height;
   } else {
     return FTAUtilities.max(height, parentContainer.getHeight());
   }
 }
Пример #4
0
  @Override
  protected void paintComponent(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    // Draw static content
    g2.setPaint(getBackground());
    frame(g2, cursorBox.x, cursorBox.y, cursorBox.width, cursorBox.height);
    frame(g2, zoomBox.x, zoomBox.y, zoomBox.width, zoomBox.height);
    frame(g2, selectionBox.x, selectionBox.y, selectionBox.width, selectionBox.height);

    Image image = State.getCurrentImage();
    if (image == null || cx == -1 || cy == -1) return;
    g2.setPaint(Color.BLACK);

    g2.drawString(
        getCursorAttributedString(image).getIterator(),
        textOffsetX(cursorBox),
        textOffsetY(cursorBox));

    g2.drawString(
        Math.round(image.getImagePanel().getZoom() * 100) + "%",
        textOffsetX(zoomBox),
        textOffsetY(zoomBox));
  }