Bezbozhnik


I have a custom icon for my pushpins that "points" to a different pixel than the center of the icon. I've seen a number of posts that claim that the solution for changing the offset is to apply a style which sets the icon's positioning to absolute and shifts, say, top and left. This appears to work in v5, at least for positioing the icon. However, the hover box doesn't seem to respect the new position; the little green dots appear over where the icon would have appeared without the style, and the hover box points to the same empty space. Is there a new way of correctly specifying the icon offset



Re: Pushpin icon offset in v5

Jared H


VEShape.SetIconAnchor(point) is a method available for shapes other than pushpins. The MSDN remark, however is as follows, and explains the behavior you are referencing for standard pins:

This value is ignored for a pushpin. A pushpin's icon anchor point, either custom or default, is always the latitude and longitude of the pin itself.

You may want to look at the VECustomIconSpecification class definition as well...this seems to have potential, although I have not tried the implementation yet myself.






Re: Pushpin icon offset in v5

Derek Chan

If you need to set the offset, you can do it through the VECustomIconSpecification by hiding it inside of a <div>
tag with the offset set inside the style. Something like:

Code Snippet

var CustomIconSpecification = new VECustomIconSpecification("<div class=¡±CustomPin¡±><img src=¡± http://dev.live.com/virtualearth/sdk/img/poi_viewer.gif¡°</div>");

VEShape.SetCustomIcon(CustomIconSpecification);


Where CustomPin is the CSS class that contains the offset

Hope that helps,






Re: Pushpin icon offset in v5

Bezbozhnik

This is what I'm doing, and while the CSS does move the icon, the rest of VE doesn't seem to realize it's moved. Hence the popup box pointing to where the icon would be if it hadn't moved, as well as the green dots that appear over it on hover. Any thoughts as to how one can tell VE that the icon is not centered on its middle




Re: Pushpin icon offset in v5

Harvester

Ran into exactly this problem. In the end I resorted to CSS hacks. I move the pin up a few pixels and this is what I had to override in the css to move the default infobox up a few:

Code Snippet

.ero-progressAnimation { margin-left: 25px; margin-top: -16px; }
.ero-leftBeak { margin-left: 30px; }


As Jerod mentioned you can also clear the default infobox settings and go it your own with some custom CSS that attaches to the cleared version of the box. But you don't get the cool beak thing on it that way Smile

Greg




Re: Pushpin icon offset in v5

Bezbozhnik

Harvester wrote:
Ran into exactly this problem. In the end I resorted to CSS hacks. I move the pin up a few pixels and this is what I had to override in the css to move the default infobox up a few:

Code Snippet

.ero-progressAnimation { margin-left: 25px; margin-top: -16px; }
.ero-leftBeak { margin-left: 30px; }


As Jerod mentioned you can also clear the default infobox settings and go it your own with some custom CSS that attaches to the cleared version of the box. But you don't get the cool beak thing on it that way

Greg


Yep, that did it for me. Thanks!




Re: Pushpin icon offset in v5

Anonymous26091984

Ya.This works but it moves all the pins by a few pixels.Suppose i want to move a particular pin how would i do it.




Re: Pushpin icon offset in v5

Harvester

When you create the pin you can specify the icon as part of the Shape definition, per Derek's post above. Use some clever html or CSS to handle the pin's special requirements. Unfortunately the CSS hack I outlined earlier moves the infobox as a whole. You're probably heading into custom infobox territory.

Another thing that may work as a hack is to attach an event to the mouseover event that causes that CSS hack I outlined to change depending on the pin that triggers the event... Just a thought.




Re: Pushpin icon offset in v5

muridayo

Not sure if this helps, but i was able to reposition all the custom icons on my map with the following css code:

Code Snippet
<style type="text/css">
.VEAPI_Pushpin
{
margin-left: 5px;
margin-top: 5px;
}
</style>

To me, it appears as though whatever custom icon I use, it positions the bottom right corner of the icon and sets that as the anchor (which doesn't make any sense to me, as all icons you use will thus be shifted up and to the left). shouldn't it default to using the icon center as the anchor






Re: Pushpin icon offset in v5

Anonymous26091984

Can you give me an example on how to do it for a particular pushpin without moving into the custom infobox zone.



Re: Pushpin icon offset in v5

AliceaMC

I'm just learning but have run into this problem as well. I have a couple of questions:

1. Where would I put this code

2. Do I need to rename .VEAPI_Pushpin to whatever I am calling my pushpins

Thanks for any help.