react-leaflet-measure 2.1.0 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/App.jsx DELETED
@@ -1,338 +0,0 @@
1
- const { Map, TileLayer, withLeaflet } = ReactLeaflet;
2
- const MeasureControlDefault = ReactLeafletMeasure;
3
- const MeasureControl = withLeaflet(MeasureControlDefault);
4
-
5
- class App extends React.Component {
6
- constructor(props) {
7
- super(props);
8
- this.onChangePosition = this.onChangePosition.bind(this);
9
- this.onChangePrimaryLengthUnit = this.onChangePrimaryLengthUnit.bind(this);
10
- this.onChangeSecondaryLengthUnit = this.onChangeSecondaryLengthUnit.bind(this);
11
- this.onChangePrimaryAreaUnit = this.onChangePrimaryAreaUnit.bind(this);
12
- this.onChangeSecondaryAreaUnit = this.onChangeSecondaryAreaUnit.bind(this);
13
- this.onChangeActiveColor = this.onChangeActiveColor.bind(this);
14
- this.onChangeCompletedColor = this.onChangeCompletedColor.bind(this);
15
- this.resetOptions = this.resetOptions.bind(this);
16
-
17
- this.state = {
18
- mapOptions: {
19
- center: [2.935403, 101.448205],
20
- zoom: 10,
21
- minZoom: 1,
22
- maxZoom: 22
23
- },
24
- position: 'topright',
25
- primaryLengthUnit: 'meters',
26
- secondaryLengthUnit: 'kilometers',
27
- primaryAreaUnit: 'sqmeters',
28
- secondaryAreaUnit: 'acres',
29
- activeColor: '#db4a29',
30
- completedColor: '#9b2d14'
31
- }
32
- }
33
-
34
- onChangePosition(event) {
35
- this.setState({ position: event.target.value });
36
- }
37
-
38
- onChangePrimaryLengthUnit(event) {
39
- this.setState({ primaryLengthUnit: event.target.value });
40
- }
41
-
42
- onChangeSecondaryLengthUnit(event) {
43
- this.setState({ secondaryLengthUnit: event.target.value });
44
- }
45
-
46
- onChangePrimaryAreaUnit(event) {
47
- this.setState({ primaryAreaUnit: event.target.value });
48
- }
49
-
50
- onChangeSecondaryAreaUnit(event) {
51
- this.setState({ secondaryAreaUnit: event.target.value });
52
- }
53
-
54
- onChangeActiveColor(event) {
55
- this.setState({ activeColor: event.target.value });
56
- }
57
-
58
- onChangeCompletedColor(event) {
59
- this.setState({ completedColor: event.target.value });
60
- }
61
-
62
- resetOptions(event) {
63
- this.setState({
64
- position: 'topright',
65
- primaryLengthUnit: 'meters',
66
- secondaryLengthUnit: 'kilometers',
67
- primaryAreaUnit: 'sqmeters',
68
- secondaryAreaUnit: 'acres',
69
- activeColor: '#db4a29',
70
- completedColor: '#9b2d14'
71
- });
72
- }
73
-
74
- render() {
75
- const {
76
- mapOptions,
77
- position,
78
- primaryLengthUnit,
79
- secondaryLengthUnit,
80
- primaryAreaUnit,
81
- secondaryAreaUnit,
82
- activeColor,
83
- completedColor
84
- } = this.state;
85
- const measureOptions = {
86
- position,
87
- primaryLengthUnit,
88
- secondaryLengthUnit,
89
- primaryAreaUnit,
90
- secondaryAreaUnit,
91
- activeColor,
92
- completedColor
93
- };
94
- return (
95
- <div>
96
- <div class="row d-flex">
97
- <div class="col-md-8 align-self-stretch">
98
- <div class="card h-100">
99
- <div class="card-body h-100">
100
- <Map {...mapOptions} class="h-100">
101
- <TileLayer
102
- attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
103
- url='http://{s}.tile.osm.org/{z}/{x}/{y}.png'
104
- />
105
- <MeasureControl {...measureOptions} />
106
- </Map>
107
- </div>
108
- </div>
109
- </div>
110
- <div class="col-md-4">
111
- <div class="card">
112
- <div class="card-body">
113
- <div class="row">
114
- <div class="col-sm-6">
115
- <h6 class="mt-1"><i class="fas fa-cogs" /> Options</h6>
116
- </div>
117
- <div class="col-sm-6 text-right">
118
- <button type="button" class="btn btn-sm" onClick={this.resetOptions}><i class="fas fa-undo-alt" /> Reset</button>
119
- </div>
120
- </div>
121
- <hr/>
122
- <form>
123
- <div class="form-group row">
124
- <label for="position" class="col-sm-6 col-form-label">Position:</label>
125
- <div class="col-sm-6">
126
- <select class="form-control" id="position" value={position} onChange={this.onChangePosition}>
127
- <option value="topleft">Top Left</option>
128
- <option value="topright">Top Right</option>
129
- <option value="bottomleft">Bottom Left</option>
130
- <option value="bottomright">Bottom Right</option>
131
- </select>
132
- </div>
133
- </div>
134
- <div class="form-group row">
135
- <label for="primaryLengthUnit" class="col-sm-6 col-form-label">Primary Length Unit:</label>
136
- <div class="col-sm-6">
137
- <select class="form-control" id="primaryLengthUnit" value={primaryLengthUnit} onChange={this.onChangePrimaryLengthUnit}>
138
- <option value="feet">feet</option>
139
- <option value="meters">meters</option>
140
- <option value="miles">miles</option>
141
- <option value="kilometers">kilometers</option>
142
- </select>
143
- </div>
144
- </div>
145
- <div class="form-group row">
146
- <label for="secondaryLengthUnit" class="col-sm-6 col-form-label">Secondary Length Unit:</label>
147
- <div class="col-sm-6">
148
- <select class="form-control" id="secondaryLengthUnit" value={secondaryLengthUnit} onChange={this.onChangeSecondaryLengthUnit}>
149
- <option value="feet">feet</option>
150
- <option value="meters">meters</option>
151
- <option value="miles">miles</option>
152
- <option value="kilometers">kilometers</option>
153
- </select>
154
- </div>
155
- </div>
156
- <div class="form-group row">
157
- <label for="primaryAreaUnit" class="col-sm-6 col-form-label">Primary Area Unit:</label>
158
- <div class="col-sm-6">
159
- <select class="form-control" id="primaryAreaUnit" value={primaryAreaUnit} onChange={this.onChangePrimaryAreaUnit}>
160
- <option value="acres">acres</option>
161
- <option value="hectares">hectares</option>
162
- <option value="sqfeet">sqfeet</option>
163
- <option value="sqmeters">sqmeters</option>
164
- <option value="sqmiles">sqmiles</option>
165
- </select>
166
- </div>
167
- </div>
168
- <div class="form-group row">
169
- <label for="secondaryAreaUnit" class="col-sm-6 col-form-label">Secondary Area Unit:</label>
170
- <div class="col-sm-6">
171
- <select class="form-control" id="secondaryAreaUnit" value={secondaryAreaUnit} onChange={this.onChangeSecondaryAreaUnit}>
172
- <option value="acres">acres</option>
173
- <option value="hectares">hectares</option>
174
- <option value="sqfeet">sqfeet</option>
175
- <option value="sqmeters">sqmeters</option>
176
- <option value="sqmiles">sqmiles</option>
177
- </select>
178
- </div>
179
- </div>
180
- <div class="form-group row">
181
- <label for="activeColor" class="col-sm-6 col-form-label">Active Color:</label>
182
- <div class="col-sm-6">
183
- <input type="color" class="form-control" id="activeColor" value={activeColor} onChange={this.onChangeActiveColor}/>
184
- </div>
185
- </div>
186
- <div class="form-group row">
187
- <label for="completedColor" class="col-sm-6 col-form-label">Completed Color:</label>
188
- <div class="col-sm-6">
189
- <input type="color" class="form-control" id="completedColor" value={completedColor} onChange={this.onChangeCompletedColor}/>
190
- </div>
191
- </div>
192
- </form>
193
- </div>
194
- </div>
195
- </div>
196
- </div>
197
- <div class="row">
198
- <div class="col-md-12 mt-4">
199
- <div class="card">
200
- <div class="card-body">
201
- <h4>Installation</h4>
202
- <hr />
203
- <h5>Install via NPM</h5>
204
- <div class="card bg-dark text-white">
205
- <div class="card-body">
206
- <code class="text-white">
207
- npm install react-leaflet-measure --save
208
- </code>
209
- </div>
210
- </div>
211
-
212
- <h5 class="mt-4">Or include in browser</h5>
213
- <div class="card bg-dark text-white">
214
- <div class="card-body">
215
- <code class="text-white">
216
- &lt;script src="https://npmcdn.com/react-leaflet-measure/dist/react-leaflet-measure.min.js"&gt;&lt;/script&gt;
217
- </code>
218
- </div>
219
- </div>
220
- </div>
221
- </div>
222
- </div>
223
- </div>
224
- <div class="row">
225
- <div class="col-md-12 mt-4">
226
- <div class="card">
227
- <div class="card-body">
228
- <h4>Usage</h4>
229
- <hr />
230
- <h5>react-leaflet v2</h5>
231
- <iframe
232
- style={{ height: '320px', width: '100%' }}
233
- scrolling="no"
234
- title="react-leaflet-measure example for react-leaflet@2.x"
235
- src="https://codepen.io/m_hasbie/embed/mawyqX/?height=265&theme-id=0&default-tab=js,result"
236
- frameborder="no"
237
- allowtransparency="true"
238
- allowfullscreen="true"
239
- >
240
- See the Pen <a href='https://codepen.io/m_hasbie/pen/mawyqX/'>react-leaflet-measure example for react-leaflet@2.x</a> by M. Hasbie
241
- (<a href='https://codepen.io/m_hasbie'>@m_hasbie</a>) on <a href='https://codepen.io'>CodePen</a>.
242
- </iframe>
243
-
244
- <h5 class="mt-4">react-leaflet v1</h5>
245
- <iframe
246
- style={{ height: '320px', width: '100%' }}
247
- scrolling="no"
248
- title="react-leaflet-measure example for react-leaflet@1.9.1"
249
- src="http://codepen.io/m_hasbie/embed/MZoYvN/?height=265&theme-id=0&default-tab=js,result"
250
- frameborder="no"
251
- allowtransparency="true"
252
- allowfullscreen="true"
253
- >
254
- See the Pen <a href='https://codepen.io/m_hasbie/pen/MZoYvN/'>react-leaflet-measure example for react-leaflet@1.9.1</a> by M. Hasbie
255
- (<a href='https://codepen.io/m_hasbie'>@m_hasbie</a>) on <a href='https://codepen.io'>CodePen</a>.
256
- </iframe>
257
- </div>
258
- </div>
259
- </div>
260
- </div>
261
- <div class="row">
262
- <div class="col-md-12 mt-4">
263
- <div class="card">
264
- <div class="card-body">
265
- <h4>Options</h4>
266
- <hr />
267
- <p>
268
- Any props passed to MeasureControl are passed down to leaflet-measure.
269
-
270
- Refer <a href="https://github.com/ljagis/leaflet-measure#control-options">leaflet-measure control options</a>.
271
- </p>
272
- </div>
273
- </div>
274
- </div>
275
- </div>
276
- <div class="row">
277
- <div class="col-md-12 mt-4">
278
- <div class="card">
279
- <div class="card-body">
280
- <h4>Events</h4>
281
- <hr />
282
-
283
- <table class="table table-hover table-striped">
284
- <thead class="thead-dark">
285
- <tr>
286
- <th>Event</th>
287
- <th>Data</th>
288
- <th>Description</th>
289
- </tr>
290
- </thead>
291
- <tbody>
292
- <tr>
293
- <td class="text-nowrap"><code>onMeasurestart</code></td>
294
- <td></td>
295
- <td>Fired when measurement starts.</td>
296
- </tr>
297
- <tr>
298
- <td class="text-nowrap"><code>onMeasurefinish</code></td>
299
- <td class="text-nowrap"><code>result</code></td>
300
- <td>
301
- Fired when measurement finishes with results of the measurement. Results data includes:
302
- <ul>
303
- <li>
304
- <code>area</code>: Area of a polygon measurement in sq meters. 0 for measurements with less than 3 points.
305
- </li>
306
- <li>
307
- <code>areaDisplay</code>: Area formatted as displayed in the popup.
308
- </li>
309
- <li>
310
- <code>lastCoord</code>: Last point clicked in both decimal degrees and degress/min/seconds.
311
- </li>
312
- <li>
313
- <code>length</code>: Length of the measurement in meters. 0 for measurements with less than 2 points.
314
- </li>
315
- <li>
316
- <code>lengthDisplay</code>: Length formatted as displayed in the popup.
317
- </li>
318
- <li>
319
- <code>pointCount</code>: Number of points directly added by the user.
320
- </li>
321
- <li>
322
- <code>points</code>: Array of points as LatLng used to calculate the measurement. Number of items in the array may differ from <code>pointCount</code> because an additional point is added to close polygons during polygon measurements.
323
- </li>
324
- </ul>
325
- </td>
326
- </tr>
327
- </tbody>
328
- </table>
329
- </div>
330
- </div>
331
- </div>
332
- </div>
333
- </div>
334
- );
335
- }
336
- }
337
-
338
- ReactDOM.render(<App />, document.getElementById('container'));
package/docs/_config.yml DELETED
@@ -1 +0,0 @@
1
- theme: jekyll-theme-slate
@@ -1,8 +0,0 @@
1
- /*!
2
- * Start Bootstrap - Busines Frontpage (https://startbootstrap.com/template-overviews/business-frontpage)
3
- * Copyright 2013-2019 Start Bootstrap
4
- * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap-business-frontpage/blob/master/LICENSE)
5
- */
6
- body {
7
- padding-top: 56px;
8
- }
package/docs/index.html DELETED
@@ -1,118 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6
- <meta name="description" content="https://github.com/mhasbie/react-leaflet-measure">
7
- <meta name="author" content="">
8
-
9
- <title>react-leaflet-measure Demo Page</title>
10
-
11
- <!-- Bootstrap core CSS -->
12
- <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
13
-
14
- <!-- Custom styles for this template -->
15
- <link href="css/business-frontpage.css" rel="stylesheet">
16
-
17
- <!-- Font Awesome -->
18
- <!--<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">-->
19
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
20
-
21
- <!-- Dependencies css -->
22
- <link href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.4.0/leaflet.css" rel="stylesheet">
23
-
24
- <style>
25
- .leaflet-container {
26
- width: 100%;
27
- height: 100%!important;
28
- }
29
- </style>
30
- </head>
31
- <body>
32
- <!-- Navigation -->
33
- <nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
34
- <div class="container">
35
- <a class="navbar-brand" href="#">react-leaflet-measure</a>
36
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
37
- <span class="navbar-toggler-icon"></span>
38
- </button>
39
- <div class="collapse navbar-collapse" id="navbarResponsive">
40
- <ul class="navbar-nav ml-auto">
41
- <li class="nav-item active">
42
- <a class="nav-link" href="#">Home
43
- <span class="sr-only">(current)</span>
44
- </a>
45
- </li>
46
- <!--
47
- <li class="nav-item">
48
- <a class="nav-link" href="#">About</a>
49
- </li>
50
- <li class="nav-item">
51
- <a class="nav-link" href="#">Services</a>
52
- </li>
53
- <li class="nav-item">
54
- <a class="nav-link" href="#">Contact</a>
55
- </li>
56
- -->
57
- </ul>
58
- </div>
59
- </div>
60
- </nav>
61
-
62
- <!-- Header -->
63
- <header class="bg-dark mb-4">
64
- <div class="container h-100">
65
- <div class="row h-100 align-items-center">
66
- <div class="col-lg-12">
67
- <h1 class="display-4 text-white mb-2">react-leaflet-measure</h1>
68
- <p class="lead mb-4 text-white-50">
69
- Coordinate, linear, and area measure control for react-leaflet maps
70
- <div class="btn-group">
71
- <a class="btn btn-outline-light" href="https://github.com/mhasbie/react-leaflet-measure" title="View on Github">
72
- <i class="fab fa-github"></i> Github
73
- </a>
74
- <a class="btn btn-outline-light" href="https://www.npmjs.com/package/react-leaflet-measure" title="View on npm">
75
- <i class="fab fa-npm"></i> npm
76
- </a>
77
- </div>
78
- </p>
79
- </div>
80
- </div>
81
- </div>
82
- </header>
83
-
84
-
85
- <div class="container">
86
- <div class="row">
87
- <div class="col-md-12 mb-5">
88
- <div id="container"></div>
89
- </div>
90
- </div>
91
- </div>
92
- <!-- /.container -->
93
-
94
- <!-- Footer -->
95
- <footer class="py-5 bg-dark">
96
- <div class="container">
97
- <p class="m-0 text-center text-white">&copy; M. Hasbie 2019</p>
98
- </div>
99
- </footer>
100
-
101
- <!-- Bootstrap core JavaScript -->
102
- <script src="vendor/jquery/jquery.min.js"></script>
103
- <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
104
-
105
- <!-- Dependencies JavaScript -->
106
- <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.23.1/babel.js"></script>
107
- <script src="https://unpkg.com/react@16.5.2/umd/react.production.min.js"></script>
108
- <script src="https://unpkg.com/react-dom@16.5.2/umd/react-dom.production.min.js"></script>
109
- <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.4.0/leaflet-src.js"></script>
110
- <script src="https://unpkg.com/react-leaflet@2.2.0/dist/react-leaflet.js"></script>
111
-
112
- <!-- Plugin JavaScript -->
113
- <script src="https://npmcdn.com/react-leaflet-measure/dist/react-leaflet-measure.min.js"></script>
114
-
115
- <!-- Main App -->
116
- <script type="text/babel" src="App.jsx" ></script>
117
- </body>
118
- </html>