當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript leaflet.point函數代碼示例

本文整理匯總了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);
};
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:11,代碼來源:leaflet-label-tests.ts

示例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);
開發者ID:Igorbek,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:leaflet-tests.ts

示例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));
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:leaflet-label-tests.ts

示例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;
        }
開發者ID:GordonSmith,項目名稱:Visualization,代碼行數:30,代碼來源:BeautifyIcon.ts


注:本文中的leaflet.point函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。