addEventListner click for htmlStringBalloon

9 views
Skip to first unread message

TMAX

unread,
Jul 3, 2009, 10:52:16 AM7/3/09
to KML Developer Support - Google Earth Plug-in
What up fellas! You all have been such a help! I do have a question, I
am traversing a KML file and preventing the default balloon from
"poping" up and adding htmlStringBalloon in it's place, working like a
champ, need the htmlstringballoon because I have javascript function
in the balloon, all working like a champ!

Here is the thing, "regular" placemarks you can zoom into earth move
around etc over the placmarks and when you click on one it opens
right? cool...

With "traversed" placemarks (they now have the "click" eventlistner on
them) when you zoom in and see the placemarks and try to move the map
around, it fires the "click" event (if you happen to be ontop of a
placemark)...

Anyway to stop that? Seems like once the "click" event and
preventdeafult is added to a placemark with a htmlstringballoon,
anytime you are zoomed in and there are tons of placemarks around the
map and you just want to move the map around, if you are on a
placemark it fires, whereas it doesn't if I turn the traverse function
off and keep the default placemarks...


TMAX

unread,
Jul 3, 2009, 11:23:56 AM7/3/09
to KML Developer Support - Google Earth Plug-in
Could you maybe add in the code where it's traversing something like
if not a "mousemove" then create the htmlballon?

case 'KmlPlacemark':

google.earth.addEventListener(eachSubNode, 'click', function(e) {

// prevent the default balloon from popping
up
e.preventDefault();

######## HERE CHECK FOR MOVEMOVE, IS IT POSSIBLE? ##################
IF NOT MOVE IS MOVING THEN DO THE BELOW???? WOULD BE THE BOMB!


var balloon = ge.createHtmlStringBalloon('');
balloon.setFeature(e.getTarget());

balloon.setContentString("<table width=275px><tr><td><a href='#'
onclick=JavaScript:RunComps('" + e.getTarget().getId() + "');>Get
Comps</a><BR><a href='#' onclick=JavaScript:RunOPs('" + e.getTarget
().getId() + "');>Other Properties of this Owner</a><BR><BR><div
align='left'>" + e.getTarget().getDescription() + "</div></td></tr></
table>");

ge.setBalloon(balloon); //set the ballon to ge plugin

Roman N

unread,
Jul 6, 2009, 2:39:01 PM7/6/09
to KML Developer Support - Google Earth Plug-in
Hi TMAX,

I haven't seen this behavior before; can you provide a demo link
showing the problem? Sounds like something we may need to file in the
public issue tracker.

Thanks,
Roman
Reply all
Reply to author
Forward
0 new messages