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

Zoom label #527

Merged
merged 6 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
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: 2 additions & 0 deletions omero_figure/scripts/omero/figure_scripts/Figure_To_Pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,8 @@ def draw_labels(self, panel, page):
label_value.append(channel["label"])
label_value = " ".join(label_value)

elif prop_nf[0] in ["zoom"]:
label_value = str(panel["zoom"]) + " %"
new_text.append(label_value if label_value else item.group())
last_idx = item.end()

Expand Down
5 changes: 5 additions & 0 deletions omero_figure/templates/figure/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,11 @@ <h4>Dynamic properties</h4>
<td>Dataset ID: [dataset.id]</td>
<td>Dataset ID: 1654</td>
</tr>
<tr>
<th>Zoom</th>
<td>[zoom]</td>
<td>100 %</td>
</tr>
</table>
<h4>Legend</h4>
<p>The figure legend will be included in the PDF info page when the figure is
Expand Down
7 changes: 7 additions & 0 deletions src/js/models/panel_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
'pixel_size_x_unit': data.pixel_size_x_unit,
'pixel_size_z_unit': data.pixel_size_z_unit,
'deltaT': data.deltaT,
'zoom':data.zoom,
};

// theT is not changed unless we have to...
Expand Down Expand Up @@ -334,6 +335,12 @@
return (isNegative ? '-' : '') + text;
},

get_zoom_label_text: function() {
var text = "" + this.get('zoom') + " %"
return text;
},


get_name_label_text: function(property, format) {
var text = "";
if (property === "image") {
Expand Down
2 changes: 2 additions & 0 deletions src/js/views/panel_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@
label_value = self.model.get_view_label_text(prop_nf[0], format, precision);
} else if (['channels', 'c'].includes(prop_nf[0])) {
label_value = self.model.get_channels_label_text();
} else if (['zoom'].includes(prop_nf[0])) {
label_value = self.model.get_zoom_label_text();
}

//If label_value hasn't been created (invalid prop_nf[0])
Expand Down
3 changes: 3 additions & 0 deletions src/templates/labels_form_inner_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
<li title="Add a label that shows the current Z-index">
<a href="#" data-label="Z: [z.pixel]">Z (pixel or unit)</a>
</li>
<li title="Add a label that shows the current Zoom level">
<a href="#" data-label="[zoom]">Zoom level (%)</a>
</li>
</ul>
</div>
<% } %>
Expand Down