Skip to content

Commit

Permalink
api fix
Browse files Browse the repository at this point in the history
  • Loading branch information
BunkFME committed Apr 15, 2024
1 parent dc7f748 commit d6139f2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions common/reviews/api/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2094,7 +2094,7 @@ interface IStackViewport extends IViewport {
// (undocumented)
setDefaultProperties(ViewportProperties: StackViewportProperties, imageId?: string): void;
// (undocumented)
setImageIdIndex(imageIdIndex: number): Promise<string>;
setImageIdIndex(imageIdIndex: number, overwriteScrollIndex?: boolean): Promise<string>;
// (undocumented)
setProperties({ voiRange, invert, interpolationType, rotation, colormap, }: StackViewportProperties, suppressEvents?: boolean): void;
// (undocumented)
Expand Down Expand Up @@ -3138,7 +3138,7 @@ export class StackViewport extends Viewport implements IStackViewport, IImagesLo
// (undocumented)
setDefaultProperties(ViewportProperties: StackViewportProperties, imageId?: string): void;
// (undocumented)
setImageIdIndex(imageIdIndex: number): Promise<string>;
setImageIdIndex(imageIdIndex: number, overwriteScrollIndex?: any): Promise<string>;
// (undocumented)
protected setInterpolationType: (interpolationType: InterpolationType) => void;
// (undocumented)
Expand Down
15 changes: 12 additions & 3 deletions packages/core/src/RenderingEngine/StackViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2447,7 +2447,10 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
* @param imageIdIndex - number represents imageId index
* @param overwriteScrollIndex - can be used to also set the start position of scroll() to this index
*/
private async _setImageIdIndex(imageIdIndex: number, overwriteScrollIndex: boolean = false): Promise<string> {
private async _setImageIdIndex(
imageIdIndex: number,
overwriteScrollIndex?: boolean
): Promise<string> {
if (imageIdIndex >= this.imageIds.length) {
throw new Error(
`ImageIdIndex provided ${imageIdIndex} is invalid, the stack only has ${this.imageIds.length} elements`
Expand Down Expand Up @@ -2589,7 +2592,10 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
* provided imageIds in setStack
* @param overwriteScrollIndex - can be used to also set the start position of scroll() to this index
*/
public setImageIdIndex(imageIdIndex: number, overwriteScrollIndex: boolean = false): Promise<string> {
public setImageIdIndex(
imageIdIndex: number,
overwriteScrollIndex?
): Promise<string> {
this._throwIfDestroyed();

// If we are already on this imageId index, stop here
Expand All @@ -2598,7 +2604,10 @@ class StackViewport extends Viewport implements IStackViewport, IImagesLoader {
}

// Otherwise, get the imageId and attempt to display it
const imageIdPromise = this._setImageIdIndex(imageIdIndex, overwriteScrollIndex);
const imageIdPromise = this._setImageIdIndex(
imageIdIndex,
overwriteScrollIndex
);

return imageIdPromise;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/types/IStackViewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export default interface IStackViewport extends IViewport {
*/
setImageIdIndex(
imageIdIndex: number,
overwriteScrollIndex: boolean
overwriteScrollIndex?: boolean
): Promise<string>;
/**
* Calibrates the image with new metadata that has been added for imageId. To calibrate
Expand Down

0 comments on commit d6139f2

Please sign in to comment.