Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.

Random fixes #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Random fixes #17

wants to merge 1 commit into from

Conversation

bgilbert6
Copy link

I thought maybe you'd want to integrate some of these. I added Y value sorting, hiding the layer when zooming so it doesn't appear all weird looking, A fix for marker clicking not working in case where you create the popup after the marker is created, and also the bounding box wasn't correct for me so I changed the Y value min/max on the rbush thing.

I also adding padding around the marker drawing search, otherwise it would popup markers in. I think the padding values should be based on the largest icon?

…nk in, fix bounding box for clicking to be correct
@@ -178,12 +191,12 @@ function layerFactory(L) {
var iconSize = marker.options.icon.options.iconSize;

var adj_x = iconSize[0]/2;
var adj_y = iconSize[1]/2;
var adj_y = iconSize[1];
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of taking the full size, the ret below should be using the X/Y Anchor for the adjustment.
I'm assuming your image has an anchor adjustment which is not being accounted for in the hover-over\click box of the icon, so the mouse hover over interactivity is off from what you are seeing drawn.

Copy link
Author

@bgilbert6 bgilbert6 Jul 6, 2018

Choose a reason for hiding this comment

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

Yes there was something weird there. Here is the marker code I had:

I didn't use anything weird in the code, so seems like this library should be able to automatically adjust shouldn't it?

Removing the /2 100% fixed it.

var customIcon = L.icon({
    iconUrl: myicon,
    iconSize: [35, 35], // size of the icon
    iconAnchor: [17.5, 35],
    popupAnchor: [0, -40]
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Its not exactly something being weird, just using it in a manor which myself and others aren't. I really don't use anchors often if at all, so it is definitely something I would notice during my day to day use.

Thanks for the code though, i'll try to play around with it and adjust things.

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

Successfully merging this pull request may close these issues.

2 participants