Skip to content

Commit

Permalink
Manual Backport: fix: golden layout not rendering when created outsid…
Browse files Browse the repository at this point in the history
…e viewport (#3299) (#3302)

* fix: golden layout not rendering when created outside viewport (#3299)

* fix: golden layout not rendering when created outside viewport

Since Lab 4.2 cells outside the viewport get the style
"display: none" which causes the content to not have height.
This causes an error in size calculations of golden layout
from which it doesn't recover.

* Add changelog

---------

Co-authored-by: Ricky O'Steen <[email protected]>
(cherry picked from commit 7e5ddfa)

* Fix changelog header

---------

Co-authored-by: Mario Buikhuizen <[email protected]>
  • Loading branch information
rosteen and mariobuikhuizen authored Nov 18, 2024
1 parent 9992cf1 commit d3a41a6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
A.B.1 (unreleased)
4.0.1 (unreleased)
==================

Bug Fixes
Expand All @@ -14,12 +14,14 @@ Bug Fixes

- Added ``nbclassic`` dependency to fix ``solara``-based popouts. [#3282]

- Fixed viewer widgets displaying improperly if initialized out of view in Jupyter Lab. [#3299]

Cubeviz
^^^^^^^

- Add missing styling to API hints entry for aperture_method in the spectral extraction plugin. [#3231]

- Fixed "spectrum at spaxel" tool so it no longer resets spectral axis zoom. [#3249]
- Fixed "spectrum at spaxel" tool so it no longer resets spectral axis zoom. [#3249]

- Fixed initializing a Gaussian1D model component when ``Cube Fit`` is toggled on. [#3295]

Expand Down
13 changes: 13 additions & 0 deletions jdaviz/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<splitpanes>
<pane size="75">
<golden-layout
v-if="outputCellHasHeight"
style="height: 100%;"
:has-headers="state.settings.visible.tab_headers"
@state="onLayoutChange"
Expand Down Expand Up @@ -162,6 +163,11 @@

<script>
export default {
data() {
return {
outputCellHasHeight: false,
};
},
methods: {
checkNotebookContext() {
this.notebook_context = document.getElementById("ipython-main-app")
Expand All @@ -188,6 +194,13 @@ export default {
if (jpOutputElem) {
jpOutputElem.classList.remove('jupyter-widgets');
}
/* Workaround for Lab 4.2: cells outside the viewport get the style "display: none" which causes the content to not
* have height. This causes an error in size calculations of golden layout from which it doesn't recover.
*/
new ResizeObserver(entries => {
this.outputCellHasHeight = entries[0].contentRect.height > 0;
}).observe(this.$refs.mainapp.$el);
this.outputCellHasHeight = this.$refs.mainapp.$el.offsetHeight > 0
}
};
</script>

0 comments on commit d3a41a6

Please sign in to comment.