Permalink
Browse files

Converted margin into the RenderingParameter variant

  • Loading branch information...
egonw committed Feb 15, 2010
1 parent 7eea476 commit 5475abdac06d2f6dc718d061cb8bc50b3b67d269
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/main/org/openscience/cdk/renderer/Renderer.java
@@ -41,6 +41,7 @@
import org.openscience.cdk.renderer.font.IFontManager;
import org.openscience.cdk.renderer.generators.IGenerator;
import org.openscience.cdk.renderer.generators.IReactionGenerator;
+import org.openscience.cdk.renderer.generators.BasicSceneGenerator.Margin;
import org.openscience.cdk.renderer.visitor.IDrawVisitor;
/**
@@ -759,7 +760,8 @@ public void setZoomToFit(double drawWidth,
double diagramWidth,
double diagramHeight) {
- double m = this.rendererModel.getMargin();
+ double m = this.rendererModel
+ .getRenderingParameter(Margin.class).getValue();
// determine the zoom needed to fit the diagram to the screen
double widthRatio = drawWidth / (diagramWidth + (2 * m));
@@ -896,7 +898,8 @@ private Rectangle convertToDiagramBounds(Rectangle2D modelBounds) {
return new Rectangle((int)mc.x, (int)mc.y, 0, 0);
}
- double margin = this.rendererModel.getMargin();
+ double margin = this.rendererModel
+ .getRenderingParameter(Margin.class).getValue();
int w = (int) ((scale * zoom * mw) + (2 * margin));
int h = (int) ((scale * zoom * mh) + (2 * margin));
int x = (int) (mc.x - w / 2);

0 comments on commit 5475abd

Please sign in to comment.