All Implemented Interfaces:
Serializable, Identifiable, ExecutableFunctions

@NpmPackage(value="leaflet.fullscreen", version="3.0.0") @JsModule("leaflet.fullscreen/Control.FullScreen.js") @CssImport(value="leaflet.fullscreen/Control.FullScreen.css", themeFor="leaflet-map") public class FullScreenControl extends LeafletControl

Leaflet.Control.FullScreen

Web component: https://www.npmjs.com/package/leaflet.fullscreen

Simple plugin for Leaflet that adds fullscreen button to your maps.

If your map have a zoomControl the fullscreen button will be added at the bottom of this one.

If your map doesn't have a zoomContron the fullscreen button will be added to topleft corner of the map (same as the zoomcontrol).

If you want to use the plugin on a map embedded in an iframe, don't forget to set allowfullscreen attribute on your iframe.

FullScreen options

  • position - change the position of the button can be topleft, topright, bottomright or bottomleft, defaut topleft
  • title - change the title of the button, default Full Screen
  • titleCancel - change the title of the button when fullscreen is on, default Exit Full Screen
  • content - change the content of the button, can be HTML, default null
  • forceSeparateButton - force seperate button to detach from zoom buttons, default false
  • forcePseudoFullscreen - force use of pseudo full screen even if full screen API is available, default false
  • fullscreenElement - Dom element to render in full screen, false by default, fallback to map._container
*

FullScreen events

  • enterFullscreen - event is fired when entering fullscreen
  • exitFullscreen - events is fired when exiting fullscreen

Basic Usage

 FullScreenControl fullScreenControl = new FullScreenControl();
 fullScreenControl.addTo(leafletMap);
 
Since:
2020-05-26
Version:
1.0
Author:
Gabor Kokeny Email: kokeny19@gmail.com
See Also:
  • Constructor Details

    • FullScreenControl

      public FullScreenControl()
      Creates a new fullscreen control positioned in the top-left corner of the map.
  • Method Details

    • getTitle

      public String getTitle()
      Gets the title (tooltip) of the button shown while not in fullscreen.
      Returns:
      the title
    • setTitle

      public void setTitle(String title)
      Sets the title (tooltip) of the button shown while not in fullscreen.
      Parameters:
      title - the title to set
    • getTitleCancel

      public String getTitleCancel()
      Gets the title (tooltip) of the button shown while in fullscreen.
      Returns:
      the titleCancel
    • setTitleCancel

      public void setTitleCancel(String titleCancel)
      Sets the title (tooltip) of the button shown while in fullscreen.
      Parameters:
      titleCancel - the titleCancel to set
    • getContent

      public String getContent()
      Gets the content of the button, which may be HTML.
      Returns:
      the content
    • setContent

      public void setContent(String content)
      Sets the content of the button, which may be HTML.
      Parameters:
      content - the content to set
    • isForceSeparateButton

      public boolean isForceSeparateButton()
      Gets whether the fullscreen button is forced to detach from the zoom buttons.
      Returns:
      the forceSeparateButton
    • setForceSeparateButton

      public void setForceSeparateButton(boolean forceSeparateButton)
      Sets whether the fullscreen button is forced to detach from the zoom buttons.
      Parameters:
      forceSeparateButton - the forceSeparateButton to set
    • isForcePseudoFullscreen

      public boolean isForcePseudoFullscreen()
      Gets whether pseudo fullscreen is used even when the browser fullscreen API is available.
      Returns:
      the forcePseudoFullscreen
    • setForcePseudoFullscreen

      public void setForcePseudoFullscreen(boolean forcePseudoFullscreen)
      Sets whether pseudo fullscreen is used even when the browser fullscreen API is available.
      Parameters:
      forcePseudoFullscreen - the forcePseudoFullscreen to set
    • isFullscreenElement

      public boolean isFullscreenElement()
      Gets whether a specific DOM element is rendered in fullscreen instead of the map container.
      Returns:
      the fullscreenElement
    • setFullscreenElement

      public void setFullscreenElement(boolean fullscreenElement)
      Sets whether a specific DOM element is rendered in fullscreen instead of the map container.
      Parameters:
      fullscreenElement - the fullscreenElement to set
    • wrap

      public static WithFullScreenControl wrap(LeafletMap leafletMap)
      Wraps the given map in an adapter exposing the fullscreen control API.
      Parameters:
      leafletMap - the map to wrap, not null
      Returns:
      a WithFullScreenControl adapter for the given map