Добрый день. Решил сделать кнопку "Домой", которая устанавливает по координатам и зуму карту.
Сделал метод в app/gis-webtoolkit/GIS WebToolKit SE/debug/source/handlers.js
home: function(event) { if (!this.map) {
return false;
}
const mapPoint = new GeoPoint( 37.64109072380669, 55.76864557331052 , 0, this.map.ProjectionId ).toMapPoint();
this.map.setViewport(mapPoint);
var zoom = 7;
var render = this.map.scaleManager,
ratio = this.map.getZoomingRatio(zoom);
if (this.map.scaleManager.timer) {
clearTimeout(this.map.scaleManager.timer);
this.map.scaleManager.timer = false;
}
// обновить карту
this.map.scaleManager.timer = window.setTimeout(function() {
render.map.handlers.lastWheelScalingEventTime = 0;
render.refreshMap();
return;
},
800);
// выполнить масштабирование
this.map.scaleManager.zoomAnimate(ratio, null, event.timeStamp);
return false;
},
В таком случае устанавливается координаты и масштаб. Но по второму нажатию масштаб меняется. Просьба подсказать, как сделать правильно
Сделал метод в app/gis-webtoolkit/GIS WebToolKit SE/debug/source/handlers.js
home: function(event) { if (!this.map) {
return false;
}
const mapPoint = new GeoPoint( 37.64109072380669, 55.76864557331052 , 0, this.map.ProjectionId ).toMapPoint();
this.map.setViewport(mapPoint);
var zoom = 7;
var render = this.map.scaleManager,
ratio = this.map.getZoomingRatio(zoom);
if (this.map.scaleManager.timer) {
clearTimeout(this.map.scaleManager.timer);
this.map.scaleManager.timer = false;
}
// обновить карту
this.map.scaleManager.timer = window.setTimeout(function() {
render.map.handlers.lastWheelScalingEventTime = 0;
render.refreshMap();
return;
},
800);
// выполнить масштабирование
this.map.scaleManager.zoomAnimate(ratio, null, event.timeStamp);
return false;
},
В таком случае устанавливается координаты и масштаб. Но по второму нажатию масштаб меняется. Просьба подсказать, как сделать правильно