0.1.3 • Published 5 years ago

maptalks.compass v0.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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 and https://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%)'
}).addTo(map)

API Reference

new maptalks.CompassControl(options)
  • options
    • position String like other maptalksControl.
    • backgroundColor String background-color of the compass.
    • transform String the compass dom's style: 'transform: %s'.

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