诺基亚HERE Maps javascript API:是否有任何属性可以固定infoBubble的位置? [英] Nokia HERE Maps javascript API: Is there any property to fix the position of an 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.
因此:infoBubble
的fix
和fix
中是否有property
?
So: Is there any property
to fix
the position
of the infoBubble
?
谢谢.
推荐答案
您可以使用defaultXAlignment
和defaultYAlignment
属性来更改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.
要完全修复位置,您还需要向defaultXAlignment
和defaultYAlignment
添加观察者,以确保该值永远不变:
To completely fix the position of the Infobubble
, you will also need to add observers to defaultXAlignment
and defaultYAlignment
to 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屋!