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

Manual Backport: fix: golden layout not rendering when created outside viewport (#3299) #3302

Merged
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
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>