Skip to content

Commit

Permalink
fixed 928
Browse files Browse the repository at this point in the history
  • Loading branch information
edsilv committed Nov 13, 2023
1 parent 0e34e2f commit 173e44f
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class OpenSeadragonExtension extends BaseExtension {
shareDialogue: ShareDialogue;
defaultConfig: any = defaultConfig;
locales = {
"en-GB": defaultConfig
"en-GB": defaultConfig,
};

create(): void {
Expand Down Expand Up @@ -1233,23 +1233,28 @@ export default class OpenSeadragonExtension extends BaseExtension {
return `${baseUri}/${id}/${region}/${size}/${rotation}/${quality}.jpg`;
}

getConfinedImageDimensions(canvas: Canvas, width: number): Size {
getConfinedImageDimensions(canvas: Canvas, longestSide: number): Size {
let resourceWidth: number = canvas.getWidth();
let resourceHeight: number = canvas.getHeight();

if (!resourceWidth) {
resourceWidth = canvas.externalResource.width;
}

let resourceHeight: number = canvas.getHeight();

if (!resourceHeight) {
resourceHeight = canvas.externalResource.height;
}

const dimensions: Size = new Size(0, 0);
dimensions.width = width;
const normWidth = Maths.normalise(width, 0, resourceWidth);
dimensions.height = Math.floor(resourceHeight * normWidth);
if (resourceWidth > resourceHeight) {
dimensions.width = longestSide;
const normWidth = Maths.normalise(longestSide, 0, resourceWidth);
dimensions.height = Math.floor(resourceHeight * normWidth);
} else {
dimensions.height = longestSide;
const normHeight = Maths.normalise(longestSide, 0, resourceHeight);
dimensions.width = Math.floor(resourceWidth * normHeight);
}
return dimensions;
}

Expand Down Expand Up @@ -1556,7 +1561,7 @@ export default class OpenSeadragonExtension extends BaseExtension {
const manifest = this.helper.manifest;
const sequence = manifest!.getSequences()[0];
const canvases = sequence.getCanvases();
const paged = (!!this.getSettings().pagingEnabled && this.helper.isPaged());
const paged = !!this.getSettings().pagingEnabled && this.helper.isPaged();
const viewingDirection = this.helper.getViewingDirection();

let indices: number[] = [];
Expand Down

1 comment on commit 173e44f

@vercel
Copy link

@vercel vercel bot commented on 173e44f Nov 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.