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-control-bar

v0.2.2

Published

A simple leaflet control bar plugin. that allows custom sizes and resizable bars

Downloads

33

Readme

leaflet-control-bar

Gitlab last commit gitlab

Simple navigation bar for excellent javascript mapping library Leaflet. with the added functionality of resizing, allowing the user to change the height of the control bar. some development sponsored by vgeo.ca we started endpoint.ca

Compatible with Leaflet 0.6.0 or newer Now supports pointer events for a unified drag experience

Example

Check out demo!

Using the plugin

Install

You can install with npm

npm i leaflet-control-bar

or just download the source files from src and add them to your project

then you can include it with something like this

    <link rel="stylesheet" type="text/css" href="node_modules/leaflet-control-bar/src/L.Control.Bar.css">
    <script type="text/javascript" src="node_modules/leaflet-control-bar/src/L.Control.Bar.js"></script>

Usage

Create an element

 <div id="bar"></div>

Create a new L.Control.Bar object and append to the map

var controlBar = L.control.bar('bar',{
    position:'top',
    visible:true
});
map.addControl(controlBar);

Options

  • position:

    • top (default)
    • bottom
    • left
    • right
  • visibility:

    • true visible on add (default)
    • false
  • resizable:

    • true
    • false not resizable on add (default)
  • height:

    • int height/width of the bar in picles (250 default)
  • handleHeight:

    • int height/width resize handle (20 default)
  • handleHTML:

    • string the html that goes in the resize handle (''' default)
  • usePointer:

    • bool * if true will use new pointer events might not work in legacy leaflet ('false' default)*

Methods

// Show control bar
controlBar.show();

// Hide control bar
controlBar.hide();

// Toggle control bar visibility
controlBar.toggle();

// Resizes the bar to 'height' pixels
controlBar.resize(height);

// Check control bar visibility
var visible = controlBar.isVisible();

// Set content to control bar
controlBar.setContent('<p>This is sample content :)</p>');

Events

controlBar.on('shown', function () {
    console.log('Hello control bar!');
});

Available events:

  • show: Show animation is starting, bar will be visible.
  • shown: Show animation finished, bar is now visible.
  • hide: Hide animation is starting, bar will be hidden.
  • hidden: Hide animation finished, bar is now hidden.
  • resize: Resize start
  • resized: Resize finished
  • resizeStart: Fired when initial mouse down happens, and we start tracking the movements.
  • resizeEnd: Fired when Final mouse up happens, and we stop tracking the movements. (this is where you would want to redraw)
    //example
    bar.on('resizeEnd', (e)=> {  
     window.dispatchEvent(new Event('resize')); 
    });

License

leaflet-control-bar is free software, and may be redistributed under the MIT-LICENSE.

A fork of the leaflet-control-bar plugin. Inspired by leaflet-sidebar plugin.