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

Fix labels around border #616

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix flake8 error
Rdornier committed Feb 18, 2025
commit 12f7e1302fe1169e76d44012633bb607239e6bd9
18 changes: 9 additions & 9 deletions omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py
Original file line number Diff line number Diff line change
@@ -1495,11 +1495,11 @@ def draw_lab(label, lx, ly, align='left'):
return label_h

spacer = 5
borderWidth = 0
border_width = 0
if border is not None and border['showBorder']:
borderWidth = border['strokeWidth']
border_width = border['strokeWidth']

borderSpacer = spacer + borderWidth
border_spacer = spacer + border_width

# Render each position:
for key, labels in positions.items():
@@ -1531,42 +1531,42 @@ def draw_lab(label, lx, ly, align='left'):
draw_lab(label, lx, ly, align='right')
elif key == 'top':
lx = x + (width / 2)
ly = y - borderWidth
ly = y - border_width
labels.reverse()
for label in labels:
ly = ly - label['size'] - spacer
draw_lab(label, lx, ly, align='center')
elif key == 'bottom':
lx = x + (width / 2)
ly = y + height + borderSpacer
ly = y + height + border_spacer
for label in labels:
label_h = draw_lab(label, lx, ly, align='center')
ly += label_h + spacer
elif key == 'left':
lx = x - borderSpacer
lx = x - border_spacer
sizes = [label['size'] for label in labels]
total_h = sum(sizes) + spacer * (len(labels) - 1)
ly = y + (height - total_h) / 2
for label in labels:
label_h = draw_lab(label, lx, ly, align='right')
ly += label_h + spacer
elif key == 'right':
lx = x + width + borderSpacer
lx = x + width + border_spacer
sizes = [label['size'] for label in labels]
total_h = sum(sizes) + spacer * (len(labels) - 1)
ly = y + (height - total_h) / 2
for label in labels:
label_h = draw_lab(label, lx, ly)
ly += label_h + spacer
elif key == 'leftvert':
lx = x - borderSpacer
lx = x - border_spacer
ly = y + (height / 2)
labels.reverse()
for label in labels:
lx = lx - label['size'] - spacer
draw_lab(label, lx, ly, align='left-vertical')
elif key == 'rightvert':
lx = x + width + borderSpacer
lx = x + width + border_spacer
ly = y + (height / 2)
labels.reverse()
for label in labels: