none
draggable pushpin with attached infobox in IE8 throws exception after second drag attempt while infobox is expanded/focused RRS feed

  • Question

  • A problem started happening recently with v7 of the AJAX map control, where we have a marker with an attached infobox. Click the marker to make the infobox show fully (perhaps that means it becomes focused), then drag the marker once, and then drag it again. The error is thrown on the second drag. The infobox has to remain focused the whole time.

    I believe it was introduced between 2013-09-09 and 2013-10-21 (based on the different versions of the veapicore.js I have in my cache). A null pointer exception is thrown in one of the handlers within veapiBingTheme.js, but that file hasn't changed since the problem surfaced, so I'm blaming veapicore.js for calling the handler with a null for the first argument. Since the scripts are minified and obfuscated, this is the best I can give to point out where the problem occurs: "g[t].handler.call(null,n)" in veapicore.js calls "function fi(i){var r=t.getOptions(),u=i.target" in veapiBingTheme.js, and since i is null, it breaks

    This fails in IE8. It does not fail in IE10. I haven't tried IE9 or any other IE version. It does not fail in Chrome.

    Unfortunately in our corporate environment, IE8 is still the supported version.

    Below is a slimmed down example that can be used to reproduce the problem.

    Any help that can be provided would be greatly appreciated.

    Thanks

    <!DOCTYPE html><html>
    <head>
    <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
    <script type="text/javascript">
    function initMap() {
        Microsoft.Maps.loadModule('Microsoft.Maps.Themes.BingTheme', {
            callback: function() {
                var map = new Microsoft.Maps.Map(document.getElementById('map_canvas'), {
                    credentials: 'get your own',
                    mapTypeId: Microsoft.Maps.MapTypeId.road,
                    theme: new Microsoft.Maps.Themes.BingTheme(),
                });

                var loc = new Microsoft.Maps.Location(35.732506698743016,-78.79249122457763);

                var box = new Microsoft.Maps.Infobox(loc,{
                    title: 'test',
                    description: 'I love IE8',
                    typeName: 'mini'
                });
                map.entities.push(box);
                var marker = new Microsoft.Maps.Pushpin(loc, {
                    draggable: true,
                    text: 'hello',
                    infobox: box
                });
                map.entities.push(marker);

                map.setView({
                    'zoom': 10,
                    'center': loc
                });
            }
        });
    }

    </script>
    <style type="text/css">
    #map_canvas {
        ;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
    }
    </style>
    </head>
    <body onload="initMap();">
    <div id="map_canvas"></div>
    </body>
    </html>


    Wednesday, November 27, 2013 3:27 PM

Answers

All replies

  • I've tried running your example on IE8 and it works fine. I can get it to throw an error. When I'm dragging the infobox is staying open, I assume that is what you mean by focused as the pushpin gets true focus when you mouse down on it to drag it. Not sure where your error is coming from.

    Are you able to reproduce this issue without using the Bing Theme module. Note that the Bing Theme module is meant to only support the same look and feel as the Bing Maps consumer site which doesn't have pushpin dragging. So it's possible that's where your issue is coming from.


    http://rbrundritt.wordpress.com

    Wednesday, November 27, 2013 3:53 PM
  • Yes, "staying open" is what I meant by focus infobox.

    If I just remove the line that applies the Bing theme, I don't get the error when dragging, but then the infobox is initially visible when the map loads. Without the Bing Theme it requires a little more work to manage and style the infoboxes, if I remember correctly. But if that is the route we have to take, then I guess that's what we have to do.

    By the way, we use your grid-based clustering plugin, and it is nice. I recently changed the algorithm to define gridlines based on 0,0 (lat,lon) instead of the top-left corner of the map viewport, which causes cluster markers to be consistently drawn for a given zoom level, regardless of where the map is panned. In other words, panning without zooming will not cause any cluster markers to shuffle around. I was wondering if anyone else had explored that option (the version available on your SkyDrive is a few years old, and I feel like I got an update for event throttling from somewhere else a while back, but can't remember where), as well as if you take contributions from the community. We can take that offline if necessary.

    Wednesday, November 27, 2013 4:34 PM
  • Take a look at these examples for custom infoboxes:

    http://bingmapsv7modules.codeplex.com/wikipage?title=Custom%20Infobox%20Control

    http://rbrundritt.wordpress.com/2011/11/08/simple-custom-infoboxes-in-bing-maps-v7/

    You likely found an updated version of the clustering code here: http://bingmapsv7modules.codeplex.com/wikipage?title=Client%20Side%20Clustering

    This is part of the Bing Maps V7 Modules project: http://bingmapsv7modules.codeplex.com/

    I'm definitely open to feedback on the modules. Feel free to email them to me at ricky_brundritt at Hotmail.com or add them to the modules codeplex project as a comment or discussion.


    http://rbrundritt.wordpress.com

    Friday, November 29, 2013 10:42 AM