// This function might be passed either an OpenLayers.LonLat (so has // lon and lat) or an OpenLayers.Geometry.Point (so has x and y) function fixmystreet_update_pin(lonlat) { lonlat.transform( fixmystreet.map.getProjectionObject(), new OpenLayers.Projection("EPSG:4326") ); document.getElementById('fixmystreet.latitude').value = lonlat.lat || lonlat.y; document.getElementById('fixmystreet.longitude').value = lonlat.lon || lonlat.x; } function fixmystreet_activate_drag() { fixmystreet.drag = new OpenLayers.Control.DragFeature( fixmystreet.markers, { onComplete: function(feature, e) { fixmystreet_update_pin( feature.geometry.clone() ); } } ); fixmystreet.map.addControl( fixmystreet.drag ); fixmystreet.drag.activate(); } function fms_markers_list(pins, transform) { var markers = []; for (var i=0; i 0 ) { $('#form_category').change( form_category_onchange ); } }); $('#side-form').show(); /* For some reason on IOS5 if you use the jQuery show method it * doesn't display the JS validation error messages unless you do this * or you cause a screen redraw by changing the phone orientation. * NB: This has to happen after the call to show() */ if ( navigator.userAgent.match(/like Mac OS X/i)) { document.getElementById('side-form').style.display = 'block'; } $('#side').hide(); $('#sub_map_links').hide(); heightFix('#report-a-problem-sidebar:visible', '.content', 26); // If we clicked the map somewhere inconvenient var sidebar = $('#report-a-problem-sidebar'); if (sidebar.css('position') == 'absolute') { var w = sidebar.width(), h = sidebar.height(), o = sidebar.offset(); if (e.xy.y <= o.top) { // top of the page, pin hidden by header lonlat.transform( new OpenLayers.Projection("EPSG:4326"), fixmystreet.map.getProjectionObject() ); fixmystreet.map.setCenter(lonlat, fixmystreet.map.getZoom(), true, true); } else if (e.xy.x >= o.left && e.xy.x <= o.left + w + 24 && e.xy.y >= o.top && e.xy.y <= o.top + h + 64) { // underneath where the new sidebar will appear fixmystreet.map.pan(-w, 0, { animate: false }); } } if (fixmystreet.page == 'mobile-full-map') { lonlat.transform( new OpenLayers.Projection("EPSG:4326"), fixmystreet.map.getProjectionObject() ); fixmystreet.map.setCenter(lonlat); } fixmystreet.page = 'new'; location.hash = 'report'; } });