leaflet#point TypeScript Examples

The following examples show how to use leaflet#point. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenericIcon.ts    From LiveAtlas with Apache License 2.0 5 votes vote down vote up
update(options?: GenericIconOptions) {
		if(options) {
			this.options.iconUrl = options.iconUrl;
			this.options.iconSize = options.iconSize;
			this.options.iconAnchor = options.iconAnchor;
			this.options.isHtml = options.isHtml;
			this.options.label = options.label;
		}

		if(!this._container) {
			return;
		}

		this._container!.classList.toggle('marker--auto-size', !this.options.iconSize);

		if(this._image) {
			const iconSize = this.options.iconSize ? point(this.options.iconSize as PointExpression) : undefined,
				iconAnchor = this.options.iconAnchor ? point(this.options.iconAnchor as PointExpression) : undefined,
				marginLeft = iconAnchor ? -iconAnchor.x : iconSize ? -(iconSize.x / 2) : 0,
				marginTop = iconAnchor ? -iconAnchor.y : iconSize ? -(iconSize.y / 2) : 0;

			if(iconSize) {
				this._image.width = iconSize.x;
				this._image.height = iconSize.y;
			} else {
				this._image.removeAttribute('width');
				this._image.removeAttribute('height');
			}

			this._container.style.marginLeft = marginLeft ? `${marginLeft}px` : '';
			this._container.style.marginTop = marginTop ? `${marginTop}px` : '';
			this._container.style.height = iconSize ? `${iconSize.y}px` : 'auto';

			if(this._image.src !== this.options.iconUrl) {
				this._image.src = this.options.iconUrl;
			}
		}

		if(this._label) {
			if (this.options.isHtml && this._label.innerHTML !== this.options.label) {
				this._label.innerHTML = this.options.label;
			} else if(this._label.textContent !== this.options.label) {
				this._label.textContent = this.options.label;
			}
		}
	}
Example #2
Source File: map.component.ts    From dayz-server-manager with MIT License 5 votes vote down vote up
private project(coords: LatLng): Point {
        return this.map!.project(coords, this.mapScale!);
    }
Example #3
Source File: map.component.ts    From dayz-server-manager with MIT License 5 votes vote down vote up
public curCoordinates: Point = new Point(0, 0);