You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found out that the markers opacities never changes.
While debugging your code, I realized that mapPixelBounds.y and mapPixelBounds.x both return undefined, leading to markerDistance to become NaN because of L.bounds() returning object with min and max.
Here is a working code:
// bottom out
if (y < center.y ){
y = mapPixelBounds.min.y + markerHeight/2;
x = center.x - (center.y-y) / Math.tan(Math.abs(rad));
markerDistance = -currentMarkerPosition.y - mapPixelBounds.max.y;
// top out
}else{
y = mapPixelBounds.max.y - markerHeight/2;
x = center.x - (y-center.y)/ Math.tan(Math.abs(rad));
markerDistance = - mapPixelBounds.max.y + currentMarkerPosition.y ;
}
}else {
// left out
if (x < center.x ){
x = mapPixelBounds.min.x + markerWidth/2;
y = center.y - (center.x-x ) *Math.tan(rad);
markerDistance = -currentMarkerPosition.x;
// right out
}else{
x = mapPixelBounds.max.x - markerWidth/2;
y = center.y + (x - center.x) *Math.tan(rad);
markerDistance = currentMarkerPosition.x - mapPixelBounds.max.x;
}
}
The text was updated successfully, but these errors were encountered:
I found out that the markers opacities never changes.
While debugging your code, I realized that
mapPixelBounds.y
andmapPixelBounds.x
both return undefined, leading to markerDistance to becomeNaN
because ofL.bounds()
returning object with min and max.Here is a working code:
The text was updated successfully, but these errors were encountered: