Skip to content

Commit

Permalink
PB-1278: Address PR review.
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsunni committed Jan 6, 2025
1 parent 8784b3d commit 4db2df5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/api/print.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ class GeoAdminCustomizer extends BaseCustomizer {
)
: 0
// don't ask why it works, but that's the best I could do.
// Note(IS): I'm not sure if this is the best way to handle the Y offset. Need to be tested of different case.
// Per issue 1278, it's correct. But Martin did it differently, but all test is pass.
symbolizer.graphicYOffset = symbolizer.graphicYOffset ?? 0
symbolizer.graphicYOffset = Math.round(symbolizer.graphicYOffset) ?? 0
}
if (size) {
symbolizer.graphicWidth = adjustWidth(size[0] * scale, this.printResolution)
Expand Down
4 changes: 3 additions & 1 deletion src/utils/styleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ export function adjustWidth(width, dpi) {
if (!width || isNaN(width) || !dpi || isNaN(dpi) || dpi <= 0) {
return 0
}

if (width <= 0) {
return -adjustWidth(-width, dpi)
}
return Math.max((width * PRINT_DPI_COMPENSATION) / dpi, MIN_PRINT_SCALE_SIZE)
}

0 comments on commit 4db2df5

Please sign in to comment.