• Resolved kryvulena

    (@kryvulena)


    Hi there

    I’m about to create a map with markers located at rural areas and all locations have no addresses and I don’t know their exact GPS locations but I know all approx. locations on the map. To add a marker I will place approx. coordinates and they I need to drag’n’drop markers to their best locations. But I don’t know why I can’t drag markers. Is this feature not available or maybe I do something wrong? If I drag a marker, nothing happens except dragging entire map.
    I’ll be very thankful for your help and hints.

    http://ww.wp.xz.cn/extend/plugins/leaflet-maps-marker/

Viewing 15 replies - 1 through 15 (of 16 total)
  • Hi,
    seems like there is a plugin or theme conflict on your installation. Please try the steps from http://mapsmarker.com/readme-first and tell me if these helped.
    best,
    Robert

    Thread Starter kryvulena

    (@kryvulena)

    Hi

    I followed those steps:

    1. I disabled all plugins but the Leaflet Maps Marker

    2. I switched back to the default WP theme Twenty Twelve (tested also T. Eleven and Ten) the issue remains – when I try to drag a marker, I drag entire map instead.

    I also noticed if a marker’s settings opens and I initially click on the marker to try to drag it, the map skips a few centimeters away. Then I can’t drag the marker.

    Using WP 3.5.1, the latest version of Chrome and the newest version of the plugin.

    I can provide URL to my website via PM

    I’ll be grateful for your help!

    please provide temp admin access so that I can have a look….

    Thread Starter kryvulena

    (@kryvulena)

    I’ll drop you an email now

    Issue solved (was a misunderstanding of how the plugin works).

    Well, so is that described above possible with the plugin or not?

    I just tried the demo and only the whole map drags, but not just the marker and the coordinates do not update either.
    Thanks,
    Sascha

    Hi Sacha,
    when creating a map in the backend, you can drag and drop the marker to place it on the desired position – on frontend, markers are not moveable.
    best,
    Robert

    Robert,

    Thanks for our quick replies!
    Sorry, I still am not able to do that. I just have installed the free version of the plugin to try that. Do I have to change a setting somewhere? If I want to move the marker at the backend to position it slightly different, so that the coordinates update to the new position too, I just try and drag the marker, but the whole map just moves.

    Hi Sascha,
    if you create a marker map and click with the mouse on a new spot, the marker moves automatically and the coordinates get updated.
    if you created a layer map (which can show multiple markers) and click with the mouse on a different spot, the layer center moves accordingly – Marker can’t be moved directly on a layer map through mouse click though, this has to be done on the according marker map.
    best,
    Robert

    Hi Robert,

    OK, got it now!!! The marker moves only on “click” NOT on “drag and drop”.

    Intuitively I just tried to click on the marker and drag it to a new position. Would that be something you could add as a functionality to the marker? Not sure how many people have the same problem, but it would be nice to either click or drag and drop the marker.

    If you do not want to add it, could you point me to the right file and right function, then I would change it myself, though obviously it’s always better not to “hack” the plugins.
    S

    Hi Sascha,
    seems to happen more often than I thought. Will check if I can find a solution/workaround here – not sure if dragging the marker might also work, will check that.
    best,
    Robert

    Hi again,

    thanks for your valuable feedback again, just found a way that markers can be draggable on backend marker maps too in order to set new coordinates πŸ™‚ Will be included in the next release.

    If you want to add this feature earlier, open leaflet-marker.php,
    find “var mapElement = $(‘#selectlayer’)” and add the following code before:

    //info: set new coordinates on marker drag
      marker.on('dragend', function(e) {
          var newlocation = marker.getLatLng();
    	  var newlat = newlocation['lat'];
      	  var newlon = newlocation['lng'];
    	  document.getElementById('lat').value = newlat.toFixed(6);
    	  document.getElementById('lon').value = newlon.toFixed(6);
    	  selectlayer.setView(newlocation,selectlayer.getZoom());
    	  if($('input:checkbox[name=openpopup]').is(':checked')) {
    			marker.openPopup();
    		} else {
    			marker.closePopup();
    		}
      });

    best & thx again,

    Robert

    sorry, forgot one thing: you also have to find

    marker = new L.Marker(new L.LatLng(<?php echo $lat . ", " . $lon; ?>),{ <?php if ($lmm_options[ 'defaults_marker_icon_title' ] == 'show') { $markername_title = htmlspecialchars_decode($markername); echo "title: '$markername_title', "; }; ?> opacity: <?php echo floatval($lmm_options[ 'defaults_marker_icon_opacity' ]) ?>});

    and change this to

    marker = new L.Marker(new L.LatLng(<?php echo $lat . ", " . $lon; ?>),{ <?php if ($lmm_options[ 'defaults_marker_icon_title' ] == 'show') { $markername_title = htmlspecialchars_decode($markername); echo "title: '$markername_title', "; }; ?> opacity: <?php echo floatval($lmm_options[ 'defaults_marker_icon_opacity' ]) ?>, draggable: true});

    Hi Robert,

    Great! And thanks for letting me know and sorting this out so quickly. I think it will just make your plugin even better πŸ˜‰

    I will wait for the next release, as I will not start working on incorporating maps yet, but once I start in 2 weeks time, I will surely try your plugin first and incorporate the above code if no new release until then. The plugin looks awesome and your support is spot on!
    Take care,
    Sascha

    Not sure when next release will be available, probably be end of next week, but might also take one week longer.
    best,
    Robert

    PS: if you like using my plugin, IΒ΄d appreciate a review at http://ww.wp.xz.cn/support/view/plugin-reviews/leaflet-maps-marker πŸ˜‰

Viewing 15 replies - 1 through 15 (of 16 total)

The topic ‘Dragging markers not possible?’ is closed to new replies.