Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ charset = utf-8
indent_style = space
indent_size = 4

[{package.json,package-lock.json,.travis.yml}]
[{package.json,package-lock.json}]
indent_style = space
indent_size = 2

Expand Down
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

16 changes: 0 additions & 16 deletions .eslintrc.json

This file was deleted.

6 changes: 4 additions & 2 deletions .gitignore
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
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"trailingComma": "all",
"singleQuote": true
}
3 changes: 0 additions & 3 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ FROM node:8-alpine
WORKDIR /opt/mapbox-gl-circle

COPY package.json /opt/mapbox-gl-circle/
COPY index.html /opt/mapbox-gl-circle/
COPY lib/main.ts /opt/mapbox-gl-circle/lib/
COPY example/index.ts /opt/mapbox-gl-circle/example/

RUN npm install && mkdir -p example/ lib/

COPY lib/main.js /opt/mapbox-gl-circle/lib/
COPY example/index.js /opt/mapbox-gl-circle/example/
RUN npm install
Comment on lines 9 to +14

Copy link
Copy Markdown
Contributor

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.

COPY package.json /opt/mapbox-gl-circle/ ← layer N
COPY index.html /opt/mapbox-gl-circle/ ← layer N+1
COPY lib/main.ts /opt/mapbox-gl-circle/lib/ ← layer N+2
COPY example/index.ts /opt/mapbox-gl-circle/example/ ← layer N+3
RUN npm install ← layer N+4

When you change the execution order to run the most expensive step (npm install) last, it means that any line changed in the index.html file or lib/main.ts will 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 the package.json.


EXPOSE 9966 35729

Expand Down
161 changes: 0 additions & 161 deletions Jenkinsfile

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Copyright (c) 2020, Smith Micro Software, Inc.
Copyright (c) 2017, Smith Micro Software, Inc.

Citing U.S. Copyright Office:

Do I have to renew my copyright?

No. Works created on or after January 1, 1978, are not subject to renewal registration. As to works published or registered prior to January 1, 1978, renewal registration is optional after 28 years but does provide certain legal advantages. For information on how to file a renewal application as well as the legal benefit for doing so, see Circular 15, Renewal of Copyright, and Circular 15a, Duration of Copyright.


Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand Down
117 changes: 12 additions & 105 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand All @@ -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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The npm run docs step from the Update README API Documentation is broken with the changes in this PR. I see that you've written very neat and clear Typescript docs for the MapboxCricle public interface, so would it be possible to still generate a readable summary here? I looked at this TypeDoc example and it appeared promising to me.

## Development

### Install Dependencies
Expand All @@ -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))
Expand Down
Loading