Fix labels around border#616
Conversation
| y = panel['y'] | ||
| width = panel['width'] | ||
| height = panel['height'] | ||
| border = panel['border'] |
There was a problem hiding this comment.
better to use border = panel.get('border') which won't cause an error if border is missing
|
The app JS fix looks good. The PDF labels are shifted OK for single labels in some positions, but where we have multiple labels (e.g top right panel) or labels on the inside corners then it's not looking right. Screenshot shows app (top-left), PDF with this PR (top-right) and PDF without this PR (bottom). All borders are 15 px: |
|
Hello Will, Thanks for you careful review. I've made a fix to correct that. There is only one remaining thing. When you re-open the figure, with vertical labels on panel with borders, the vertical labels are very far away from the panel. If you move the panel, then the position of the labels are correctly updated. I found out that this behavior is coming from those two lines If I remove them, this behavior disappear. But I don't know if I'm allowed to remove them, as they should be needed for something, right ? Rémy. |
|
OK, so this took me quite a bit of digging... You do need those I also noticed that if you simply toggle the border (hide then show) then it fixes the issue, which turns out that simply calling Then I tried adding an extra call to It turns out that the first time that If I update the code to avoid calling With that change, it also turns out that we don't need Give this a try! |
|
Hi @will-moore Indeed, it's a deep review you did here, thanks for your time ! Thanks again for finding the solution, |
|
Conflicting PR. Removed from build OMERO-plugins-push#345. See the console output for more details.
--conflicts |
| self.render_shapes(); | ||
| }, 10); | ||
| this.render_scalebar(); // also calls render_layout() -> render_labels() | ||
| this.render_shapes(); |
|
Conflicting PR. Removed from build OMERO-plugins-push#346. See the console output for more details.
--conflicts |
|
Conflicting PR. Removed from build OMERO-plugins-push#347. See the console output for more details.
--conflicts |
Tom-TBT
left a comment
There was a problem hiding this comment.
this PR fixes what it says it fixes. I also tested together with the colorbar PR #605 and there's no interference. Looks good on that front.
But I would like to also fix the "crop page around panel" to account for the border. But this would bring more conflicts as I'm also modifying those parts extensively in the colorbar PR.
I suggest to proceed in this order:
- merge colorbar PR
- solve current conflicts
- add following changes to handle the "crop page"
diff --git a/src/js/models/panel_model.js b/src/js/models/panel_model.js
index fbef52a5..722e6465 100644
--- a/src/js/models/panel_model.js
+++ b/src/js/models/panel_model.js
@@ -1104,6 +1104,10 @@
shift = top_labels.reduce(function(prev, l){
return prev + (LINE_HEIGHT * l.size);
}, shift);
+ var border = this.get("border");
+ if (border && border["showBorder"]) {
+ shift = shift + border["strokeWidth"];
+ }
var shift_cbar = 0;
var cb = this.get("colorbar");
@@ -1138,6 +1142,10 @@
const width = this.measureTextSize(l.text, l.size + "px");
shift = Math.max(shift, width);
}
+ var border = this.get("border");
+ if (border && border["showBorder"]) {
+ shift = shift + border["strokeWidth"];
+ }
var start = "";
var end = "";
@@ -1185,6 +1193,10 @@
const width = this.measureTextSize(l.text, l.size + "px");
shift = Math.max(shift, width);
}
+ var border = this.get("border");
+ if (border && border["showBorder"]) {
+ shift = shift + border["strokeWidth"];
+ }
var start = "";
var end = "";
@@ -1226,6 +1238,10 @@
shift = bottom_labels.reduce(function(prev, l){
return prev + (LINE_HEIGHT * l.size);
}, shift);
+ var border = this.get("border");
+ if (border && border["showBorder"]) {
+ shift = shift + border["strokeWidth"];
+ }
var shift_cbar = 0;
var cb = this.get("colorbar");|
Conflicting PR. Removed from build OMERO-plugins-push#419. See the console output for more details.
--conflicts |
|
Conflicting PR. Removed from build OMERO-plugins-push#420. See the console output for more details.
--conflicts |
|
Conflicting PR. Removed from build OMERO-plugins-push#421. See the console output for more details.
--conflicts |
|
Conflicting PR. Removed from build OMERO-plugins-push#422. See the console output for more details.
--conflicts |
|
Conflicting PR. Removed from build OMERO-plugins-push#423. See the console output for more details.
--conflicts |
|
Conflicting PR. Removed from build OMERO-plugins-push#424. See the console output for more details.
--conflicts |
|
Conflicting PR. Removed from build OMERO-plugins-push#451. See the console output for more details.
--conflicts |
|
Conflicting PR. Removed from build OMERO-plugins-push#491. See the console output for more details.
|
|
Hi @Tom-TBT , "crop page around panel" should be fixed thanks to your above code snippet |
will-moore
left a comment
There was a problem hiding this comment.
This is all working fine now. Cropping is good etc.

Resolves #614, resolves #615