page.replace_html :sidebar_content, :partial => 'start'
page << <<EOJ
var browseBoxControl;
- var browseActive;
var browseMode = "auto";
var browseBounds;
var browseFeatureList;
OpenLayers.Feature.Vector.style['default'].cursor = "pointer";
function startBrowse() {
- browseActive = true;
+ map.dataLayer.active = true;
openSidebar({ onclose: stopBrowse });
sides: 4,
snapAngle: 90,
irregular: true,
- persist: true,
- callbacks: { done: endDrag }
+ persist: true
}
});
+ browseBoxControl.handler.callbacks.done = endDrag;
map.addControl(browseBoxControl);
map.events.register("moveend", map, showData);
}
function stopBrowse() {
- if (browseActive) {
- browseActive = false;
+ if (map.dataLayer.active) {
+ map.dataLayer.active = false;
if (browseSelectControl) {
browseSelectControl.destroy();
}
function customDataLoader(request) {
- if (browseActive) {
+ if (this.map.dataLayer.active) {
var doc = request.responseXML;
if (!doc || !doc.documentElement) {
var projected = bounds.clone().transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
var size = projected.getWidth() * projected.getHeight();
- if (size > #{APP_CONFIG['max_request_area']}) {
- setStatus(i18n("#{I18n.t('browse.start_rjs.unable_to_load_size', :max_bbox_size => APP_CONFIG['max_request_area'])}", { bbox_size: size }));
+ if (size > #{MAX_REQUEST_AREA}) {
+ setStatus(i18n("#{I18n.t('browse.start_rjs.unable_to_load_size', :max_bbox_size => MAX_REQUEST_AREA)}", { bbox_size: size }));
} else {
loadGML("/api/#{API_VERSION}/map?bbox=" + projected.toBBOX());
}
}
function dataLoaded() {
- if (browseActive) {
+ if (this.map.dataLayer.active) {
clearStatus();
-
+
browseObjectList = document.createElement("div")
var heading = document.createElement("p");