Skip to content

Commit

Permalink
Basic implementation of infobubbles
Browse files Browse the repository at this point in the history
bubble and nobubbles methods
  • Loading branch information
mmarcon committed Aug 23, 2015
1 parent 536589a commit 53b8b7b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/examples2/index.html
Expand Up @@ -22,7 +22,7 @@
<script src="../../out/jhere.js"></script>
<script>
var map = new jHERE(document.querySelector('#map'), {zoom: 14, center: {lat: 52.5, lng: 13.3}});
map.zoom(10).type('terrain', 'base').marker({lat: 52.5, lng: 13.3});
map.zoom(10).type('terrain', 'base').marker({lat: 52.5, lng: 13.3}).bubble({lat: 52.5, lng: 13.3}, {content: 'Boooo!'});
// var other_map = new jHERE(document.querySelector('#other_map'), {zoom: 14, center: {lat: 52.5, lng: 13.3}});
</script>
</body>
Expand Down
20 changes: 18 additions & 2 deletions src/modules/core.js
Expand Up @@ -91,8 +91,24 @@ JH.nomarkers = function(){
return self;
};

JH.bubble = function(){};
JH.nobubbles = function(){};
JH.bubble = function(coords, options){
options = options || {};
const self = this;
const _bubble = function(){
self.ui.addBubble(new H.ui.InfoBubble(coords, options));
};
self._runner.run(_bubble);
return self;
};

JH.nobubbles = function(){
const self = this;
const _nobubbles = function(){
self.ui.getBubbles().forEach((bubble) => (bubble.close() && bubble.dipose()));
};
self._runner.run(_nobubbles);
return self;
};

JH.originalMap = function(closure){
const self = this;
Expand Down

0 comments on commit 53b8b7b

Please sign in to comment.