1.1.0 • Published 1 year ago

@geosdi/ngx-leaflet-cursor-position-plugin v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

NgxLeafletCursorPositionPlugin

This library was generated with Angular CLI version 13.0.0.

General information

Service to wrap leaflet-mouse-position. See documentation https://github.com/danwild/Leaflet.MousePosition#readme

Installation

npm i @geosdi/ngx-leaflet-cursor-position --save

It depends on :

"@angular/common": ">=13.0.0",
"@angular/core": ">=13.0.0",
"leaflet": "1.7.1"
"leaflet-mouse-position": "^1.2.0"

Usage

import { Injectable } from '@angular/core'; 
import {NgxLeafletCursorPositionPluginService} from "./ngx-leaflet-cursor-position-plugin.service"; 

@Injectable({
 providedIn: 'root'
})
export class Service {

   constructor(private mapCursorPositionPluginService: NgxLeafletCursorPositionPluginService,) {
   }

  public addPlugin() {
   this.mapCursorPositionPluginService
     .withMap(this.map)
     .addMouseCursorPlugin();
   }

}

Methods

Methodaction
withMap(map: any): voidmap to add plugin
addMouseCursorPlugin()apply plugin
withPosition(position: "topleft" or "topright" or "bottomleft" or "bottomright"): ILeafletCursorPositionServiceThe standard Leaflet.Control position parameter. Defaults to 'bottomleft'
withSeparator(separator: string): ILeafletCursorPositionServiceTo separate longitude\latitude values. Defaults to ' : '
withEmptyString(emptryString: string): ILeafletCursorPositionServiceInitial text to display. Defaults to 'Unavailable'
withLngFirst(lngFirst: boolean): ILeafletCursorPositionServiceWeather to put the longitude first or not. Defaults to false
witFractionDigits(fractionDigits: number): ILeafletCursorPositionServiceCustom function to format the longitude value. Argument: numerical longitude and latitudine value. Return value: formatted string. Defaults to undefined.
witPrefix(prefix: string): ILeafletCursorPositionServiceA string to be prepended to the coordinates. Defaults to the empty string ‘’.