Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
example = () => {
const myIcon = L.icon({
iconUrl: 'my-icon.png',
iconSize: L.point(20, 20),
iconAnchor: L.point(10, 10),
labelAnchor: L.point(6, 0) // as I want the label to appear 2px past the icon (10 + 2 - 6)
});
L.marker(L.latLng(-37.7772, 175.2606), {
icon: myIcon
}).bindLabel('Look revealing label!').addTo(map);
};
*/
this.map = map;
this.scene = new LeafletScene(map);
this._tweens = new TweenCollection();
this._tweensAreRunning = false;
this._selectionIndicatorTween = undefined;
this._selectionIndicatorIsAppearing = undefined;
this._pickedFeatures = undefined;
this._selectionIndicator = L.marker([0, 0], {
icon: L.divIcon({
className: '',
html: '<img alt="" height="50" width="50" src="' + selectionIndicatorUrl + '">',
iconSize: L.point(50, 50)
}),
clickable: false,
keyboard: false
});
this._selectionIndicator.addTo(this.map);
this._selectionIndicatorDomElement = this._selectionIndicator._icon.children[0];
this._dragboxcompleted = false;
this.scene.featureClicked.addEventListener(featurePicked.bind(undefined, this));
var that = this;
// if we receive dragboxend (see LeafletDragBox) and we are currently
// accepting a rectangle, then return the box as the picked feature
map.on('dragboxend', function(e) {
_keyToCellCoords: function (key) {
var kArr = key.split(':');
var x = parseInt(kArr[0], 10);
var y = parseInt(kArr[1], 10);
return L.point(x, y);
},
it("should be changed in Angular when changing in Angular", () => {
const val: Point = point(randomNumber(10, 1, 0), randomNumber(10, 1, 0));
icon.iconSize = val;
expect(icon.iconSize).to.equal(val);
});
it("should fire an event in Angular when changing in Angular", (done: Mocha.Done) => {
beforeEach(() => {
map = new MapComponent(
{nativeElement: document.createElement("div")},
new LayerGroupProvider(),
new MapProvider(),
);
(map as any)._size = point(100, 100);
(map as any)._pixelOrigin = point(50, 50);
control = new ScaleControlDirective({ ref: map });
});
L.DomEvent.on(img, 'load', function () {
var size = L.point([img.width, img.height]),
anchor = size && size.divideBy(2, true),
p = layer._point.subtract(anchor);
path.setAttribute('x', p.x);
path.setAttribute('y', p.y);
path.setAttribute('width', size.x + 'px');
path.setAttribute('height', size.y + 'px');
});
}
const createClusterCustomIcon = function (cluster) {
return L.divIcon({
html: `<div><span aria-label="${cluster.getChildCount()} projects">${cluster.getChildCount()}</span></div>`,
className: 'marker-cluster-custom marker-cluster marker-cluster-small',
iconSize: L.point(40, 40, true),
});
}
const markerClusterOptions = {
beforeEach(() => {
map = new MapComponent(
{nativeElement: document.createElement("div")},
new LayerGroupProvider(),
new MapProvider(),
);
(map as any)._size = point(100, 100);
(map as any)._pixelOrigin = point(50, 50);
layer = new WmsLayerDirective({ ref: map }, {} as any);
});
const createClusterCustomIcon = function (cluster) {
return L.divIcon({
html: `<span>${cluster.getChildCount()}</span>`,
className: 'marker-cluster-custom',
iconSize: L.point(40, 40, true),
});
};
import { bounds, point, Point } from 'leaflet';
import { computed, observable } from 'mobx';
import { CRS, MAX_ZOOM, PLACE_DOT_RADIUS_SCALE } from './config';
import Place from './Place';
import roundPoint from './utils/roundPoint';
import VisualisationStore from './VisualisationStore';
const roundPlaceCirclePoint = roundPoint(0.2);
class PlaceCircle {
readonly vis: VisualisationStore;
readonly place: Place;
@observable.ref
graphPoint: Point = point(0, 0);
constructor(vis: VisualisationStore, place: Place) {
this.vis = vis;
this.place = place;
}
@computed
get active() {
return this.vis.activeElement === this;
}
@computed
get highlight() {
return this.active || this.connectionLines.some(connectionLine => connectionLine.highlight);
}