Skip to content

Commit

Permalink
PB-1278: Use the raw graphicOffset. Also allow width to be negative (…
Browse files Browse the repository at this point in the history
…e.g. offset).
  • Loading branch information
ismailsunni committed Dec 17, 2024
1 parent 2952183 commit e13f326
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/api/print.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,9 @@ 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
// 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 ? symbolizer.graphicYOffset : 0
}
if (size) {
symbolizer.graphicWidth = adjustWidth(size[0] * scale, this.printResolution)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/styleUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ 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
}

Expand Down

0 comments on commit e13f326

Please sign in to comment.