diff --git a/frontend-js/src/main/js/map/AbstractCustomMap.js b/frontend-js/src/main/js/map/AbstractCustomMap.js index 8aa7acaf55d25db970b0e3a0188b9ec63ba6a20d..0df275877126c79c280af4f7f8d3f71d993aa33a 100644 --- a/frontend-js/src/main/js/map/AbstractCustomMap.js +++ b/frontend-js/src/main/js/map/AbstractCustomMap.js @@ -1078,6 +1078,23 @@ AbstractCustomMap.prototype.getCenter = function () { return this.fromLatLngToPoint(coordinates); }; +AbstractCustomMap.prototype.getBounds = function () { + var self = this; + var bounds = self.getGoogleMap().getBounds(); + var ne = bounds.getNorthEast(); + var sw = bounds.getSouthWest(); + + var result = { + p1: this.fromLatLngToPoint(ne), + p2: this.fromLatLngToPoint(sw) + }; + if (result.p2.x > result.p1.x) { + result.p2.x -= 360 * self.pixelsPerLonDegree_*self.zoomFactor; + } + return result; +}; + + /** * Sets zoom level for google maps. * diff --git a/frontend-js/src/main/js/plugin/MinervaPluginProxy.js b/frontend-js/src/main/js/plugin/MinervaPluginProxy.js index 0130243f842f195ea98314d08f71e1335c561cae..92111fa47fcaae20675804ee53c7b149a95b69dd 100644 --- a/frontend-js/src/main/js/plugin/MinervaPluginProxy.js +++ b/frontend-js/src/main/js/plugin/MinervaPluginProxy.js @@ -414,6 +414,13 @@ function createProjectMap(options) { } return submap.getCenter(); }, + getBounds: function (params) { + var submap = map.getSubmapById(params.modelId); + if (submap === null) { + throw new Error("Unknown modelId: " + params.modelId); + } + return submap.getBounds(); + }, fitBounds: function (params) { var submap = map.getSubmapById(params.modelId); if (submap === null) {