[OpenLayers-Commits] r4225 - in trunk/openlayers: lib/OpenLayers lib/OpenLayers/Layer tests tests/Layer
commits at openlayers.org
commits at openlayers.org
Tue Sep 11 21:58:29 EDT 2007
Author: crschmidt
Date: 2007-09-11 21:58:27 -0400 (Tue, 11 Sep 2007)
New Revision: 4225
Added:
trunk/openlayers/tests/data_Layer_Text_textfile_overflow.txt
Modified:
trunk/openlayers/lib/OpenLayers/Feature.js
trunk/openlayers/lib/OpenLayers/Layer/Text.js
trunk/openlayers/tests/Layer/test_Text.html
trunk/openlayers/tests/test_Feature.html
Log:
Adding Scroll Bars in TextFile Popup Windows via Layer.Text layer. (Closes #834)
Modified: trunk/openlayers/lib/OpenLayers/Feature.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Feature.js 2007-09-12 01:51:46 UTC (rev 4224)
+++ trunk/openlayers/lib/OpenLayers/Feature.js 2007-09-12 01:58:27 UTC (rev 4225)
@@ -185,6 +185,11 @@
this.data.popupContentHTML,
anchor,
closeBox);
+
+ if (this.data.overflow != null) {
+ this.popup.contentDiv.style.overflow = this.data.overflow;
+ }
+
this.popup.feature = this;
}
return this.popup;
Modified: trunk/openlayers/lib/OpenLayers/Layer/Text.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/Text.js 2007-09-12 01:51:46 UTC (rev 4224)
+++ trunk/openlayers/lib/OpenLayers/Layer/Text.js 2007-09-12 01:58:27 UTC (rev 4225)
@@ -84,7 +84,7 @@
var vals = currLine.split('\t');
var location = new OpenLayers.LonLat(0,0);
var title; var url;
- var icon, iconSize, iconOffset;
+ var icon, iconSize, iconOffset, overflow;
var set = false;
for (var valIndex = 0; valIndex < vals.length; valIndex++) {
if (vals[valIndex]) {
@@ -116,7 +116,9 @@
title = vals[valIndex];
} else if (columns[valIndex] == 'description') {
description = vals[valIndex];
- }
+ } else if (columns[valIndex] == 'overflow') {
+ overflow = vals[valIndex];
+ }
}
}
if (set) {
@@ -139,6 +141,9 @@
if ((title != null) && (description != null)) {
data['popupContentHTML'] = '<h2>'+title+'</h2><p>'+description+'</p>';
}
+
+ data['overflow'] = overflow || "auto";
+
var feature = new OpenLayers.Feature(this, location, data);
this.features.push(feature);
var marker = feature.createMarker();
Modified: trunk/openlayers/tests/Layer/test_Text.html
===================================================================
--- trunk/openlayers/tests/Layer/test_Text.html 2007-09-12 01:51:46 UTC (rev 4224)
+++ trunk/openlayers/tests/Layer/test_Text.html 2007-09-12 01:58:27 UTC (rev 4225)
@@ -8,11 +8,13 @@
var datafile = "./data_Layer_Text_textfile.txt";
var datafile2 = "./data_Layer_Text_textfile_2.txt";
+ var datafile_overflow = "./data_Layer_Text_textfile_overflow.txt";
// if this test is running in IE, different rules apply
if (isMSIE) {
datafile = "." + datafile;
datafile2 = "." + datafile2;
+ datafile_overflow = "." + datafile_overflow;
}
function test_01_Layer_Text_constructor (t) {
@@ -56,7 +58,7 @@
});;
}
function test_03_Layer_Text_events (t) {
- t.plan( 4 );
+ t.plan( 5 );
layer = new OpenLayers.Layer.Text('Test Layer', { location: datafile2 });
var map = new OpenLayers.Map('map');
var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
@@ -73,8 +75,29 @@
t.eq(map.popups.length, 1, "Popup opened correctly");
layer.markers[1].events.triggerEvent('click', event);
t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly");
+ t.eq(map.popups[0].contentDiv.style.overflow,"auto", "default Popup overflow correct");
});
}
+ function test_03_Layer_Text_overflow (t) {
+ t.plan( 4 );
+ layer = new OpenLayers.Layer.Text('Test Layer', { location: datafile_overflow });
+ var map = new OpenLayers.Map('map');
+ var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
+ "http://octo.metacarta.com/cgi-bin/mapserv?",
+ {map: "/mapdata/vmap_wms.map", layers: "basic"});
+ map.addLayer(baseLayer);
+ map.addLayer(layer);
+ map.setCenter(new OpenLayers.LonLat(0,0),0);
+ var event = {};
+ t.delay_call( 1, function() {
+ layer.markers[0].events.triggerEvent('click', event);
+ t.eq(map.popups.length, 1, "Popup opened correctly");
+ t.eq(map.popups[0].contentDiv.style.overflow,"auto", "Popup overflow read from file");
+ layer.markers[1].events.triggerEvent('click', event);
+ t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly");
+ t.eq(map.popups[0].contentDiv.style.overflow,"hidden", "Popup overflow read from file");
+ });
+ }
function test_04_Layer_Text_events_nopopups (t) {
t.plan( 4 );
layer = new OpenLayers.Layer.Text('Test Layer', { location: datafile });
Added: trunk/openlayers/tests/data_Layer_Text_textfile_overflow.txt
===================================================================
--- trunk/openlayers/tests/data_Layer_Text_textfile_overflow.txt (rev 0)
+++ trunk/openlayers/tests/data_Layer_Text_textfile_overflow.txt 2007-09-12 01:58:27 UTC (rev 4225)
@@ -0,0 +1,3 @@
+overflow point title description image
+auto 10,20 a b http://boston.openguides.org/markers/ORANGE.png
+hidden 15,25 c d http://boston.openguides.org/markers/ORANGE.png
Modified: trunk/openlayers/tests/test_Feature.html
===================================================================
--- trunk/openlayers/tests/test_Feature.html 2007-09-12 01:51:46 UTC (rev 4224)
+++ trunk/openlayers/tests/test_Feature.html 2007-09-12 01:58:27 UTC (rev 4225)
@@ -28,6 +28,21 @@
t.ok( feature.popupClass == OpenLayers.Popup.AnchoredBubble, "default popupClass is AnchoredBubble");
}
+ function test_02_Feature_createPopup (t) {
+ t.plan(1);
+ var layer = {};
+ var lonlat = new OpenLayers.LonLat(2,1);
+ var iconURL = 'http://boston.openguides.org/features/ORANGE.png';
+ var iconSize = new OpenLayers.Size(12, 17);
+ var data = { iconURL: iconURL,
+ iconSize: iconSize,
+ 'overflow':'auto'
+ };
+
+ feature = new OpenLayers.Feature(layer, lonlat, data);
+ popup = feature.createPopup();
+ t.eq(popup.contentDiv.style.overflow, "auto", 'overflow on popup is correct');
+ }
function test_02_Feature_createMarker (t) {
t.plan(1);
t.ok(true);
More information about the Commits
mailing list