Skip to content

Commit 321f963

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/develop'
2 parents 2e70e39 + 4ae77b6 commit 321f963

15 files changed

+1518
-2
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
.sass-cache/
3+
*.css.map
4+
*.js.map

.jshintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"esversion": 6
3+
}

.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tabWidth: 4

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 elmarquis, 2019 Raruto
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,67 @@
1-
# leaflet-gesture-handling
2-
Leaflet plugin that allows to prevent default scroll/touch event behaviours.
1+
# leaflet-gesture-handling.js
2+
3+
A Leaflet plugin that allows to prevent default map scroll/touch behaviours.
4+
5+
6+
_For a working example see [demo](https://raruto.github.io/examples/leaflet-gesture-handling/leaflet-gesture-handling.html)_
7+
8+
9+
<p align="center">
10+
<a href="https://raruto.github.io/examples/leaflet-gesture-handling/leaflet-gesture-handling.html"><img src="https://raruto.github.io/img/leaflet-gesture-handling.png" alt="Ctrl + scroll to zoom the map" /></a>
11+
</p>
12+
13+
14+
---
15+
16+
<blockquote>
17+
<p align="center">
18+
<em>Initially based on the <a href="https://github.com/elmarquis/Leaflet.GestureHandling">work</a> of <strong>elmarquis</strong></em>
19+
</p>
20+
</blockquote>
21+
22+
---
23+
24+
## How to use
25+
26+
1. **include CSS & JavaScript**
27+
```html
28+
<head>
29+
...
30+
<style> html, body, #map { height: 100%; width: 100%; padding: 0; margin: 0; } </style>
31+
<!-- Leaflet (JS/CSS) -->
32+
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.4/dist/leaflet.css" />
33+
<script src="https://unpkg.com/leaflet@1.3.4/dist/leaflet.js"></script>
34+
<!-- leaflet-gesture-handling -->
35+
<link rel="stylesheet" href="https://unpkg.com/@raruto/leaflet-gesture-handling@latest/dist/leaflet-gesture-handling.min.css" type="text/css">
36+
<script src="https://unpkg.com/@raruto/leaflet-gesture-handling@latest/dist/leaflet-gesture-handling.min.js"></script>
37+
...
38+
</head>
39+
```
40+
2. **choose the div container used for the slippy map**
41+
```html
42+
<body>
43+
...
44+
<div id="map"></div>
45+
...
46+
</body>
47+
```
48+
3. **create your first simple “leaflet-gesture-handling” slippy map**
49+
```html
50+
<script>
51+
...
52+
var map = new L.Map('map', {
53+
center: [41.4583, 12.7059],
54+
zoom: 5,
55+
gestureHandling: true,
56+
});
57+
...
58+
</script>
59+
```
60+
61+
---
62+
63+
**Compatibile with:** leaflet@1.3.4
64+
65+
---
66+
67+
**Contributors:** [Elmarquis](https://github.com/elmarquis/Leaflet.GestureHandling), [Raruto](https://github.com/Raruto/leaflet-gesture-handling)

dist/leaflet-gesture-handling.css

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.leaflet-gesture-handling:after {
2+
color: #fff;
3+
font-family: "Roboto", Arial, sans-serif;
4+
font-size: 22px;
5+
-webkit-box-pack: center;
6+
-ms-flex-pack: center;
7+
justify-content: center;
8+
display: -webkit-box;
9+
display: -ms-flexbox;
10+
display: flex;
11+
-webkit-box-align: center;
12+
-ms-flex-align: center;
13+
align-items: center;
14+
padding: 15px;
15+
position: absolute;
16+
top: 0;
17+
left: 0;
18+
right: 0;
19+
bottom: 0;
20+
background: rgba(0, 0, 0, 0.5);
21+
z-index: 1001;
22+
pointer-events: none;
23+
text-align: center;
24+
-webkit-transition: opacity 0.8s ease-in-out;
25+
transition: opacity 0.8s ease-in-out;
26+
opacity: 0;
27+
content: ""; }
28+
29+
.leaflet-gesture-handling-warning:after {
30+
-webkit-transition-duration: 0.3s;
31+
transition-duration: 0.3s;
32+
opacity: 1; }
33+
34+
.leaflet-gesture-handling-touch:after {
35+
content: attr(data-gesture-handling-touch-content); }
36+
37+
.leaflet-gesture-handling-scroll:after {
38+
content: attr(data-gesture-handling-scroll-content); }

dist/leaflet-gesture-handling.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import * as L from "leaflet";
2+
3+
export class GestureHandling extends L.Handler {}
4+
5+
export default GestureHandling;

0 commit comments

Comments
 (0)