Skip to content

Commit

Permalink
Merge pull request #1699 from girder/reduced-geojs-load
Browse files Browse the repository at this point in the history
Reduce loading geojs when switching views in Girder
  • Loading branch information
manthey authored Oct 22, 2024
2 parents a4160ea + 7cd5fb1 commit bc68551
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 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
12 changes: 10 additions & 2 deletions girder_annotation/test_annotation/web_client_specs/geojsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ $(function () {
hoverEvents: true
});
viewer.once('g:beforeFirstRender', function () {
window.geo.util.mockWebglRenderer();
try {
window.geo.util.mockWebglRenderer();
} catch (err) {
// if this is already mocked, do nothing.
}
});
waitsFor(function () {
return $('.geojs-layer.active').length >= 1;
Expand Down Expand Up @@ -1032,7 +1036,11 @@ $(function () {
scale: {position: {bottom: 20, right: 10}, scale: 0.0005}
});
viewer.once('g:beforeFirstRender', function () {
window.geo.util.mockWebglRenderer();
try {
window.geo.util.mockWebglRenderer();
} catch (err) {
// if this is already mocked, do nothing.
}
});
waitsFor(function () {
return $('.geojs-layer.active').length >= 1 && viewer.scaleWidget;
Expand Down

0 comments on commit bc68551

Please sign in to comment.