From f7b8a7ad40d7068393207107bedf45b4e218cefc Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Mon, 8 Jan 2018 21:57:41 +0100 Subject: [PATCH] Harmonize event handling with L.Control.Layers This harmonizes the toggle/expand/collapse handling with `L.Control.Layers`. Now there are two choices for `options.expand`: - "click": expands the control upon click, closes it on map click/pan - "hover" on desktop: expands/collapses upon mouse enter/leave - "hover" on mobile: expands the control upon click --- README.md | 2 +- demo/index.html | 7 ++++++- src/control.js | 56 +++++++++++++------------------------------------ 3 files changed, 21 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index f71d490e..644b7af4 100755 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ L.Control.geocoder(options) | Option | Type | Default | Description | | ----------------- | ---------------- | ------------------- | ----------- | | `collapsed` | Boolean | `true` | Collapse control unless hovered/clicked | -| `expand` | String | `"touch"` | How to expand a collapsed control: `touch` or `click` or `hover` | +| `expand` | String | `"hover"` | How to expand a collapsed control: `click` or `hover` | | `position` | String | `"topright"` | Control [position](http://leafletjs.com/reference.html#control-positions) | | `placeholder` | String | `"Search..."` | Placeholder text for text input | `errorMessage` | String | `"Nothing found."` | Message when no result found / geocoding error occurs | diff --git a/demo/index.html b/demo/index.html index f98f6939..2b09e09c 100644 --- a/demo/index.html +++ b/demo/index.html @@ -27,7 +27,12 @@