Skip to content

Commit

Permalink
Merge pull request #611 from girder/tile-query-defaults
Browse files Browse the repository at this point in the history
Support tile query default parameters for the image viewer widget
  • Loading branch information
manthey authored May 27, 2021
2 parents 3d2ebfc + 6979575 commit 9fed57d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import View from '@girder/core/views/View';
var ImageViewerWidget = View.extend({
initialize: function (settings) {
this.itemId = settings.itemId;
// optional query parameters, such as {encoding: 'PNG'}, may be
// undefined or null
this.tileQueryDefaults = settings.tileQueryDefaults;

return restRequest({
type: 'GET',
Expand All @@ -31,6 +34,9 @@ var ImageViewerWidget = View.extend({
* @param {object} [query]: optional query parameters to add to the url.
*/
_getTileUrl: function (level, x, y, query) {
if (this.tileQueryDefaults) {
query = $.extend({}, this.tileQueryDefaults, query || {});
}
var url = getApiRoot() + '/item/' + this.itemId + '/tiles/zxy/' +
level + '/' + x + '/' + y;
if (query) {
Expand Down

0 comments on commit 9fed57d

Please sign in to comment.