summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chimere/templatetags/chimere_tags.py11
-rw-r--r--chimere_example_project/templates/chimere/blocks/map.html2
2 files changed, 6 insertions, 7 deletions
diff --git a/chimere/templatetags/chimere_tags.py b/chimere/templatetags/chimere_tags.py
index 6f1f3a8..460a6f8 100644
--- a/chimere/templatetags/chimere_tags.py
+++ b/chimere/templatetags/chimere_tags.py
@@ -269,12 +269,13 @@ def map(context, map_id='map'):
context_data['checked_categories'] = [
s.pk for s in q_checked.filter(available=True).all()]
if area.restrict_to_extent:
+ min_x = min(area.upper_left_corner.x, area.lower_right_corner.x)
+ max_x = max(area.upper_left_corner.x, area.lower_right_corner.x)
+ min_y = min(area.upper_left_corner.y, area.lower_right_corner.y)
+ max_y = max(area.upper_left_corner.y, area.lower_right_corner.y)
context_data['restricted_extent'] = \
- "var bounds = new OpenLayers.Bounds();\n"\
- "bounds.extend(new OpenLayers.LonLat(%f, %f));\n"\
- "bounds.extend(new OpenLayers.LonLat(%f, %f));\n" % (
- area.upper_left_corner.x, area.upper_left_corner.y,
- area.lower_right_corner.x, area.lower_right_corner.y)
+ "var bounds = [{}, {}, {}, {}];\n".format(
+ min_x, min_y, max_x, max_y)
context_data['extra_map_def'] = area.extra_map_def or ''
context_data['subcat_layer'], c_cat = [], None
for subcat in subcat_layer.order_by('category__order', 'category').all():
diff --git a/chimere_example_project/templates/chimere/blocks/map.html b/chimere_example_project/templates/chimere/blocks/map.html
index aec1e9a..e3fef74 100644
--- a/chimere_example_project/templates/chimere/blocks/map.html
+++ b/chimere_example_project/templates/chimere/blocks/map.html
@@ -61,8 +61,6 @@ $(function(){
{% if p_routing_end_lon %}chimere_init_options["routing_end_lon"] = {{ p_routing_end_lon }};{% endif %}
{% if p_routing_end_lat %}chimere_init_options["routing_end_lat"] = {{ p_routing_end_lat }};{% endif %}
{% if p_routing_steps %}chimere_init_options["routing_steps_lonlat"] = [{{ p_routing_steps }}];{% endif %}
- //chimere_init_options["icon_offset"] = new OpenLayers.Pixel({{icon_offset_x}},
- // {{icon_offset_y}});
chimere_init_options["icon_offset"] = ({{icon_offset_x}}, {{icon_offset_y}});
chimere_init_options["dynamic_categories"] = {{ dynamic_categories }};
{% if p_display_submited %}chimere_init_options["display_submited"] = {{ p_display_submited }};{% endif %}