Skip to content Skip to sidebar Skip to footer

Nokia Here Maps Javascript Api: Is There Any Property To Fix The Position Of An Infobubble?

Currently we are using HERE Javascript Api 2.5.3 (https://js.api.here.com/se/2.5.3/jsl.js?with=all) and created a InfoBubbleMarker - within custom html content - based on the descr

Solution 1:

You can use the defaultXAlignment and defaultYAlignment properties to alter the preferred offset for the Infobubble e.g.:

var infoBubbles = new nokia.maps.map.component.InfoBubbles();
infoBubbles.options.set("defaultXAlignment", 
    nokia.maps.map.component.InfoBubbles.ALIGNMENT_RIGHT);
infoBubbles.options.set("defaultYAlignment",
     nokia.maps.map.component.InfoBubbles.ALIGNMENT_ABOVE);
map.components.add(infoBubbles);

This still doesn't fix the position of the Infobubble though, since it will still switch to the other side if there is insufficient space on the right side of the map to display the bubble.

To completely fix the position of the Infobubble, you will also need to add observers to defaultXAlignment and defaultYAlignmentto ensure the value never changes:

infoBubbles.addObserver("defaultXAlignment", function (){
    this.set("defaultXAlignment",
        nokia.maps.map.component.InfoBubbles.ALIGNMENT_RIGHT);});
 infoBubbles.addObserver("defaultYAlignment", function (){
    this.set("defaultYAlignment",
        nokia.maps.map.component.InfoBubbles.ALIGNMENT_ABOVE);});

Post a Comment for "Nokia Here Maps Javascript Api: Is There Any Property To Fix The Position Of An Infobubble?"