How to use the leaflet.DomEvent function in leaflet

To help you get started, we’ve selected a few leaflet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github HSLdevcom / jore-map-ui / src / components / map / layers / markers / MarkerPopup.ts View on Github external
const _popupMouseOut = (e: any) => {
                if (markerRef.current) {
                    const leafletMarker = markerRef.current.leafletElement;
                    // detach the event
                    L.DomEvent.off(leafletMarker._popup, 'mouseout', _popupMouseOut, this);

                    // get the element that the mouse hovered onto
                    const target = e.toElement || e.relatedTarget;
                    // check to see if the element is a popup or a marker
                    if (
                        _getParent(target, 'leaflet-popup') ||
                        _getParent(target, 'leaflet-marker-icon')
                    ) {
                        return;
                    }

                    // hide the popup
                    leafletMarker.closePopup();
                }
            };
github wladich / nakarte / src / lib / leaflet.control.commons / index.js View on Github external
function stopContainerEvents(container) {
    L.DomEvent.disableClickPropagation(container);
    L.DomEvent.disableScrollPropagation(container);
    L.DomEvent.on(container, 'mousemove contextmenu', L.DomEvent.stop);
}
github Labelbox / Labelbox / templates / image-segmentation / src / labeling-screen / leaflet-draw / leaflet.draw.js View on Github external
_createButton: function(t) {
        var e = L.DomUtil.create("a", t.className || "", t.container),
          i = L.DomUtil.create("span", "sr-only", t.container);
        e.href = "#", e.appendChild(i), t.title && (e.title = t.title, i.innerHTML = t.title), t.text && (e.innerHTML = t.text, i.innerHTML = t.text);
        var o = this._detectIOS() ? "touchstart" : "click";
        return L.DomEvent.on(e, "click", L.DomEvent.stopPropagation).on(e, "mousedown", L.DomEvent.stopPropagation).on(e, "dblclick", L.DomEvent.stopPropagation).on(e, "touchstart", L.DomEvent.stopPropagation).on(e, "click", L.DomEvent.preventDefault).on(e, o, t.callback, t.context), e
      },
      _disposeButton: function(t, e) {
github calvinmetcalf / fileGDB.js / site / script.js View on Github external
function addFunction() {
	var div = L.DomUtil.create('form', 'bgroup');
	div.id = "dropzone";
	var bgroup = L.DomUtil.create('div','btn-group',div);
	var doneButton = L.DomUtil.create('button', "btn  btn-primary span3", bgroup);
	doneButton.type = "button";
	doneButton.innerHTML = "select a zipped .GDB";
	L.DomEvent.addListener(doneButton, "click", function() {
		fileInput.click();
	});
	var dirButton = L.DomUtil.create('button', "btn  btn-primary span3", bgroup);
	dirButton.type = "button";
	dirButton.innerHTML = "upload the files in a .GDB folder";
	L.DomEvent.addListener(dirButton, "click", function() {
		dirInput.click();
	});
	return div;
}
var NewButton = L.Control.extend({ //creating the buttons
github HSLdevcom / jore-map-ui / src / components / map / mapControls / CoordinateControl.tsx View on Github external
if (!isNaN(newY) && !isNaN(newX)) {
                this.setInputAsCenter(newX, newY);
            }
        };
        this.xInput.onkeypress = this.yInput.onkeypress = (e: KeyboardEvent) => {
            if (e.key === 'Enter') {
                this.xInput.blur();
                this.yInput.blur();
            }
        };
        this.xButton.onclick = this.yButton.onclick = () => {
            this.mapStore!.setDisplayCoordinateSystem(
                GeometryService.nextCoordinateSystem(this.mapStore!.displayCoordinateSystem)
            );
        };
        L.DomEvent.disableClickPropagation(container);
        autorun(() => this.updateCoordinates());
        return container;
    }
github nextzen / nextzen.js / src / js / components / hash.js View on Github external
_startMapEvents: function () {
    L.DomEvent.on(this._map, 'moveend', this._throttle(this._updateLatLng, this._throttleLimit), this);
    L.DomEvent.on(this._map, 'zoomend', this._throttle(this._updateZoom, this._throttleLimit), this);
  },
github w8r / leaflet-schematic / demo / js / editable.js View on Github external
onAdd: function (map) {
    var container = L.DomUtil.create('div', 'leaflet-control leaflet-bar'),
      link = L.DomUtil.create('a', '', container);
    var editTools = map.editTools;

    link.href = '#';
    link.title = 'Create a new ' + this.options.kind;
    link.innerHTML = this.options.html;
    L.DomEvent
      .on(link, 'click', L.DomEvent.stop)
      .on(link, 'click', function () {
        window.LAYER = editTools[this.options.callback].call(editTools, null, {
          renderer : this.options.renderer
        });
      }, this);

    return container;
  }
github dkocich / osm-pt-ngx-leaflet / public_src / services / map.service.ts View on Github external
public disableMouseEvent(elementId: string): void {
    const element = document.getElementById(elementId) as HTMLElement;
    if (element) {
      L.DomEvent.disableClickPropagation(element);
      L.DomEvent.disableScrollPropagation(element);
    }
  }
github perliedman / leaflet-routing-machine / src / itinerary.js View on Github external
collapseBtn: function(itinerary) {
				var collapseBtn = L.DomUtil.create('span', itinerary.options.collapseBtnClass);
				L.DomEvent.on(collapseBtn, 'click', itinerary._toggle, itinerary);
				itinerary._container.insertBefore(collapseBtn, itinerary._container.firstChild);
			},
			collapseBtnClass: 'leaflet-routing-collapse-btn'
github SuperMap / iClient-JavaScript / src / leaflet / overlay / vectortile / CanvasRenderer.js View on Github external
_onClick: function (e) {
        var point = this._map.mouseEventToLayerPoint(e).subtract(this.getOffset()), layer, clickedLayer;

        for (var id in this._layers) {
            layer = this._layers[id];
            if (layer.options.interactive && layer._containsPoint(point) && !this._map._draggableMoved(layer)) {
                clickedLayer = layer;
            }
        }
        if (clickedLayer) {
            L.DomEvent.stop(e);
            this._fireEvent([clickedLayer], e);
        }
    },