-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PB-1278: Fix Icon with offset (pin) changes positon #1174
base: develop
Are you sure you want to change the base?
Conversation
web-mapviewer Run #4129
Run Properties:
|
Project |
web-mapviewer
|
Branch Review |
pb-1278-icon-offset
|
Run status |
Passed #4129
|
Run duration | 05m 40s |
Commit |
9111943ef0: PB-1278: Simplify code.
|
Committer | Ismail Sunni |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
0
|
Pending |
21
|
Skipped |
0
|
Passing |
217
|
View all changes introduced in this branch ↗︎ |
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe @ltkum can better tell if this might break something or not...
I think that was a "trade-off" fix so that we would not have to add some fixes to the mapfishprint library or backend. I'll let him tell us what was the state on that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I need @ltkum to the changes in this PR.
For this code, I remove it because for offset
, it might be a negative number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I remember and can see :
The width <= 0.0
line was here because, afterwards, we use a math.max to set the scale size to its minimal value if it's smaller than it (as very small numbers would break the print). Currently, you don't check anymore if it's negative, which means it will set its offset to min scale when it's negative.
what I would do :
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)
}
that way, your offsets are not set to 0, nor to MIN_PRINT_SCALE_SIZE
e13f326
to
9111943
Compare
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @ltkum what do you think about this one?
Need to be reviewd by @ltkum as this revert his change in #1015
Test link
Sample on 1:500 and 1:5000. Looks good
Test link