Skip to content
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

Feature/1280 print scale bar update #1293

Merged
merged 22 commits into from
Apr 4, 2023

Conversation

OlofSvahnVbg
Copy link
Collaborator

closes #1280

@OlofSvahnVbg OlofSvahnVbg added the new feature Request for adding/changing functionality label Feb 27, 2023
@OlofSvahnVbg OlofSvahnVbg added this to the 3.x milestone Feb 27, 2023
@OlofSvahnVbg OlofSvahnVbg self-assigned this Feb 27, 2023
@jesade-vbg
Copy link
Contributor

Hang on with the reviews. We've had some additional comments from others regarding this.

@Hallbergs
Copy link
Member

Hallbergs commented Feb 28, 2023

Hang on with the reviews. We've had some additional comments from others regarding this.

Just let me know when you are ready!

@jesade-vbg jesade-vbg marked this pull request as draft February 28, 2023 09:24
@@ -45,6 +47,15 @@ class Print extends React.PureComponent {
props.options.scales = this.scales;
}

// Prepare scaleMeters from admin options, fallback to default if needed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather see the use of indexOf(",") > 0 to prevent double split, but its not just in this new code so .... ignore my comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

scaleBarLengths = {
100: 2.5,
200: 5,
defaultScaleBarLengths = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain in a comment here, why the default values has these values. To make it look good?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought these values where need for other kommuner, maybe the use more scales than Varberg, for instance. But if not I can remove the unnecessary ones.

const scaleBarFirstDigits = parseInt(
scaleBarLengthMetersStr.substring(0, 2)
);
const startsWithDoubleDigits =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to explain this in a little comment?

divNrString = divNr.toLocaleString();

// We need to make sure correct placement if dividerString is a fraction number
const dividerStrLength = divNrString.includes(",")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use includes(",") in this context as toLocaleString() is used in the lines above.
It will work in Sweden but not in US.

@jesade-vbg jesade-vbg marked this pull request as ready for review March 29, 2023 13:39
@jesade-vbg
Copy link
Contributor

Ready for a second opinion.

Hallbergs
Hallbergs previously approved these changes Mar 31, 2023
Copy link
Member

@Hallbergs Hallbergs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good! 🥳 One thing i found was that the divider number could change depending on the chosen DPI, see images below:

1:100 000 72 DPI
image

1:100 000 150 DPI
image

1:100 000 300 DPI
image

The behavior above is OK for me, but maybe someone else sees issues with that?

Also, remember to sync with develop before merge :)

@jacobwod
Copy link
Member

It took me a while to figure out @Hallbergs comment, but now I see and agree. (If you're having trouble like me spotting it, here's a hint: take a look at the numbers printed on the scale bar in the second, 150 DPI, picture.)

I'm fine with it too but if it's an easy fix, it's welcome.

@Hallbergs
Copy link
Member

The narrower dividers on the first half of the scale bar are really nice! Great work!
image

@Hallbergs
Copy link
Member

I missed a warning when reviewing... When you're syncing with develop, make sure to fix this one as well.
image

@jesade-vbg
Copy link
Contributor

1:100 000 150 DPI image

So strange. This actually does not happen in our dev environment at 90 or 150dpi. :/
image

@OlofSvahnVbg
Copy link
Collaborator Author

Thanks for the nice feedback. Going to fix the number bug and the divider :)

@OlofSvahnVbg
Copy link
Collaborator Author

I think this will fix the problem:

image

I think the Math.floor sometimes returned 4 instead of 5 when the divLinesArray.length was 10. The new code makes sure that if divLinesArr is equally divisible by 2, midIndex gets set to half of that value.

@jesade-vbg jesade-vbg merged commit 333a8fd into develop Apr 4, 2023
@jesade-vbg jesade-vbg deleted the feature/1280-PrintScaleBarUpdate branch April 4, 2023 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature Request for adding/changing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants