Skip to content

Commit

Permalink
Fixes Cytoscape hang when printing arrow or group annotations. Refs
Browse files Browse the repository at this point in the history
  • Loading branch information
scootermorris committed Nov 1, 2018
1 parent d18c17d commit 8c5f877
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Expand Up @@ -283,7 +283,7 @@ public void setSource(Annotation source) {
if (source != null)
source.addArrow(this);

updateBounds();
// updateBounds();
update();
}

Expand All @@ -292,22 +292,22 @@ public void setSource(Annotation source) {
@Override
public void setTarget(Annotation target) {
this.target = target;
updateBounds();
// updateBounds();
update();
}

@Override
public void setTarget(CyNode target) {
this.target = target;
updateBounds();
// updateBounds();
update();
}

@Override
public void setTarget(Point2D target) {
// Convert target to node coordinates
this.target = ViewUtils.getNodeCoordinates(view, target.getX(), target.getY());
updateBounds();
// updateBounds();
update();
}

Expand Down Expand Up @@ -504,7 +504,7 @@ public void drawArrow(Graphics g, boolean isPrinting) {
if ((source == null || target == null) && !usedForPreviews)
return;

if (!usedForPreviews)
if (!usedForPreviews && !isPrinting)
updateBounds();
else
arrowLine = getArrowLine(target, source);
Expand Down Expand Up @@ -596,6 +596,7 @@ private Line2D getRelativeLine(Line2D line, double x, double y,
}

private void updateBounds() {

xOffset = 0.0; yOffset = 0.0;

// We need to take into account our arrows
Expand Down
Expand Up @@ -346,11 +346,12 @@ public void drawAnnotation(Graphics g, double x, double y, double scaleFactor) {
@Override
public void paint(Graphics g) {
super.paint(g);
updateBounds();
if (!canvas.isPrinting())
updateBounds();

Graphics2D g2 = (Graphics2D) g;

if (isSelected()) {
if (isSelected() && !canvas.isPrinting()) {
g2.setColor(Color.YELLOW);
g2.setStroke(new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f));
g2.drawRect(0, 0, getWidth(), getHeight());
Expand Down

0 comments on commit 8c5f877

Please sign in to comment.