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

Anchor position top/bottom wrong way around #66

Closed
mjtalbot opened this issue Jul 5, 2018 · 3 comments
Closed

Anchor position top/bottom wrong way around #66

mjtalbot opened this issue Jul 5, 2018 · 3 comments
Labels
feature This issue requests a new feature

Comments

@mjtalbot
Copy link

mjtalbot commented Jul 5, 2018

Firstly thank you, really enjoying the map!

The Anchor.top and Anchor.bottom look like they are the wrong way around, Anchor top actually pins the bottom of my marker to the correct spot.

Should be easy to verify, just place a few markers and zoom in and out.

@johnpryan
Copy link
Collaborator

johnpryan commented Jul 5, 2018

Thanks for filing an issue! I think the original intention was that "top" meant "the top of the marker is pinned to the location." In Leaflet JS, the anchor is an X,Y position defining the "tip of the icon":

The coordinates of the "tip" of the icon (relative to its top left corner). The icon will be aligned so that this point is at the marker's geographical location. Centered by default if size is specified, also can be set in CSS with negative margins.

But it could be less confusing to define the anchor point as "below" and "above" the point on the map. Either way, we need better terminology or documentation for this feature.

@mjtalbot
Copy link
Author

mjtalbot commented Jul 5, 2018

I could be totally misunderstanding something, but I think I agree with you, as in I also thought top would pin the top of the marker as well. However top pins the bottom of the marker to the geographical location.

Let me run through an example

Currently:

var pixelPosY =
              (pos.y - (markerOpt.height - markerOpt._anchor.top)).toDouble();

lets say the geographical y position is calculated to be at 10, and we have a 5x5 marker.

if the top anchor is selected, the top of the marker will be drawn at (10 - (5 - 0)) or 5.
the bottom of the marker is at the geographical y position

if the bottom anchor is selected, the top of the marker will be drawn at (10 - (5 - 5)) or 10.
the top of the marker is at the geographical y position.

I think it should be:

var pixelPosY =
              (pos.y - markerOpt._anchor.top).toDouble();

if the top anchor is selected, the top of the marker will be at (10 - 0), or 10.
the top of the marker is at the geographical location.

if the bottom anchor is selected, the top of the marker will be at (10-5) or 5.
the bottom of the marker is at the geographical y position.

@johnpryan
Copy link
Collaborator

There's been some changes to AnchorAlign since this issue, marking as stale

juliano-souza000 pushed a commit to juliano-souza000/flutter_map that referenced this issue Mar 26, 2023
* Start Upgrade To flutter_map v3.0.0

* Fixed Bugs

* Changed version numbers to v6.0.0
Improved example application

* Use pub.dev beta release of flutter_map v3

* Built Example Applications

* Added invalid store detector to stores list screen

* Built Example Applications

* Updated pub.dev badges in README
Removed redundant analysis options

* Improved Example Application

* Built Example Applications

* Updated for Flutter 3.3.0
Added funding links to pubspec
Replaced issue templates with forms
Improved example application

* Built Example Applications

* Set minimum Flutter constraint to 3.3.0
Ignored FVM

* Removed example applications to resolve conflicts

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
juliano-souza000 pushed a commit to juliano-souza000/flutter_map that referenced this issue Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue requests a new feature
Projects
None yet
Development

No branches or pull requests

2 participants