/
/
/
MAXBET ИГРОВОЙ КЛУБ ООО МАКСБЕТ-М
MAXBET ИГРОВОЙ КЛУБ ООО МАКСБЕТ-М
", {
// Переопределяем методы макета, чтобы выполнять дополнительные действия
// при построении и очистке макета.
build: function () {
// Вызываем родительский метод build.
ZoomLayout.superclass.build.call(this);
// Привязываем функции-обработчики к контексту и сохраняем ссылки
// на них, чтобы потом отписаться от событий.
this.zoomInCallback = ymaps.util.bind(this.zoomIn, this);
this.zoomOutCallback = ymaps.util.bind(this.zoomOut, this);
// Начинаем слушать клики на кнопках макета.
$('#zoom-in').bind('click', this.zoomInCallback);
$('#zoom-out').bind('click', this.zoomOutCallback);
setZoomButtonState(map.getZoom());
},
clear: function () {
// Снимаем обработчики кликов.
$('#zoom-in').unbind('click', this.zoomInCallback);
$('#zoom-out').unbind('click', this.zoomOutCallback);
// Вызываем родительский метод clear.
ZoomLayout.superclass.clear.call(this);
},
zoomIn: function () {
var map = this.getData().control.getMap();
if (map.getZoom() !== maxZoomIn) {
this.events.fire('zoomchange', {
oldZoom: map.getZoom(),
newZoom: map.getZoom() + 1
});
}
},
zoomOut: function () {
var map = this.getData().control.getMap();
if (map.getZoom() !== minZoomOut) {
this.events.fire('zoomchange', {
oldZoom: map.getZoom(),
newZoom: map.getZoom() - 1
});
}
}
});
var zoomControl = new ymaps.control.ZoomControl({ options: { layout: ZoomLayout } });
map.controls.add(zoomControl, {left: 30, top: 30});
map.events.add('boundschange', function(event) {
//if zoom changed
if (event.get('oldZoom') !== event.get('newZoom')) {
setZoomButtonState(event.get('newZoom'));
}
});
function setZoomButtonState(zoom) {
var $zoomInBtn = $('#zoom-in'),
$zoomOutBtn = $('#zoom-out');
$zoomInBtn.removeClass('disabled');
$zoomOutBtn.removeClass('disabled');
//disable zoomInBtn if max zoom in
if (zoom >= maxZoomIn) {
$zoomInBtn.addClass('disabled');
}
//disable zoomInBtn if max zoom out
if(zoom <= minZoomOut) {
$zoomOutBtn.addClass('disabled')
}
}
}