Skip to content

Commit

Permalink
Fixed cover image size in measureImageWithDimensions.
Browse files Browse the repository at this point in the history
  • Loading branch information
isamu committed Dec 21, 2023
1 parent 9175f83 commit cb9804e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/DocMeasure.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ class DocMeasure {
let factor = (dimensions.width / dimensions.height > node.fit[0] / node.fit[1]) ? node.fit[0] / dimensions.width : node.fit[1] / dimensions.height;
node._width = node._minWidth = node._maxWidth = dimensions.width * factor;
node._height = dimensions.height * factor;
} else if (node.cover) {
node._width = node._minWidth = node._maxWidth = node.cover.width;
node._height = node._minHeight = node._maxHeight = node.cover.height;
} else {
node._width = node._minWidth = node._maxWidth = node.width || dimensions.width;
node._height = node.height || (dimensions.height * node._width / dimensions.width);
Expand Down

0 comments on commit cb9804e

Please sign in to comment.