GMap Marker Draggable

  1. #1

    GMap Marker Draggable

    Hi All,

    At the moment I have in mark up:-

    <ext:Panel runat="server" Width="500" Height="500" >
                <Items>
                    <ux:GMapPanel ID="GMapPanel1" runat="server" ZoomLevel="15" GMapType="Map" >
                        <Markers>
                             
                        </Markers>
                    </ux:GMapPanel>
                </Items>
    </ext:Panel>
    And in the Code Behind

    Ext.Net.UX.Marker marker = new Ext.Net.UX.Marker();
    GMapPanel1.CenterMarker.Lat = Co-ordinates;
    GMapPanel1.CenterMarker.Lng = Co-ordinates;
    marker.Lat = Co-ordinates;
    marker.Lng = Co-ordinates;
    GMapPanel1.Markers.Add(marker);
    Which works great and puts the marker in the correct place, but I cant seem to be able to allow the marker to be dragged.

    Does anyone have any advice? or have come up against this issue before?

    I've searched the net and this forum and have come up with nothing.

    Cheers

    BG
  2. #2
    Hi,

    Welcome to Ext.NET!

    How would it be implemented in GMap native API?

    Generally, we are not GMap API experts and just made a wrapper class for GMap in, rather, demonstration purpose.

    So, I would look into GMap API docs. If no answer, then ask on their specialized forum.

    If you will know a solution in native GMap API, I would try to help how it might be achieved in Ext.NET context with <ext:GMapPanel>.

    Hope this helps.
  3. #3
    For anyone who has, encounters the same issue.

    add:-

    MarkerOptions.cs
            [ConfigOption]
            [DefaultValue(false)]
            [NotifyParentProperty(true)]
            [Description("Marker Draggable")]
            public bool Draggable
            {
                get
                {
                    return this.ViewState["Draggable"] == null ? false : (bool)this.ViewState["Draggable"];
                }
                set
                {
                    this.ViewState["Draggable"] = value;
                }
            }
    and, MarkerOptionsConfigOptions.cs

    list.Add("title", new ConfigOption("title", null, "", this.Title ));
    list.Add("draggable", new ConfigOption("draggable", null, false, this.Draggable));
    return list;
    now, marker.options.draggable is available and works fine

    now need to work out how to get the new co-ordinates.

    thanks Daniil
  4. #4
    Well, you have done all job yourself :)
  5. #5
    Hi Daniil

    I found a way to get the new LatLng through Javascript by passing the GMapPanel through:-

    function getCo(gmap) {
            var map = gmap.getMap();
            var lat = map.Ka[0].getLatLng().y;
            var lng = map.Ka[0].getLatLng().x;
        }
    is there any cleaner way than using this?

    Much appreciated.

    BG
  6. #6
    I believe there should be an event like "EndDrag" in GMap API where you could get a marker and its new coordinates.

Similar Threads

  1. GMap Support
    By pevans360 in forum 2.x Help
    Replies: 3
    Last Post: Aug 09, 2013, 7:39 AM
  2. [CLOSED] Adding Google Marker From Code Behind
    By dev in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Dec 13, 2011, 12:51 PM
  3. hide marker on by ID
    By sedoyksa in forum 1.x Help
    Replies: 1
    Last Post: Nov 21, 2011, 6:09 PM
  4. [CLOSED] Adding Google Marker with mouse
    By kenanhancer in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 22, 2011, 1:30 PM
  5. GMap Api Error
    By zuammer in forum 1.x Help
    Replies: 3
    Last Post: Apr 17, 2009, 10:54 AM

Tags for this Thread

Posting Permissions