none
MouseWheel, PushPin text style, TileLayer zIndex - Maps AJAX V7 RRS feed

  • Question

  • OK - three problems

    1) I need to change the default MouseWheel behaviour on Maps AJAX V7 - at present, the centre of the map changes on the mousewheel depending on the cursor position over the map. I need the centre to stay constant. How do I change the mousewheel behaviour? I've tried attaching a mousewheel eventhandler at window, document and map level but no joy. There is no formal document that suggests that mousewheel is handled by the map (unlike, say mouseover, mouseout) but it clearly is, just doesn't seem to be public.

    I also looked at the targetviewchanged, viewchange* events and it appears that the centre of the map moves before the targetviewchanged event fires and without firing any of the other events which is not the behaviour I expected - it means I can't use those events to adjust the target centre without the movement back to the original centre being visible

    2) I have a TileLayer defined with zIndex: 50 which is semi-opaque and should overlay the PushPins which are defined with zIndex: 25 - this is not happening. Both TileLayer and PushPins are showing, but the PushPins (which have a custom icon) are overlaying the TileLayer

    3) I need to change the styling of the Text for the PushPins. I've had a look at the HTML generated for the pushpins and the div surrounding the text has the following inline-style defined:

     style="POSITION: absolute; TEXT-ALIGN: center; WIDTH: 100%; FONT: bold 10pt Arial,Helvetica,Sans-Serif; COLOR: #fff; TOP: 5px; LEFT: 0px"

    I could use jQuery to identify the elements and change the styling after the pushpins have been generated but I'd much rather be able to change the generation of the code so that it produced something like:

    style="POSITION: absolute; TOP: 5px; LEFT: 0px" class="myPushPinStyle"

    Any ideas, clues, "oi muppet, do it like this" welcome

    P xxx

    • Moved by Ricky_Brundritt Friday, March 9, 2012 4:41 PM (From:Bing Maps: Map Control and Web services Development)
    Wednesday, February 2, 2011 12:17 PM

Answers

  • Here's how I was able to manipulate the style of the pushpin text.

     

    First, set the type name of the pushpin

     

    var pushpinOptions = {				
    text: "hello!",
    icon: "",
    width: 30,
    height: 20,
    typeName: "mapPin"
    }

    You can use that type name to style via CSS

     

    <style>
    .mapPin{
    background:url(someimage.png) no-repeat left -3px;
    }
    .mapPin div {font-size:11px !important; color:yellow !important;}
    </style>

    Notice the div after the class name and the !important.  Those are required to make it work and to keep the default styles from overriding. (I was banging my head against that forever!)

    Friday, March 18, 2011 12:53 PM

All replies

  • I'm also looking for a way to manipulate the style of the pushpin text -

    So far found nothing -

    Tuesday, February 15, 2011 2:58 PM
  • Here's how I was able to manipulate the style of the pushpin text.

     

    First, set the type name of the pushpin

     

    var pushpinOptions = {				
    text: "hello!",
    icon: "",
    width: 30,
    height: 20,
    typeName: "mapPin"
    }

    You can use that type name to style via CSS

     

    <style>
    .mapPin{
    background:url(someimage.png) no-repeat left -3px;
    }
    .mapPin div {font-size:11px !important; color:yellow !important;}
    </style>

    Notice the div after the class name and the !important.  Those are required to make it work and to keep the default styles from overriding. (I was banging my head against that forever!)

    Friday, March 18, 2011 12:53 PM
  • For the Tile layer issue. The zIndex I believe does not work across EntityCollections. Try adding your tile layer to the map after the entity collection that contains your pushpins.

    For the mouse wheel, MS just released an update recently that gives you access to mouse wheel events. You should be able to use this to modify it's behaviour.


    Windows Live Developer MVP - http://rbrundritt.wordpress.com | http://inknowledge.co.uk
    Thursday, March 24, 2011 10:35 AM