blob: 9ea081417654ec0ae650a32049dcdae663345a7f [file] [log] [blame]
/********************************************************************************
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
import {Directive, Inject, Input, NgZone} from "@angular/core";
import {LatLngLiteral} from "leaflet";
import {ILeafletConfiguration, LEAFLET_CONFIGURATION_TOKEN} from "../../leaflet-configuration.token";
import {LeafletDirective} from "../leaflet";
import {AbstractLeafletMarkerDirective} from "./abstract-leaflet-marker.directive";
@Directive({
selector: "[appLeafletMarker]",
exportAs: "appLeafletMarker"
})
export class LeafletMarkerDirective extends AbstractLeafletMarkerDirective {
public constructor(
ngZone: NgZone,
leafletDirective: LeafletDirective,
@Inject(LEAFLET_CONFIGURATION_TOKEN) configuration: ILeafletConfiguration,
) {
super(ngZone, leafletDirective, configuration);
}
@Input()
public set appLeafletMarker(value: LatLngLiteral) {
const isSet = this.setLatLng(value);
if (!isSet) {
this.remove();
}
}
}