Skip to content

Commit

Permalink
Reduce loading geojs when switching views in Girder
Browse files Browse the repository at this point in the history
This checks if geojs is already in memory and doesn't replace it with
itself
  • Loading branch information
manthey committed Oct 22, 2024
1 parent f4517c4 commit 5315be0
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- Speed up recursive item lists ([#1694](../../pull/1694))
- Better handle images with signed pixel data ([#1695](../../pull/1695))
- Reduce loading geojs when switching views in Girder ([#1699](../../pull/1699))

## 1.30.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ var GeojsImageViewerWidget = ImageViewerWidget.extend({
}
return this;
}),
$.ajax({ // like $.getScript, but allow caching
url: root + '/plugins/large_image/extra/geojs.js' + (BUILD_TIMESTAMP ? '?_=' + BUILD_TIMESTAMP : ''),
dataType: 'script',
cache: true
}))
!window.geo
? $.ajax({ // like $.getScript, but allow caching
url: root + '/plugins/large_image/extra/geojs.js' + (BUILD_TIMESTAMP ? '?_=' + BUILD_TIMESTAMP : ''),
dataType: 'script',
cache: true
})
: true)
.done(() => {
this.trigger('g:beforeFirstRender', this);
this.render();
Expand Down
6 changes: 5 additions & 1 deletion girder/test_girder/web_client_specs/imageViewerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ $(function () {
var GeojsViewer = girder.plugins.large_image.views.imageViewerWidget.geojs;
girder.utilities.PluginUtils.wrap(GeojsViewer, 'initialize', function (initialize) {
this.once('g:beforeFirstRender', function () {
window.geo.util.mockWebglRenderer();
try {
window.geo.util.mockWebglRenderer();
} catch (err) {
// if this is already mocked, do nothing.
}
window.geo.webgl.webglRenderer._maxTextureSize = 256;
});
initialize.apply(this, _.rest(arguments));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ describe('AnnotationListWidget', function () {
};

this.once('g:beforeFirstRender', function () {
window.geo.util.mockWebglRenderer();
try {
window.geo.util.mockWebglRenderer();
} catch (err) {
// if this is already mocked, do nothing.
}
});
initialize.apply(this, _.rest(arguments));
});
Expand Down

0 comments on commit 5315be0

Please sign in to comment.