This library was generated with Angular CLI version 13.0.0.
Service to wrap leaflet-mouse-position. See documentation https://github.com/danwild/Leaflet.MousePosition#readme
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"
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();
}
}
Method | action |
---|---|
withMap(map: any): void | map to add plugin |
addMouseCursorPlugin() | apply plugin |
withPosition(position: "topleft" or "topright" or "bottomleft" or "bottomright"): ILeafletCursorPositionService | The standard Leaflet.Control position parameter. Defaults to 'bottomleft' |
withSeparator(separator: string): ILeafletCursorPositionService | To separate longitude\latitude values. Defaults to ' : ' |
withEmptyString(emptryString: string): ILeafletCursorPositionService | Initial text to display. Defaults to 'Unavailable' |
withLngFirst(lngFirst: boolean): ILeafletCursorPositionService | Weather to put the longitude first or not. Defaults to false |
witFractionDigits(fractionDigits: number): ILeafletCursorPositionService | Custom function to format the longitude value. Argument: numerical longitude and latitudine value. Return value: formatted string. Defaults to undefined. |
witPrefix(prefix: string): ILeafletCursorPositionService | A string to be prepended to the coordinates. Defaults to the empty string ‘’. |