maptalks.compass

0.1.3 • Public • Published

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

Dependencies (0)

    Dev Dependencies (5)

    Package Sidebar

    Install

    npm i maptalks.compass

    Weekly Downloads

    1

    Version

    0.1.3

    License

    MIT

    Unpacked Size

    21.6 kB

    Total Files

    15

    Last publish

    Collaborators

    • hudeyi