npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

canvas-route-map

v1.0.10

Published

Interactive map on canvas to create route by image

Downloads

22

Readme

Route map on canvas

About

It's a library for creating route from point A to point B by image. The library uses A Search Algorithm(javascript-astar) to make a route.

Features

  • Draw a route on map;
  • Animate route by use image;
  • There are available zoom and touch events;
  • Add image to point;

This library is written in Vanilla JS.

Installing

NPM

  npm install canvas-route-map

Options

  • Required attributes:
    • container : container - it's a DOM element to render canvas;
    • url: 'image.png/jpeg/gif/bmp/tiff' - path to image.
  • Canvas attributes:
    • width(default: 1080) - canvas width;
    • height(default: 608) - canvas height;
    • initialWidth(Default: 1080) - image width;
    • scale(default: true) - scalability of canvas;
    • zoom(default: 2) - canvas zoom, zoom in and zoom out.
  • Map attributes:
    • trackColor(default: r: 255, b: 255, g: 255) - rgb color value for map, free route in map;
    • diagonal(default: true) - route in direct line.
    • Points(startPoint, endPoint):
      • coordinates(required): {x,y} - coordinates where point is located on canvas.
      • Image - image of point;
        • url(required): 'image.png/jpeg/gif/bmp/tiff' - path to image of point;
        • width(default: 20) - image width;
        • height(default: 20) - image height;
        • position(default: 'up') - image position('center','up').
    • Route:
      • animateSpeed(default: 50) - speed of animation;
      • step(default: 20) - step between.
      • Drawing(default):
        • color(default: '#f00') - route color;
        • printWeight(default: 5) - weight of print step.
      • Image - image of point;
        • url(required): 'image.png/jpeg/gif/bmp/tiff' - path to image of point;
        • width(default: 20) - image width;
        • height(default: 20) - image height.

Callbacks

  • ready(callback) - when canvas is ready.

Usage

  • Simple example:
const map = new canvasRouteMap.CanvasRouteMap({
 container: container,
  url: 'map.png',
  map: {
    startPoint: {
      coordinates: {x: 41, y: 442},
    },
    endPoint: {
      coordinates: {x: 833, y: 196},
    },
   
  },
});
  • Example with full options:
const map = new canvasRouteMap.CanvasRouteMap({
 container: container,
  url: 'map.png',
  canvas: {
    width: 1080,
    height: 608,
    initialWidth: 1080,
    scale: true,
    zoom: 2
  },
  map: {
    trackColor: {r: 255, b: 255, g: 255},
    diagonal: true,
    startPoint: {
      coordinates: {x: 41, y: 442},
      image: {
        url: 'pointA.png',
        width: 50,
        height: 50,
        position: 'up'
      }
    },
    endPoint: {
      coordinates: {x: 833, y: 196},
      image: {
        url: 'pointB.png',
        width: 50,
        height: 50,
        position: 'up'
      }
    },
    route: {
      animateSpeed: 50,
      step: 20,
      drawing: {
        color: '#f00',
        printWeight: 5
      },
      image: {
        url: 'feet.png',
        width: 13,
        height: 8,
      }
    }
  },
});

Authors

Eugene Artsiukhevich

Acknowledgments

Maybe, it will be useful for somebody.