Socket
Socket
Sign inDemoInstall

@canterbury-air-patrol/leaflet-dialog

Package Overview
Dependencies
23
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @canterbury-air-patrol/leaflet-dialog

Resizable, movable dialog window for Leaflet


Version published
Weekly downloads
25
increased by13.64%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Leaflet.Dialog

A dialog modal window that is resizable and positionable on the map.

Check out the Demo Here

Installation:

# Bower:
bower install Leaflet.Dialog
# NPM:
npm install leaflet-dialog

Adding a dialog box:

// After you've set up your map and layers, add the modal window by running:
var dialog = L.control.dialog(options)
              .setContent("<p>Hello! Welcome to your nice new dialog box!</p>")
              .addTo(map);

Working with the dialog box:

Close the window:

dialog.close();

Open the window:

dialog.open();

Destroy the window:

dialog.destroy();

Reset the contents:

dialog.setContent("<p>Here's some new content!</p>");

Options:

PropertyTypeDefaultDescription
size[Array][width, height][ 300, 300 ]An array of the starting width and height values (in pixels).
minSize[Array][width, height][ 100, 100 ]An array with the minimum resize width and height (in pixels).
maxSize[Array][width, height][ 350, 350 ]An array with the maximum resize width and height (in pixels).
anchor[Array][top, left][ 250, 250 ]The starting point anchor location (from the upper left) in pixels.
position[String]'topleft'The leaflet control div to place the modal inside, as a starting reference point.
initOpen[Boolean]trueWhether or not to initialize in an open state.
title[String]nullTitle bar HTML
iconClass[Object]{grabber: "fa fa-arrows", close: "fa fa-times", resize: "fa fa-arrows-h fa-rotate-45", collapse: "fa caret-down", expand: "fa caret-up"}Classes to be used as icons for grabber, close, resize, expand/collapse

Methods:

MethodReturnsExampleDescription
open()thisdialog.open();Opens the dialog window.
close()thisdialog.close();Closes the dialog window.
destroy()thisdialog.destroy();Removes the dialog box from the window.
setLocation( [Array][top, left] anchor location )thisdialog.setLocation( [ 15, 15 ] );Move the dialog box to the specified pixel location ( Relative to the 'position' option )
setSize( [Array][width, height] size )thisdialog.setSize( [ 150, 150 ] );Resize the dialog window to the specified width and height.
lock()thisdialog.lock();Hides all visible dialog window controls.
unlock()thisdialog.unlock();Re-instates all dialog window controls.
freeze()thisdialog.freeze();Hides all visible dialog window movement/sizing controls.
unfreeze()thisdialog.unfreeze();Re-instates all dialog window movement/sizing controls.
hideClose()thisdialog.hideClose();Hides the closing 'x'
showClose()thisdialog.showClose();Shows the closing 'x'
hideResize()thisdialog.hideResize();Hides the resizing symbol
showResize()thisdialog.showResize();Shows the resizing symbol

Events:

EventDataDescription
dialog:openedthisFired when open() is called.
dialog:closedthisFired when close() is called or when the 'x' is clicked.
dialog:destroyedthisFired when destroy() is called.
dialog:lockedthisFired when lock() is called.
dialog:unlockedthisFired when unlock() is called.
dialog:frozenthisFired when freeze() is called.
dialog:unfrozenthisFired when unfreeze() is called.
dialog:updatedthisFired when contents are set or when added to the map.
dialog:resizestartthisFired when the resize button is clicked.
dialog:resizingthisFired continuously as the resize button is dragged.
dialog:resizeendthisFired when the resize button click is released.
dialog:movestartthisFired when the move button is clicked.
dialog:movingthisFired continuously as the move button is dragged.
dialog:moveendthisFired when the move button click is released.
dialog:closehiddenthisFired when hideClose() is called.
dialog:closeshownthisFired when the showClose() is called.
dialog:resizehiddenthisFired when hideResize() is called.
dialog:resizeshownthisFired when the showResize() is called.

Keywords

FAQs

Last updated on 15 Jul 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc