Fix: Labels overlap when map is rotated by Sublimis · Pull Request #1578 · mapsforge/mapsforge
Navigation Menu
{{ message }}
- Notifications You must be signed in to change notification settings
- Fork 395
Merged
Fix: Labels overlap when map is rotated#1578
devemux86 merged 1 commit intomapsforge:masterfrom
Fix: Labels overlap when map is rotated#1578
devemux86 merged 1 commit intomapsforge:masterfrom
Conversation
Copy link
Contributor
Sublimis
commented
Nov 19, 2024
Sublimis
commented
Related (especially the comment):
Lines 150 to 162 in bbc6425
| double x = this.xy.x - origin.x; | |
| double y = this.xy.y - origin.y; | |
| if (!Rotation.noRotation(rotation)) { | |
| androidCanvas.rotate(-rotation.degrees, rotation.px, rotation.py); | |
| Point rotated = rotation.rotate(x, y, true); | |
| x = rotated.x; | |
| y = rotated.y; | |
| } | |
| // the offsets can only be applied after rotation, because the label needs to be rotated | |
| // around its center. | |
| x += this.horizontalOffset + boundary.left; | |
| y += this.verticalOffset + boundary.top; | |
Before/After:
Copy link
Contributor Author
Sublimis
commented
Nov 19, 2024
Sublimis commented
Nov 19, 2024Please note that this fix is not perfect and may require more work, as it doesn't deal with offsets. Every proper solution should probably also recognize the additional offsets added, e.g.:
Lines 160 to 161 in bbc6425
| x += this.horizontalOffset + boundary.left; | |
| y += this.verticalOffset + boundary.top; |
and
Lines 200 to 201 in bbc6425
| x += this.horizontalOffset; | |
| y += this.verticalOffset + textOffset; // the text offset has nothing to do with rotation, so add later |
However, it does appear to be improvement over the current implementation.
devemux86
added this to the
0.23.0 milestone
devemux86
merged commit
82ea30e
into
mapsforge:master
Copy link
Collaborator
devemux86
commented
Nov 20, 2024
devemux86 commented
Nov 20, 2024@Sublimis Thanks!
Sublimis
deleted the
tmp13
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

