Answer the question
In order to leave comments, you need to log in
Leaflet Control Search, when the search layer is disabled, moving the map does not work, how can I fix it?
Leaflet installed the Leaflet Control Search plugin for the map, it adds a location search string.
I screwed the markers and the search layer to one checkbox (adds and removes layers with locations and the search string, written in another js).
Adding a search layer to the map - map.addControl( controlSearch );
Removing from the map - map.removeControl( controlSearch );
There is a "collapsed" setting in the search js, if true, the search is collapsed into a small square button when not used, if necessary, you press and the input line expands.
The problem is that with "collapsed: true" (collapse enabled), if you start typing text into the line and then immediately click on the checkbox to delete the layer with the search (without closing the search line), then it is deleted as it should, but the movement stops working maps (usually, when holding down the left mouse button), with "collapsed: false" (without folding, the search bar is constantly expanded) there is no such problem.
I don't know js well, so I can't figure out what the problem is, but I'm guessing it has to do with focus/blur.
Link to leaflet-search.js
https://github.com/stefanocudini/leaflet-search/bl...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question