Skip to content

Commit

Permalink
Fix for saving original values
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyblasta committed Jan 12, 2023
1 parent 77aad69 commit 01d4746
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/controls/print/print-resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,25 @@ export default function PrintResize(options = {}) {
if (!Array.isArray(style)) {
const image = style.getImage();
if (image) {
imageSavedScale[feature.ol_uid] = { scale: image.getScale() ? image.getScale() / image.getScale() : undefined };
if (!(feature.ol_uid in imageSavedScale)) {
imageSavedScale[feature.ol_uid] = { scale: image.getScale() ? image.getScale() / image.getScale() : undefined };
}
const imageScale = image.getScale() ? multiplyRelativeValueByFactor(image.getScale()) : styleScale;
image.setScale(imageScale);
}
const stroke = style.getStroke();
if (stroke) {
strokeSavedWidth[feature.ol_uid] = { width: stroke.getWidth() ? stroke.getWidth() : undefined };
if (!(feature.ol_uid in strokeSavedWidth)) {
strokeSavedWidth[feature.ol_uid] = { width: stroke.getWidth() ? stroke.getWidth() : undefined };
}
const strokeWidth = stroke.getWidth() ? multiplyRelativeValueByFactor(stroke.getWidth()) : styleScale;
stroke.setWidth(strokeWidth);
}
const text = style.getText();
if (text) {
textSavedScale[feature.ol_uid] = { scale: text.getScale() ? text.getScale() / text.getScale() : undefined };
if (!(feature.ol_uid in textSavedScale)) {
textSavedScale[feature.ol_uid] = { scale: text.getScale() ? text.getScale() / text.getScale() : undefined };
}
const textScale = text.getScale() ? multiplyRelativeValueByFactor(text.getScale()) : styleScale;
text.setScale(textScale);
}
Expand Down

0 comments on commit 01d4746

Please sign in to comment.