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

Pins Positioned Incorrectly #238

Closed
senica opened this issue Jun 2, 2016 · 9 comments · Fixed by #239
Closed

Pins Positioned Incorrectly #238

senica opened this issue Jun 2, 2016 · 9 comments · Fixed by #239

Comments

@senica
Copy link
Contributor

senica commented Jun 2, 2016

Overview:

When the container map is not positioned at 0,0, the pins are wrongly placed on the map.
This also happens if there is content before the map on the page.

Acceptance Criteria:

Expected that pins to be centered on region

Steps to Duplicate ( required for detects ):

http://codepen.io/anon/pen/QEbWvQ
Use any of the examples, move the map anywhere else on the screen either by adding content before it or making absolutely positioned.

Relevant Documentation ( optional )

http://codepen.io/anon/pen/QEbWvQ

senica added a commit to senica/jqvmap that referenced this issue Jun 2, 2016
@manifestinteractive
Copy link
Contributor

If you are changing the way CSS positioning is being used for the map, you simply need to update your CSS for the pins to reflect your CSS changes. The CSS we have is just for example usage, you are free, as you have done, to change the CSS however you see fit. It just means that you'll also need to make changes to address things that break with your CSS updates.

For your specific issue, simply adding the following CSS addresses the issue.

#vmap{
  /* This breaks it also */
  position: absolute;
  top: 100px;
  left: 40px;
}
.jqvmap-pin {
  position: fixed !important;
}

Forked codepen here: http://codepen.io/manifestinteractive/pen/mEJdxR

@manifestinteractive
Copy link
Contributor

Checking out your PR now. Pins was something added by someone else, so it'd be nice to have this fixed for good. Had a few people report this, but CSS always worked as a solution. But I agree the code should be smart enough to position regardless of map container position.

@senica
Copy link
Contributor Author

senica commented Jun 2, 2016

This issue is a larger internal positioning issue. Setting a fixed position on the pin would break it when you scroll the page. Then you have to handle that.
screen shot 2016-06-02 at 12 23 15 pm

It seems better to just adjust the internal positioning to always be relative to the map itself. I haven't thoroughly tested this, but it seems to be working in my test case just fine. I've only tested on Chrome, btw.

@kalidema
Copy link

kalidema commented Jun 10, 2016

Please see the attached screenshot, I have the same problem.
Based on this screenshot I think, pins absolute position is not calculated based on the parent element size (width, height), but it refers to the body element. And the problem is that the parent element has relative position.
screenshot

And also see if I remove header and sidebar.

screenshot2

@senica
Copy link
Contributor Author

senica commented Jun 10, 2016

Check out the pull request: #239 maybe you can help test it out.

manifestinteractive added a commit that referenced this issue Jun 11, 2016
@mikalai-okun
Copy link

@manifestinteractive @senica
Did you guys resolve the issue?
I'm getting the same problems with the latest code
https://codepen.io/mikalai-okun/pen/ywZpoN

@senica
Copy link
Contributor Author

senica commented Mar 25, 2019

Yes, I believe the pull request I submitted fixes the issue, but it's been a couple years since I've touched this. I believe this is the library being used here: https://www.everyschool.com/adopt-your-school/

@mikalai-okun
Copy link

I pulled the latest code from the repo and still see position issues, but wondering if there is anything to do with the map itself? I pulled another SVG and it a bit better, which is very strange to me, since position should not be dependant on svg.
I was able to make it look good by introducing adjustment coefficients, but its obviously very bad approach and not working on Zoom.

@senica
Copy link
Contributor Author

senica commented Mar 25, 2019

Yeah, I remember it being a strange issue. That sucks. It doesn't look like anyone is maintaining this library anymore.

Maybe grab the code off that site from the link I sent, I know that works okay. Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants