/** * */ public void updateFinder(boolean repaint) { Rectangle rect = graphComponent.getViewport().getViewRect(); int x = (int) Math.round(rect.x * scale); int y = (int) Math.round(rect.y * scale); int w = (int) Math.round((rect.x + rect.width) * scale) - x; int h = (int) Math.round((rect.y + rect.height) * scale) - y; updateFinderBounds(new Rectangle(x + translate.x, y + translate.y, w + 1, h + 1), repaint); }
/** * */ public void updateFinder(boolean repaint) { Rectangle rect = graphComponent.getViewport().getViewRect(); int x = (int) Math.round(rect.x * scale); int y = (int) Math.round(rect.y * scale); int w = (int) Math.round((rect.x + rect.width) * scale) - x; int h = (int) Math.round((rect.y + rect.height) * scale) - y; updateFinderBounds(new Rectangle(x + translate.x, y + translate.y, w + 1, h + 1), repaint); }
/** * */ public void mouseDragged(MouseEvent e) { if (!e.isConsumed() && start != null) { int dx = e.getX() - start.x; int dy = e.getY() - start.y; Rectangle r = graphComponent.getViewport().getViewRect(); int right = r.x + ((dx > 0) ? 0 : r.width) - dx; int bottom = r.y + ((dy > 0) ? 0 : r.height) - dy; graphComponent.getGraphControl().scrollRectToVisible( new Rectangle(right, bottom, 0, 0)); e.consume(); } }
/** * */ public void mouseDragged(MouseEvent e) { if (!e.isConsumed() && start != null) { int dx = e.getX() - start.x; int dy = e.getY() - start.y; Rectangle r = graphComponent.getViewport().getViewRect(); int right = r.x + ((dx > 0) ? 0 : r.width) - dx; int bottom = r.y + ((dy > 0) ? 0 : r.height) - dy; graphComponent.getGraphControl().scrollRectToVisible( new Rectangle(right, bottom, 0, 0)); e.consume(); } }
/** * Should be called by a hook inside mxGraphView/mxGraph */ protected mxPoint getPageTranslate(double scale) { Dimension d = getPreferredSizeForPage(); Dimension bd = new Dimension(d); if (!preferPageSize) { bd.width += 2 * getHorizontalPageBorder(); bd.height += 2 * getVerticalPageBorder(); } double width = Math.max(bd.width, (getViewport().getWidth() - 8) / scale); double height = Math.max(bd.height, (getViewport().getHeight() - 8) / scale); double dx = Math.max(0, (width - d.width) / 2); double dy = Math.max(0, (height - d.height) / 2); return new mxPoint(dx, dy); }
/** * Should be called by a hook inside mxGraphView/mxGraph */ protected mxPoint getPageTranslate(double scale) { Dimension d = getPreferredSizeForPage(); Dimension bd = new Dimension(d); if (!preferPageSize) { bd.width += 2 * getHorizontalPageBorder(); bd.height += 2 * getVerticalPageBorder(); } double width = Math.max(bd.width, (getViewport().getWidth() - 8) / scale); double height = Math.max(bd.height, (getViewport().getHeight() - 8) / scale); double dx = Math.max(0, (width - d.width) / 2); double dy = Math.max(0, (height - d.height) / 2); return new mxPoint(dx, dy); }
Rectangle bounds = graphComponent.getViewport() .getViewRect(); double viewRatio = bounds.getWidth() / bounds.getHeight();
Rectangle bounds = graphComponent.getViewport() .getViewRect(); double viewRatio = bounds.getWidth() / bounds.getHeight();
if (graphComponent.getViewport().isOpaque()) bg = graphComponent.getViewport().getBackground();
if (graphComponent.getViewport().isOpaque()) bg = graphComponent.getViewport().getBackground();
if (getViewport().isOpaque()) bg = getViewport().getBackground();
public void run() { Dimension pageSize = getPreferredSizeForPage(); if (getViewport().getWidth() > pageSize.getWidth()) { scrollToCenter(true); } else { JScrollBar scrollBar = getHorizontalScrollBar(); if (scrollBar != null) { scrollBar.setValue((scrollBar.getMaximum() / 3) - 4); } } if (getViewport().getHeight() > pageSize.getHeight()) { scrollToCenter(false); } else { JScrollBar scrollBar = getVerticalScrollBar(); if (scrollBar != null) { scrollBar.setValue((scrollBar.getMaximum() / 4) - 4); } } } });
public void run() { Dimension pageSize = getPreferredSizeForPage(); if (getViewport().getWidth() > pageSize.getWidth()) { scrollToCenter(true); } else { JScrollBar scrollBar = getHorizontalScrollBar(); if (scrollBar != null) { scrollBar.setValue((scrollBar.getMaximum() / 3) - 4); } } if (getViewport().getHeight() > pageSize.getHeight()) { scrollToCenter(false); } else { JScrollBar scrollBar = getVerticalScrollBar(); if (scrollBar != null) { scrollBar.setValue((scrollBar.getMaximum() / 4) - 4); } } } });
if (getViewport().isOpaque()) bg = getViewport().getBackground();
graphControl.repaint((rect != null) ? rect : getViewport() .getViewRect());
double width = getViewport().getWidth() - off; double height = getViewport().getHeight() - off;
graphControl.repaint((rect != null) ? rect : getViewport() .getViewRect());
Rectangle r = graphComponent.getViewport().getViewRect(); location.translate(r.x, r.y);
Rectangle r = graphComponent.getViewport().getViewRect(); location.translate(r.x, r.y);
int incy = dy - mdy; Rectangle r = graphComponent.getViewport().getViewRect();