{I" class:ETI"BundledAsset;FI"logical_path;TI"maps/gmaps-radius.js;FI" pathname;TI"j/Users/austin/Sites/berlinmagic/magic_addresses/vendor/assets/javascripts/maps/gmaps-radius.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+/Í\TI" length;TiÙ I" digest;TI"%c8096f8bb06d6f04d1c5155b10897bdc;FI" source;TI"Ù (function() { var earthRadii; earthRadii = { mi: 3963.1676, km: 6378.1, ft: 20925524.9, mt: 6378100, "in": 251106299, yd: 6975174.98, fa: 3487587.49, na: 3443.89849, ch: 317053.408, rd: 1268213.63, fr: 31705.3408 }; $(function() { var circleDrawHandler, lat, long, map, polygonDestructionHandler; if ((typeof google !== "undefined" && google !== null) && jQuery("#location_map").length > 0) { lat = $('#location_map').attr("data-latitude"); long = $('#location_map').attr("data-longitude"); map = new google.maps.Map($('#location_map')[0], { zoom: 11, center: new google.maps.LatLng(lat, long), mapType: google.maps.MapTypeId.ROADMAP }); polygonDestructionHandler = function() { return this.setMap(null); }; this.circle; circleDrawHandler = (function(_this) { return function(e) { var radius, unitKey; unitKey = "mt"; radius = parseFloat($('#company_work_location_attributes_radius').val()); radius = (radius / earthRadii[unitKey]) * earthRadii['mt']; if (radius > 31000) { console.log("zoom .. " + radius + " > 31000"); map.setZoom(7); } else if (radius > 21000) { console.log("zoom .. " + radius + " > 21000"); map.setZoom(8); } else if (radius > 11000) { console.log("zoom .. " + radius + " > 11000"); map.setZoom(9); } else if (radius > 7000) { console.log("zoom .. " + radius + " > 7000"); map.setZoom(10); } else if (radius > 4000) { console.log("zoom .. " + radius + " > 4000"); map.setZoom(10); } else if (radius > 1500) { console.log("zoom .. " + radius + " > 1500"); map.setZoom(11); } else { console.log("zoom .. " + radius + " < 1500"); map.setZoom(13); } if (_this.circle) { google.maps.event.trigger(_this.circle, 'killCircle'); } _this.circle = new google.maps.Circle({ center: new google.maps.LatLng(lat, long), clickable: false, draggable: false, editable: false, map: map, radius: radius, fillColor: '#f23352', fillOpacity: 0.21, strokeColor: '#f23352', strokeOpacity: 0.75, strokeWeight: 1 }); google.maps.event.addListener(_this.circle, 'loadCircle', circleDrawHandler); return google.maps.event.addListener(_this.circle, 'killCircle', polygonDestructionHandler); }; })(this); google.maps.event.addListener(map, 'loadCircle', circleDrawHandler); circleDrawHandler(); return $("#company_work_location_attributes_radius").change(function() { return google.maps.event.trigger(map, 'loadCircle'); }); } }); }).call(this); ;TI"required_assets_digest;TI"%541bfb8a38086f5ddc01122f83d772bd;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F