0.2.0 • Published 1 year ago
maptalks.control.compass v0.2.0
maptalks.control.compass
A maptalks Compass Control.
Examples
DEMO
Install
- Install with npm:
npm install maptalks.control.compass
. - Install with yarn:
yarn add maptalks.control.compass
. - Download from dist directory.
- Use unpkg CDN:
https://cdn.jsdelivr.net/npm/maptalks.control.compass/dist/maptalks.control.compass.min.js
andhttps://cdn.jsdelivr.net/npm/maptalks.control.compass/css/maptalks.control.compass.css
Usage
As a Maptalks.control, maptalks.control.compass
must be loaded after maptalks.js
in browsers. You can also use 'import { CompassControl } from "maptalks.control.compass"
and 'import "maptalks.control.compass/css/maptalks.control.compass.css"
when developing with webpack.
<!-- ... -->
<script src="https://cdn.jsdelivr.net/npm/maptalks.control.compass/dist/maptalks.control.compass.min.js"></script>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/maptalks.control.compass/css/maptalks.control.compass.css"
/>
<!-- ... -->
// new Control: CompassControl, and add to map.
new maptalks.CompassControl({
position: 'top-right',
backgroundColor: '#00BCD4', // 'rgba(235, 235, 235, .65)'
transform: 'scale(1.2) translate(10%, 10%)',
resetViewTriggers: 'click dblclick', // ['dblclick contextmenu', {duration: 500}]
}).addTo(map)
// All options are optional.
API Reference
new maptalks.CompassControl(options)
options optional
- position String - like other maptalks.Control.
- backgroundColor String - background-color of the compass.
- transform String - the compass dom's style: 'transform: %s'.
- resetViewTriggers String | Array - set event triggers on Compass to set map view to
{bearing: 0, pitch: 0}
.
events
- add
- remove
- positionchange
- click
- dblclick
- contextmenu
Contributing
We welcome any kind of contributions including issue reportings, pull requests, documentation corrections, feature requests and any other helps.
Develop
The only source file is index.js
.
It is written in ES6, transpiled by babel and tested with mocha and expect.js.
Scripts
- Install dependencies
$ npm install
- Watch source changes and generate runnable bundle repeatedly
$ gulp watch
- Package and generate minified bundles to dist directory
$ gulp minify
- Lint
$ npm run lint
More Things
0.2.0
1 year ago
0.1.3
4 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago
0.1.0-beta.2
5 years ago
0.1.0-beta.1
6 years ago
0.1.0-alpha.1
6 years ago