Skip to content

Commit

Permalink
Merge pull request #1174 from geoadmin/pb-1278-icon-offset
Browse files Browse the repository at this point in the history
PB-1278: Fix Icon with offset (pin) changes positon
  • Loading branch information
ismailsunni authored Jan 13, 2025
2 parents 74f0174 + a7cd57f commit 162eb9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/api/print.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,7 @@ class GeoAdminCustomizer extends BaseCustomizer {
)
: 0
// don't ask why it works, but that's the best I could do.

symbolizer.graphicYOffset = symbolizer.graphicYOffset
? (symbolizer.graphicYOffset = adjustWidth(-size[1], this.printResolution))
: 0
symbolizer.gaphicYOffset = Math.round(1000 * symbolizer.gaphicYOffset ?? 0) / 1000
}
if (size) {
symbolizer.graphicWidth = adjustWidth(size[0] * scale, this.printResolution)
Expand Down
6 changes: 4 additions & 2 deletions src/utils/styleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,11 @@ export const highlightPointStyle = new Style({
// Change a width according to the change of DPI (from the old geoadmin)
// Originally introduced here https://github.com/geoadmin/mf-geoadmin3/pull/3280
export function adjustWidth(width, dpi) {
if (!width || isNaN(width) || width <= 0.0 || !dpi || isNaN(dpi) || dpi <= 0) {
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 162eb9c

Please # to comment.