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

Reduce loading geojs when switching views in Girder #1699

Merged
merged 1 commit into from
Oct 22, 2024
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
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