Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw rectangle fix #409

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ def draw_rectangle(self, shape):
p.append(p[0])
points = p

stroke_width = scale_to_export_dpi(shape.get('strokeWidth', 2))
stroke_width = scale_to_export_dpi(int(shape.get('strokeWidth', 2)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like scale_to_export_dpi can take floats. Does that lead to weirdness?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @joshmoore. Yes, we do allow floats. The UI allows you to choose 0.25, 0.5, 0.75, 1, 2...
I see that scale_to_export_dpi(shape.get('strokeWidth', 2)) occurs in a few other places too, so they'll need the same fix too.
I should probably review scale_to_export_dpi(pixels) to do it's own casting of pixels to float but that might change the return type (int to float) in some cases so I'd want to check the impact of that.

buffer = int(ceil(stroke_width) * 1.5)

# if fill, draw filled polygon without outline, then add line later
Expand Down