Skip to content

Commit

Permalink
Merge pull request #790 from girder/improve-set-frame-quad
Browse files Browse the repository at this point in the history
Minor improvements to setFrameQuad to make it more flexible.
  • Loading branch information
manthey authored Feb 25, 2022
2 parents b0193d7 + 1f45fe3 commit a497124
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
* @param {string} [options.crossOrigin] If specified, use this as the
* crossOrigin policy for images.
* @param {string} [options.progress] If specified, a function to call whenever
* a texture image is loaded.
* a texture image is loaded. This is also called before the first load.
* @param {boolean} [options.redrawOnFirstLoad=true] If truthy, redraw the
* layer after the base quad is first loaded if a frame value has been set.
*/
Expand Down Expand Up @@ -87,7 +87,7 @@ function setFrameQuad(tileinfo, layer, options) {
type: 'GET',
url: `${options.restUrl}/tile_frames/quad_info`,
data: qiOptions
}).done((data) => {
}).then((data) => {
status.quads = data.quads;
status.frames = data.frames;
status.framesToIdx = data.framesToIdx;
Expand Down Expand Up @@ -139,6 +139,12 @@ function setFrameQuad(tileinfo, layer, options) {
status.images.push(img);
}
status.images[0].src = status.src[0];
if (options.progress) {
try {
options.progress(status);
} catch (err) {}
}
return status;
});
layer.setFrameQuad = function (frame) {
if (status.framesToIdx[frame] !== undefined && status.loaded) {
Expand Down

0 comments on commit a497124

Please sign in to comment.