Skip to content

Commit

Permalink
fix: change negative header/footer value to 0 (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
maharshivpatel authored Jun 26, 2024
2 parents f8c32de + 4c39fe0 commit 1b00d74
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ const handleKeyDown = ({
element.startY -= finalValue.value - object[property];
});
MainStore.page.headerHeight += object[property] - finalValue.value;
if (MainStore.page.headerHeight < 0) {
MainStore.page.headerHeight = 0;
}
} else if (property == "marginLeft") {
ElementStore.Elements.forEach((element) => {
element.startX -= finalValue.value - object[property];
Expand Down Expand Up @@ -360,6 +363,9 @@ const handleBlur = ({
page.footer[0].startY += object[property] - convertedValue.value;
});
MainStore.page.headerHeight += object[property] - convertedValue.value;
if (MainStore.page.headerHeight < 0) {
MainStore.page.headerHeight = 0;
}
} else if (property == "marginLeft") {
ElementStore.Elements.forEach((element) => {
element.startX -= convertedValue.value - object[property];
Expand All @@ -368,6 +374,9 @@ const handleBlur = ({
ElementStore.Elements.forEach((page) => {
page.footer[0].height += object[property] - convertedValue.value;
MainStore.page.footerHeight += object[property] - convertedValue.value;
if (MainStore.page.footerHeight < 0) {
MainStore.page.footerHeight = 0;
}
});
}
if (["width", "height"].indexOf(property)) {
Expand Down

0 comments on commit 1b00d74

Please sign in to comment.