Code Monkey home page Code Monkey logo

mapgl-ruler's Introduction

mapgl-ruler

Ruler plugin for Mapgl

Live demo

Usage

Install with NPM

npm install @2gis/mapgl-ruler

Use ruler directly

Import the Ruler class to your project and use it:

import { Ruler } from '@2gis/mapgl-ruler';

const map = new mapgl.Map('container', {
    center: [55.31878, 25.23584],
    zoom: 13,
    key: 'Your API access key',
});

const ruler = new Ruler(map, { 
    points: [
        [55.31878, 25.23584],
        [55.35878, 25.23584],
        [55.35878, 25.26584],
    ]
});

Use ruler via RulerControl

Import the RulerControl class to your project and use it:

import { RulerControl } from "@2gis/mapgl-ruler";

const map = new mapgl.Map('container', {
    center: [55.31878, 25.23584],
    zoom: 13,
    key: 'Your API access key',
});

const control = new RulerControl(map, { position: 'centerRight' })

Contributing

Mapgl-ruler uses github-flow to accept & merge fixes and improvements. Basic process is:

  • Fork the repo.
  • Create a branch.
  • Add or fix some code.
  • Run testing suite with npm run docker:test and make sure nothing is broken
  • Add some tests for your new code or fix broken tests.
  • Commit & push.
  • Create a new pull request to original repo.

Pull requests with failing tests will not be accepted. Also, if you modify packages or add them to package.json, make sure you use npm and update package-lock.json.

Tests

Run tests

npm run docker:test

Update screenshots

npm run docker:screenshot:update

Release

npm

  1. Update the package version by running npm version patch|minor|major. This command returns a new package version. Let assume it's 1.2.3
  2. Push changes to github and merge them to the «master» branch
  3. Go to https://github.com/2gis/mapgl-ruler/releases/new
  4. Click the «Choose tag» button and create a new tag according to the version in package.json, for example v1.2.3
  5. Make sure the release target is the «master» branch
  6. Paste the release tag into the «Release title» field, for example v1.2.3
  7. Add a release description
  8. Click the «Publish release» button
  9. Go to https://github.com/2gis/mapgl-ruler/actions and wait for completing the release workflow

Demo

  1. Just execute npm run deploy-gh-pages on your local machine from a commit you want to deploy as a demo.

mapgl-ruler's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.