summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-11-18 11:38:56 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-11-18 11:38:56 +0100
commit301794426455e9c1b24b2e6b4d415d53b3cf32b7 (patch)
treece19a635c4d572add60c2688e4f0242954e64d4f
parent36ce27b2341edc9c9377f87c677be707582dc81f (diff)
downloadChimère-301794426455e9c1b24b2e6b4d415d53b3cf32b7.tar.bz2
Chimère-301794426455e9c1b24b2e6b4d415d53b3cf32b7.zip
ol3: manage restricted extent
-rw-r--r--chimere/static/chimere/js/jquery.chimere.js23
1 files changed, 17 insertions, 6 deletions
diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js
index f586e7f..5d17e89 100644
--- a/chimere/static/chimere/js/jquery.chimere.js
+++ b/chimere/static/chimere/js/jquery.chimere.js
@@ -346,12 +346,23 @@ function transformCoordToLonLat(coord) {
view_options['minZoom'] = settings.minZoom;
}
- /* OL3-deprecated
- if (settings.restricted_extent){
- settings.restricted_extent.transform(EPSG_DISPLAY_PROJECTION,
- EPSG_PROJECTION);
- map_options['restrictedExtent'] = settings.restricted_extent;
- }*/
+ if (settings.restricted_extent
+ && settings.restricted_extent.length == 4){
+ var extent = [
+ Math.round(settings.restricted_extent[0] * 1000) / 1000,
+ Math.round(settings.restricted_extent[1] * 1000) / 1000,
+ Math.round(settings.restricted_extent[2] * 1000) / 1000,
+ Math.round(settings.restricted_extent[3] * 1000) / 1000
+ ]
+ var point_1 = ol.proj.transform(
+ [extent[0], extent[1]], EPSG_DISPLAY_PROJECTION,
+ EPSG_PROJECTION);
+ var point_2 = ol.proj.transform(
+ [extent[2], extent[3]], EPSG_DISPLAY_PROJECTION,
+ EPSG_PROJECTION);
+ view_options['extent'] = [point_1[0], point_1[1],
+ point_2[0], point_2[1]]
+ }
$.each(settings.map_layers, function(idx, layer){
// property for permalink