Coder Social home page Coder Social logo

hatfieldconsultants / leaflet.panelmanager Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 77 KB

A Leaflet plugin for creating panels, and handling plugins which require panels

Home Page: https://nimaboscarino.github.io/leaflet.panelManager/

License: Mozilla Public License 2.0

HTML 10.30% JavaScript 75.91% CSS 13.79%
leaflet-plugins panel gui leaflet leaflet-plugin leaflet-control

leaflet.panelmanager's Introduction

Leaflet PanelManager

Create and manage panels stand-alone panels for Leaflet maps, or load panels to house Leaflet plugins

Demo

Installation and Use:

Add PanelManager to the map

  • Link panelManager.css in the head section
  • Link panelManager.js in the body section after instantiating a map in a "map" div
  • After panelManager.js, add PanelManager to the map: var panelManager = L.PanelManager.addTo(map);

Create Panels

E.g.

L.PanelManager.addTo(map);
map.PanelManager.newPanel({
  position: "bottom",
  toggleHide: true,
  title: "Hi there"
}).addTo(map);

map.PanelManager.newPanel({
  position: "right",
  toggleHide: "button",
  title: "I am another panel"
}).addTo(map);

Panel Options for constructing panels directly

  • position
  • toggleHide
  • title
  • initiallyVisible
  • toggleOnCallback
  • toggleOffCallback
  • silentToggleOnEvent
  • silentToggleOffEvent
  • responsiveRules (not yet implemented)

Load a plugin (e.g. Redliner)

  • var redliner = L.Redliner.addTo(map);
  • map.PanelManager.loadPlugin(map.Redliner);
  • The plugin must have a "GUI" property, which exposes a "loadPanels" function

Plugin Development Guide

PluginManager can be used as a kind of front-end for Leaflet plugins which employ the interface. Plugins must have a GUI property with a "loadPanels" function, which must return an array of panel specifications objects. The array can contain as many panel specifications as desired. (See Redliner for an example of implementing both a button-list panel and a document-list panel.

A panel is specified as such:

title - string (for display)
panelName - string (an identifier)
position - "top" | "bottom" | "right" | "left"
toggleHide - "button" | "peek" | true | false | null
	if "button":
    	toggleIcon: - path to an image
    	toggleOnCallback - function exectued when panel is shown
        toggleOffCallback - function executed when panel is hidden
type - "button-list" | "document-list" | null
	if "button-list":
    	buttons - array of button objects where a button is
        	name - string
            icon - class name (in your styles, you can style the button with this)
            callback - function which is executed when your button is clicked

	if "document-list":
    	documentSource: the array of objects to display
        documentActions: array of actions associated with the documents (e.g. delete, share), shown as buttons.
        	Each action is
        	- name: string (identifier, you can make a class in your styles named after this to style the specific action button)
        	- displayName: string (what is displayed in the button)
        	- action: function (executed when the button is clicked)

leaflet.panelmanager's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gsocol

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.