Repository navigation
Converts mapbox-gl-circle to typescript #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,6 @@ | ||
| .idea | ||
| node_modules/ | ||
| dist/ | ||
| /node_modules/ | ||
| /dist/ | ||
| /example/*.js | ||
| bundle.js | ||
| *.tgz |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "printWidth": 120, | ||
| "trailingComma": "all", | ||
| "singleQuote": true | ||
| } |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||
| Copyright (c) 2017, Smith Micro Software, Inc. | ||||||
| Copyright (c) 2020, Smith Micro Software, Inc. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Citing U.S. Copyright Office:
|
||||||
|
|
||||||
| Permission to use, copy, modify, and/or distribute this software for any | ||||||
| purpose with or without fee is hereby granted, provided that the above | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,17 +31,16 @@ const MapboxCircle = require('mapbox-gl-circle'); | |
|
|
||
| <!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
|
|
||
| ### MapboxCircle | ||
| #### Table of Contents | ||
|
|
||
| A `google.maps.Circle` replacement for Mapbox GL JS, rendering a "spherical cap" on top of the world. | ||
| - [MapboxCircle](#mapboxcircle) | ||
| - [Examples](#examples) | ||
|
|
||
| **Parameters** | ||
| ### MapboxCircle | ||
|
|
||
| - `center` | ||
| - `radius` | ||
| - `options` | ||
| A `google.maps.Circle` replacement for Mapbox GL JS, rendering a "spherical cap" on top of the world. | ||
|
|
||
| **Examples** | ||
| #### Examples | ||
|
|
||
| ```javascript | ||
| var myCircle = new MapboxCircle({lat: 39.984, lng: -75.343}, 25000, { | ||
|
|
@@ -64,104 +63,6 @@ myCircle.on('contextmenu', function (mapMouseEvent) { | |
| }); | ||
| ``` | ||
|
|
||
| #### constructor | ||
|
|
||
| **Parameters** | ||
|
|
||
| - `center` **({lat: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), lng: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)} | \[[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)])** Circle center as an object or `[lng, lat]` coordinates | ||
| - `radius` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Meter radius | ||
| - `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** | ||
| - `options.editable` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Enable handles for changing center and radius (optional, default `false`) | ||
| - `options.minRadius` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Minimum radius on user interaction (optional, default `10`) | ||
| - `options.maxRadius` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Maximum radius on user interaction (optional, default `1100000`) | ||
| - `options.strokeColor` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Stroke color (optional, default `'#000000'`) | ||
| - `options.strokeWeight` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Stroke weight (optional, default `0.5`) | ||
| - `options.strokeOpacity` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Stroke opacity (optional, default `0.75`) | ||
| - `options.fillColor` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Fill color (optional, default `'#FB6A4A'`) | ||
| - `options.fillOpacity` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Fill opacity (optional, default `0.25`) | ||
| - `options.refineStroke` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Adjust circle polygon precision based on radius and zoom | ||
| (i.e. prettier circles at the expense of performance) (optional, default `false`) | ||
| - `options.properties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Property metadata for Mapbox GL JS circle object (optional, default `{}`) | ||
|
|
||
| #### on | ||
|
|
||
| Subscribe to circle event. | ||
|
|
||
| **Parameters** | ||
|
|
||
| - `event` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Event name; `click`, `contextmenu`, `centerchanged` or `radiuschanged` | ||
| - `fn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Event handler, invoked with the target circle as first argument on | ||
| _'centerchanged'_ and _'radiuschanged'_, or a _MapMouseEvent_ on _'click'_ and _'contextmenu'_ events | ||
| - `onlyOnce` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Remove handler after first call (optional, default `false`) | ||
|
|
||
| Returns **[MapboxCircle](#mapboxcircle)** | ||
|
|
||
| #### once | ||
|
|
||
| Alias for registering event listener with _onlyOnce=true_, see [#on](#on). | ||
|
|
||
| **Parameters** | ||
|
|
||
| - `event` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Event name | ||
| - `fn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Event handler | ||
|
|
||
| Returns **[MapboxCircle](#mapboxcircle)** | ||
|
|
||
| #### off | ||
|
|
||
| Unsubscribe to circle event. | ||
|
|
||
| **Parameters** | ||
|
|
||
| - `event` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Event name | ||
| - `fn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Handler to be removed | ||
|
|
||
| Returns **[MapboxCircle](#mapboxcircle)** | ||
|
|
||
| #### addTo | ||
|
|
||
| **Parameters** | ||
|
|
||
| - `map` **mapboxgl.Map** Target map for adding and initializing circle Mapbox GL layers/data/listeners. | ||
| - `before` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Layer ID to insert the circle layers before; explicitly pass `null` to | ||
| get the circle assets appended at the end of map-layers array (optional, default `'waterway-label'`) | ||
|
|
||
| Returns **[MapboxCircle](#mapboxcircle)** | ||
|
|
||
| #### remove | ||
|
|
||
| Remove source data, layers and listeners from map. | ||
|
|
||
| Returns **[MapboxCircle](#mapboxcircle)** | ||
|
|
||
| #### getCenter | ||
|
|
||
| Returns **{lat: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), lng: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)}** Circle center position | ||
|
|
||
| #### setCenter | ||
|
|
||
| **Parameters** | ||
|
|
||
| - `position` **{lat: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), lng: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)}** | ||
|
|
||
| Returns **[MapboxCircle](#mapboxcircle)** | ||
|
|
||
| #### getRadius | ||
|
|
||
| Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Current radius, in meters | ||
|
|
||
| #### setRadius | ||
|
|
||
| **Parameters** | ||
|
|
||
| - `newRadius` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Meter radius | ||
|
|
||
| Returns **[MapboxCircle](#mapboxcircle)** | ||
|
|
||
| #### getBounds | ||
|
|
||
| Returns **{sw: {lat: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), lng: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)}, ne: {lat: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number), lng: [number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)}}** Southwestern/northeastern bounds | ||
|
|
||
|
Comment on lines
-67
to
-164
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| ## Development | ||
|
|
||
| ### Install Dependencies | ||
|
|
@@ -186,6 +87,12 @@ Returns **{sw: {lat: [number](https://developer.mozilla.org/docs/Web/JavaScript/ | |
|
|
||
| ## Changelog | ||
|
|
||
| ### v. 2.0.0 | ||
|
|
||
| - Upgrades Mapbox GL JS from `v.0.44.1 -> v.1.6.1` | ||
| - Upgrades Turf `v.4.7.3 -> v.5.1.6` | ||
| - Converts mapbox-gl-circle to typescript | ||
|
|
||
| ### v. 1.6.5 | ||
|
|
||
| - Bug fix for layer switching in `mapbox-gl>0.40.1` ([#73](https://github.com/smithmicro/mapbox-gl-circle/issues/73)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each of these statements will create a layer in for the container image that is subject to caching. I.e.
When you change the execution order to run the most expensive step (
npm install) last, it means that any line changed in theindex.htmlfile orlib/main.tswill force a complete rebuild of "layer N+4", this is probably not what we want. So it' propose reverting to running the install step directly after adding thepackage.json.