Problem/Motivation
Refer to https://www.drupal.org/project/leaflet/issues/3236815 suggestion, in order to make use of GeoField proximity filtering and ordering, a meaningful "Origin Coordinates" for end-user is important, e.g.:
- A manual default origin coordinate
- Center of map after end-user moving the map by mouse click-and-move
- The client location through the browser HTML5 Geolocation API (e.g. by GPS, IP, etc)
This PR integrate https://github.com/drustack/Leaflet.SyncView, add support for Leaflet with sync map center to text input support, useful for:
- Set the GeoField proximity exposed filter as "Manual Origin"
- Enable "Sync View" support in Leaflet display setting
- Configure the "latitudeSelector", "latitudeSelector" and "zoomSelector" (optional) to above GeoField proximity exposed filter text input
Now when end-user move the map, the map center value will automatically feed into the exposed filter input, and next search will now based on the updated position.
Comments
Comment #3
hswong3i commentedComment #4
hswong3i commentedComment #7
itamair commentedThis cannot be approved as it is based on the 3.0.x-dev branch that is only experimental and not being supported now, in the short & mid term, because it doesn't provide a smooth and automatic upgrade path for all the 2.x users.
All this features requests should be also smoothly applicable to the 2.x branch, with full BW compatibility into it and upgrade/update path, to be approved ...
Comment #9
itamair commentedComment #11
hswong3i commentedRecreate MR via 10.2.x-dev
Comment #12
itamair commentedThanks @hswong3 for providing an updated MR that applies to the 10.2.x Leaflet branch,
and indeed this integration with your drustack/Leaflet.SyncView library looks somehow valuable,
BUT I still feel the following:
- the integration Leaflet.SyncView setting might need a better and richer description/instruction to more properly guide any user in its proper functionalities and potential use case;
- the drustack/Leaflet.SyncView still looks very poorly adopted, as Leaflet View control, and not really persuaded it really deserves an official integration in the Drupal Leaflet module itself ...
Let's if any other use subscribes to this Feature Request and how many others would need this integration more officially embedded and integrated in the Drupal Leaflet module.
If not, in few weeks, I will close this and leave here for its eventual usage in the form of patch.
Comment #13
hswong3i commented@itamair I am now using https://github.com/drustack/Leaflet.ResetView/ and https://github.com/drustack/Leaflet.SyncView for https://www.wastereduction.gov.hk/en-hk/recycling-map since 3 years agos:
You could test the drustack/Leaflet.SyncView functionality by:
Comment #14
itamair commentedThanks a lot! @hswong3i ... finally I get the nice value of your work and inputs.
Indeed this looks a very useful add-on and setup to search by a specific area and mostly to limit the number of loaded market on the map.
I am going to definitely better inspect this solution of you, and eventually embed in the leaflet module, with proper documentation.
ASAP ...
Comment #15
ressaIt looks interesting, thanks for working on it @hswong3i! Perhaps you can make a GIF or a movie, to highlight and clarify which features are added?
Comment #16
itamair commented@hswong3i I better reviewed this feature Request of you and QAed also the MR !40.
and then I also included some enhancements that reflect a new Fork and consequent the following PR#1 to the drustack/Leaflet.SyncView repo itself:
https://github.com/drustack/Leaflet.SyncView/pull/1
That have the following tech specification:
Refinement in the L.Control.SyncView.js:_pullView function #1
This PR implements the following:
This implementation syncs with latest improvements implemented in Geofield version 8.x-1.61., greatly aimed to enhance dynamic sync between Origin coordinates input and Origin coordinates summary elements.
It would be great if you could merge that PR1 into master and deploy a new 1.9.3 release of drustack/Leaflet.SyncView.
Once 1.9.3 will be deployed we then should finally update this Version number in the MR !40:
https://git.drupalcode.org/issue/leaflet-3254562/-/blob/3254562-add-drus...
and then merge it into the Leaflet 10.2.x branch.
Comment #17
hswong3i commented@itamair some feedback:
This is somehow a nice idea (but seems not important?), if we have limitation in backend database schema from Drupal Leaflet module point of view.
This doesn't looks like a good idea for me, since the Leaflet.SyncView itself is design for generic Leaflet use case (but not Drupal specific integration only).
Hard-coded with
.geofield-lat-summarymay generate upgrade difficulties if Geofield update it's own implementation.IMHO, keep Leaflet.SyncView as isolated and independent with it downstream integration could provide much better flexibility.
Finally, I had create https://www.npmjs.com/package/@drustack/leaflet.syncview/v/1.9.3 which partly integrate the "parsing of Lat and Lon to 6 digit float" implementation, please kindly comment ;-)