本文整理汇总了TypeScript中leaflet.point函数的典型用法代码示例。如果您正苦于以下问题:TypeScript point函数的具体用法?TypeScript point怎么用?TypeScript point使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了point函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: icon
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);
};
示例2:
let latLngBounds: L.LatLngBounds;
latLngBounds = L.latLngBounds(latLng, latLng);
latLngBounds = L.latLngBounds(latLngLiteral, latLngLiteral);
latLngBounds = L.latLngBounds(latLngTuple, latLngTuple);
latLngBounds = L.latLngBounds(latLngBoundsLiteral);
latLngBounds = L.latLngBounds([latLngLiteral, latLngLiteral, latLngLiteral]);
latLngBounds = L.latLngBounds([latLng, latLng, latLng]);
latLngBounds = new L.LatLngBounds(latLng, latLng);
latLngBounds = new L.LatLngBounds(latLngLiteral, latLngLiteral);
latLngBounds = new L.LatLngBounds(latLngTuple, latLngTuple);
const pointTuple: L.PointTuple = [0, 0];
let point: L.Point;
point = L.point(12, 13);
point = L.point(12, 13, true);
point = L.point(pointTuple);
point = L.point({x: 12, y: 13});
point = new L.Point(12, 13);
point = new L.Point(12, 13, true);
let distance: number;
point.distanceTo(point);
point.distanceTo(pointTuple);
const transformation = new L.Transformation(1, 2, 3, 4);
point = transformation.transform(point);
point = transformation.transform(point, 2);
point = transformation.untransform(point);
示例3:
import * as L from 'leaflet';
import 'leaflet-label';
const map: L.Map = L.map('map-container');
let label: L.Label;
// Icon
const icon: L.Icon = new L.Icon({ labelAnchor: L.point(1, 1) });
// CircleMarker
let circleMarker: L.CircleMarker = new L.CircleMarker(new L.LatLng(0, 0), { labelAnchor: L.point(1, 1) });
circleMarker = circleMarker.bindLabel('test', {
className: 'thingy',
clickable: true,
direction: 'right',
noHide: false,
offset: new L.Point(0, 0),
opacity: 0.5,
zoomAnimation: true,
});
circleMarker.showLabel();
circleMarker.hideLabel();
circleMarker.setLabelNoHide(true);
circleMarker.updateLabelContent('test2');
label = circleMarker.getLabel();
circleMarker = circleMarker.unbindLabel();
// Marker
let marker = new L.Marker(new L.LatLng(0, 0));
示例4: getInnerIconStyle
const innerIconStyle = this.getInnerIconStyle(options);
if (options.isAlphaNumericIcon) {
return '<div style="' + innerIconStyle + '">' + options.text + "</div>";
}
let spinClass = "";
if (options.spin) {
spinClass = " fa-spin";
}
return '<i class="' + options.prefix + " " + options.icon + spinClass + '" style="' + innerIconStyle + '"></i>';
},
getInnerIconStyle(options) {
const innerAnchor = point(options.innerIconAnchor);
return "color:" + options.textColor + ";margin-top:" + innerAnchor.y + "px; margin-left:" + innerAnchor.x + "px;" + options.innerIconStyle;
},
_setIconStyles(iconDiv) {
const options = this.options;
const size = point(options.iconSize);
const anchor = point(options.iconAnchor);
iconDiv.className = "beautify-marker ";
if (options.iconShape) {
iconDiv.className += options.iconShape;
}