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

leaflet-outline-connector

v0.1.4

Published

Leaflet connectors is a plugin to draw lines from the outlines of various geometries.

Downloads

1

Readme

Leaflet Outline Connector

Leaflet connectors is a plugin to draw lines from the outlines of various geometries.

Live-Demo: https://severino.github.io/leaflet-outline-connector/

Checkout the Demo section for more infos how to use the Demo effectively.

Supported Geometries

Currently the following geometries are supported:

  • Point
    • Array ([lat,lng])
    • L.LatLng
  • CircleMarker
  • Circle
  • ShapeMarkers
    • Square

Installation

Using yarn

yarn add leaflet-outline-connector

Using npm

npm i leaflet-outline-connector

Import into your environment

You can import the plugin into your environment, with the following methods:

Script Tag

<!-- Import leaflet first and then, ... -->
<script src="/node_modules/leaflet-outline-connector/leaflet-outline-connector.js"></script>

Import Statement

    import L from "leaflet"
    // You can just import the plugin,
    // it will be automatically available on 
    // the 'L' object.
    import "leaflet-outline-connector"

Usage

Simple Connector

When having two (or more) that you want to connect, you simply create a connector like that:

        /*
         < setup leaflet regulary with a map variable called 'map' > 
        */

        // You can even connect CIRCLE MARKERS ...
        const Stuttgart = L.circleMarker([48.7784485, 9.1800132]).addTo(map);

        // with CIRCLES.
        const Hamburg = L.circle([53.550341, 10.000654], { radius: 20000}).addTo(map);

        // OPTIONAL: You can provide your own options to style the path...
        let options = {
            color: "red"
        }

        //          ... or use the options of one of the existing geometries.
        options = Stuttgart.options


        L.connector([Stuttgart, Hamburg], options)
                // The connector is a normal path object that must be added
                // to the map separately from the markers.
                .addTo(map)
                // Optional to bring the connector to the back
                // otherwise the line end is on top of the markers
                // and it looks not so clean.
                .bringToBack()

Connect one (origin) with many (destination)

You may also provide as many elements as you want, whereas the first element is the origin and for each further element (destination) a line is created from the origin to that destination.

        // Multiple example

        const franceColor = "blue";

        const Paris_origin = L.circle([48.788771, 2.323608], { radius: 30000, fill: false, color: franceColor }).addTo(map);
        const Reims = L.shapeMarker([49.2595, 4.02798], { shape: "square", radius: 10, fill: false, color: franceColor }).addTo(map);
        const Rouen = L.circle([49.434347, 1.0943916], { radius: 10000, fill: false, color: franceColor }).addTo(map);
        const LeMans = L.circleMarker([47.982456, 0.218905], { radius: 10, fill: false, color: franceColor }).addTo(map);

        /**
         * When connecting multiple geometries, the first 
         * provided element is the origin and all connectors
         * will be drawn from this element to the others.
         */
        L.connector([Paris_origin, Reims, Rouen, LeMans], { color: franceColor }).addTo(map);

The demo provides a good insight on the capabilities of the plugin and also a proper playground when developing.

Parameters

The behavior of the app may be altered utilizing the query string of the URL. Following parameters and values are available:

| name | values | example | description | | --- | --- | --- | --- | | center | lat[float],lng[float] | ?center=52.241256,18.720703 | Sets the viewport position on the map to the coodinates specified. | | zoom | zoom-level[int] | ?zoom=7 | Sets the viewport zoom on the map to the specified zoom level | | example | example-name["single" | "multiple" | "point" | "inside-outside"] | ?example=single | Specifies which example should be loaded in isolation. By default all examples are loaded | | shape | shape-name[circle | circleMarker | square] | ?shape=square | Sets a target shape. Only works for the example 'inside-out'

Note: If you are not familiar with query parameters, they are put at the end of the URL. The start is indicated by a '?' followed by a key value pair separated by an '='. Additional parameters can be added by separating them with an '&'. Example: https://localhost/index.html?zoom=7&center=52.241,18.720

Hotkeys

For ease of use the app also provides a small set an hotkeys which make the live a bit easier.

  • [CTRL + Left Click] Copy coordinate of mouse cursor to clipboard
  • [CTRL + SHIFT + Left Click] Appends the mouse cursor coordinate to the exixting clipboard