诺基亚HERE Maps javascript API:是否有任何属性可以固定infoBubble的位置? [英] Nokia HERE Maps javascript API: Is there any property to fix the position of an infoBubble?

查看:96
本文介绍了诺基亚HERE Maps javascript API:是否有任何属性可以固定infoBubble的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我们正在使用 HERE Javascript Api 2.5.3( https://js.api.here.com/se/2.5.3/jsl.js?with=all ),并在自定义html内容内创建了InfoBubbleMarker-根据诺基亚开发人员ApiExplorer( http://developer.here.com/apiexplorer/examples/api-for-js/information-bubbles/extend-marker-to-infobubblemarker.html )

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 description in nokias developers ApiExplorer (http://developer.here.com/apiexplorer/examples/api-for-js/information-bubbles/extend-marker-to-infobubblemarker.html)

虽然infoBubbles自动位置开关-根据事实,在哪里显示它-通常是一种不错的选择,但我们要禁用它.

While the infoBubbles automated position switch - depending on the fact, where is place to display it - is often kind of nice, we want to disable it.

因此:infoBubblefixfix中是否有property?

So: Is there any property to fix the position of the infoBubble?

谢谢.

推荐答案

您可以使用defaultXAlignmentdefaultYAlignment属性来更改Infobubble的首选偏移量,例如:

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);

尽管如此,它仍然不能修复 Infobubble的位置,因为如果地图右侧没有足够的空间来显示气泡,它仍会切换到另一侧

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.

完全修复位置,您还需要向defaultXAlignmentdefaultYAlignment添加观察者,以确保该值永远不变:

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);});

这篇关于诺基亚HERE Maps javascript API:是否有任何属性可以固定infoBubble的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆