mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-13 22:40:50 +08:00
Merge pull request #19388 from Delagen/master
[yandex-maps] initial version
This commit is contained in:
3039
types/yandex-maps/index.d.ts
vendored
Normal file
3039
types/yandex-maps/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
23
types/yandex-maps/tsconfig.json
Normal file
23
types/yandex-maps/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"yandex-maps-tests.ts"
|
||||
]
|
||||
}
|
||||
9
types/yandex-maps/tslint.json
Normal file
9
types/yandex-maps/tslint.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"array-type": false,
|
||||
"interface-name": false,
|
||||
"comment-format": false,
|
||||
"strict-export-declare-modifiers": false
|
||||
}
|
||||
}
|
||||
57
types/yandex-maps/yandex-maps-tests.ts
Normal file
57
types/yandex-maps/yandex-maps-tests.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
const defaultBehavior = ["drag", "scrollZoom", "dblClickZoom", "multiTouch", "rightMouseButtonMagnifier"];
|
||||
const element: HTMLDivElement = document.createElement("div");
|
||||
const map = new ymaps.Map(
|
||||
element,
|
||||
{
|
||||
behaviors: defaultBehavior,
|
||||
center: [55.76, 37.64],
|
||||
controls: [],
|
||||
type: "yandex#map",
|
||||
zoom: 10
|
||||
},
|
||||
{
|
||||
autoFitToViewport: "always"
|
||||
});
|
||||
|
||||
map.behaviors.disable(defaultBehavior);
|
||||
|
||||
map.events.add("click", () => {
|
||||
});
|
||||
|
||||
const balloonLayout = ymaps.templateLayoutFactory.createClass(
|
||||
"<div class=\"map-marker-balloon\"></div>",
|
||||
{
|
||||
build(this: ymaps.ILayout): void {
|
||||
(<ymaps.layout.templateBased.Base> (<any> this.constructor).superclass).build.call(this);
|
||||
this.getParentElement().children.item(0).children.item(0).appendChild((<any> this.getData()).properties.get("balloonContent"));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const mapMarker = new ymaps.Placemark(
|
||||
[55.76, 37.64],
|
||||
{
|
||||
balloonContent: "test",
|
||||
balloonAutoPan: true,
|
||||
balloonLayout,
|
||||
balloonPanelMaxMapArea: 0,
|
||||
iconLayout: "default#image",
|
||||
iconImageHref: "./test/icon.png",
|
||||
iconImageSize: [26, 26],
|
||||
iconImageOffset: [13, 13],
|
||||
hasBalloon: true,
|
||||
hasHint: false,
|
||||
hideIconOnBalloonOpen: true,
|
||||
openBalloonOnClick: false,
|
||||
zIndex: 1
|
||||
}
|
||||
);
|
||||
|
||||
mapMarker.events.add("click", (event: ymaps.Event) => {
|
||||
});
|
||||
|
||||
map.geoObjects.add(mapMarker);
|
||||
|
||||
map.setCenter((<ymaps.IPointGeometry> mapMarker.geometry).getCoordinates() || [55.76, 37.64]);
|
||||
|
||||
map.setZoom(13);
|
||||
Reference in New Issue
Block a user