Add button to reset marker on form display

Created on 5 June 2023, over 1 year ago
Updated 12 June 2023, over 1 year ago

Problem/Motivation

Currently, when adding a marker by accident, there is no easy way to reset the marker, or I'm missing something.

Steps to reproduce

Proposed resolution

Add a button cfr. place marker, to remove the marker from the map.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Fixed

Version

3.0

Component

Code

Created by

🇧🇪Belgium JeroenT 🇧🇪

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @JeroenT
  • @jeroent opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇧🇪Belgium JeroenT 🇧🇪
  • 🇮🇹Italy itamair

    Thanks @JeroenT ...
    Actually the present way to remove a marker from the widget is to erase the Lat & Lon inputs fields,
    but I understand it is not super clear as UI/UX and it could potentially be not possible if the user choose to hide the Lat & Lon inputs elements from the widget.

    Hence I will QA and Review this MR from you, asap ...: not really sure if setting both Lat and Lon to 0 (as you do in js) will result in a removal of the input marker. will check it out.

    • itamair committed 58d8d889 on 3.0.x
      Issue #3364845 by JeroenT: Add button to reset marker on form display...
  • Status changed to Fixed over 1 year ago
  • 🇮🇹Italy itamair

    Thanks @JeroenT ...
    You Feature Request has been reviewed and approved and your MR refined to extend it in case of Google Maps map library (wasn't working on it otherwise), and to completely clean the Lat/Lon element, instead of setting them to 0,0.
    Going to deploy a new Geofield Map release with this ...

  • 🇫🇷France mably

    It looks like the position variable is not used in the setMarkerPosition call, as it probably should:

        // Remove marker from the map.
        remove_marker: function (mapid) {
          let self = this;
          let position;
          if (self.map_data[mapid].click_to_remove_marker) {
            if (!window.confirm(Drupal.t('Remove marker from map ?'))) {
              return;
            }
          }
          switch (self.map_data[mapid].map_library) {
    
            case 'leaflet':
              position = {lat: 0, lon: 0};
              break;
    
            case 'gmap':
              position = new google.maps.LatLng(0, 0);
          break;
          }
          self.setMarkerPosition(mapid, {lat: 0, lon: 0});
          $('#' + self.map_data[mapid].latid).val(null);
          $('#' + self.map_data[mapid].lngid).val(null);
        },
    
    • itamair committed b7a83026 on 3.0.x
      Issue #3364845 by JeroenT, itamair: Add button to reset marker on form...
  • 🇮🇹Italy itamair

    thanks a lot @mably ... nice catches, all fixed. Going to deploy new release with these ...

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024