-
Notifications
You must be signed in to change notification settings - Fork 287
/
Yandex.addon.Fullscreen.js
30 lines (29 loc) · 1.18 KB
/
Yandex.addon.Fullscreen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// enable standard Yandex map controls/behaviors in fullscreen
// Notes:
// - markers and other overlays are not visible in this mode
// - valid apikey required for correct work of all functions
// https://tech.yandex.com/maps/jsapi/doc/2.1/quick-start/index-docpage/
L.Yandex.addInitHook('on', 'load', function () {
var ymap = this._yandex;
var behaviors = ['drag','dblClickZoom', 'scrollZoom', L.Browser.mobile ? 'multiTouch' : 'rightMouseButtonMagnifier'];
ymap.container.events
.add('fullscreenenter',function () {
ymap.controls
.add('mediumMapDefaultSet')
.add('routeButtonControl');
ymap.controls.get('fullscreenControl').state.set('selected',true);
ymap.controls.get('searchControl').options.set('size','small');
ymap.controls.get('typeSelector').options.set('size','small');
//ymap.controls.get('zoomControl').options.set('size','small');
ymap.behaviors.enable(behaviors);
ymap.options.set('balloonAutoPan',true);
})
.add('fullscreenexit',function () {
ymap.controls
.remove('mediumMapDefaultSet')
.remove('routeButtonControl');
ymap.behaviors.disable(behaviors);
ymap.options.set('balloonAutoPan',false);
this._resyncView();
},this);
});