Skip to content

Commit

Permalink
Fix zoom button
Browse files Browse the repository at this point in the history
  • Loading branch information
pinglese-adt-li committed Feb 5, 2024
1 parent b4e4b56 commit e7e0746
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions js/ol-wfs-t.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,15 @@ $('button').click(function () {
});

$('#btnZoomIn').on('click', function () {
let view = map.getView();
let newResolution = view.constrainResolution(view.getResolution(), 1);
view.setResolution(newResolution);
map.getView().animate({
zoom: map.getView().getZoom() + 1,
duration: 250
})
});

$('#btnZoomOut').on('click', function () {
let view = map.getView();
let newResolution = view.constrainResolution(view.getResolution(), -1);
view.setResolution(newResolution);
map.getView().animate({
zoom: map.getView().getZoom() - 1,
duration: 250
})
});

0 comments on commit e7e0746

Please sign in to comment.