Commit 95f044b0 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

dashed line partially wasn't dashed in "Unknown Catalysis" and "Unknown Inhibition" reactions

parent c7b5c331
...@@ -28,6 +28,8 @@ minerva (12.3.0~alpha.0) unstable; urgency=low ...@@ -28,6 +28,8 @@ minerva (12.3.0~alpha.0) unstable; urgency=low
(#728) (#728)
* Bug fix: when editing project Disease and Organism could not be removed * Bug fix: when editing project Disease and Organism could not be removed
(#616) (#616)
* Bug fix: dashed line partially wasn't dashed in "Unknown Catalysis" and
"Unknown Inhibition" reactions (#664)
minerva (12.2.0~beta.2) unstable; urgency=medium minerva (12.2.0~beta.2) unstable; urgency=medium
* Bug fix: order of the overlays is defined explicitly also for general * Bug fix: order of the overlays is defined explicitly also for general
......
...@@ -135,19 +135,26 @@ public class ReactionConverter extends BioEntityConverter<Reaction> { ...@@ -135,19 +135,26 @@ public class ReactionConverter extends BioEntityConverter<Reaction> {
* where the rectangle should be drawn * where the rectangle should be drawn
*/ */
protected void drawRectangleData(final Line2D line, final ReactionRect insideType, final Graphics2D graphics) { protected void drawRectangleData(final Line2D line, final ReactionRect insideType, final Graphics2D graphics) {
Point2D startPoint = line.getP1();
Point2D endPoint = line.getP2();
double pointX = (startPoint.getX() + endPoint.getX()) / 2;
double pointY = (startPoint.getY() + endPoint.getY()) / 2;
Point2D centerPoint = new Point2D.Double(pointX, pointY);
double dx = endPoint.getX() - startPoint.getX();
double dy = endPoint.getY() - startPoint.getY();
double angle = Math.atan2(dy, dx);
if (insideType == null) { if (insideType == null) {
graphics.draw(line); Point2D topPoint = new Point2D.Double(pointX + RECT_SIZE / 2, pointY);
topPoint = new PointTransformation().rotatePoint(topPoint , angle, centerPoint);
Point2D bottomPoint = new Point2D.Double(pointX - RECT_SIZE / 2, pointY);
bottomPoint = new PointTransformation().rotatePoint(bottomPoint , angle, centerPoint);
graphics.draw(new Line2D.Double(topPoint, bottomPoint));
} else { } else {
Point2D startPoint = line.getP1();
Point2D endPoint = line.getP2();
double dx = endPoint.getX() - startPoint.getX();
double dy = endPoint.getY() - startPoint.getY();
double angle = Math.atan2(dy, dx);
// find rectangle // find rectangle
Rectangle2D rect = new Rectangle2D.Double(); Rectangle2D rect = new Rectangle2D.Double();
double pointX = (startPoint.getX() + endPoint.getX()) / 2;
double pointY = (startPoint.getY() + endPoint.getY()) / 2;
rect.setRect(pointX - RECT_SIZE / 2, pointY - RECT_SIZE / 2, RECT_SIZE, RECT_SIZE); rect.setRect(pointX - RECT_SIZE / 2, pointY - RECT_SIZE / 2, RECT_SIZE, RECT_SIZE);
// rotate graphics by the angle defined by line (instead of rotating // rotate graphics by the angle defined by line (instead of rotating
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment