patch to make sure main openlayers map div has neither padding nor margin. done via css thanks to tim's fabulous new class manip patch. r=cr5 (Closes #1179)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@7584 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2008-07-29 14:52:48 +00:00
parent 357d65955a
commit 2fb730674a
4 changed files with 17 additions and 5 deletions

View File

@@ -406,7 +406,6 @@ OpenLayers.Events = OpenLayers.Class({
initialize: function (object, element, eventTypes, fallThrough) { initialize: function (object, element, eventTypes, fallThrough) {
this.object = object; this.object = object;
this.element = element; this.element = element;
this.eventTypes = eventTypes;
this.fallThrough = fallThrough; this.fallThrough = fallThrough;
this.listeners = {}; this.listeners = {};
@@ -416,11 +415,13 @@ OpenLayers.Events = OpenLayers.Class({
this.handleBrowserEvent, this this.handleBrowserEvent, this
); );
this.eventTypes = [];
// if eventTypes is specified, create a listeners list for each // if eventTypes is specified, create a listeners list for each
// custom application event. // custom application event.
if (this.eventTypes != null) { if (eventTypes != null) {
for (var i = 0; i < this.eventTypes.length; i++) { for (var i = 0; i < eventTypes.length; i++) {
this.addEventType(this.eventTypes[i]); this.addEventType(eventTypes[i]);
} }
} }
@@ -454,10 +455,13 @@ OpenLayers.Events = OpenLayers.Class({
* *
* Parameters: * Parameters:
* eventName - {String} * eventName - {String}
* dontAddMe - {Boolean}
*/ */
addEventType: function(eventName) { addEventType: function(eventName) {
if (!this.listeners[eventName]) { if (!this.listeners[eventName]) {
this.listeners[eventName] = []; this.listeners[eventName] = [];
this.eventTypes.push(eventName);
} }
}, },

View File

@@ -404,6 +404,7 @@ OpenLayers.Map = OpenLayers.Class({
this.id = OpenLayers.Util.createUniqueID("OpenLayers.Map_"); this.id = OpenLayers.Util.createUniqueID("OpenLayers.Map_");
this.div = OpenLayers.Util.getElement(div); this.div = OpenLayers.Util.getElement(div);
OpenLayers.Element.addClass(this.div, 'olMap');
// the viewPortDiv is the outermost div we modify // the viewPortDiv is the outermost div we modify
var id = this.div.id + "_OpenLayers_ViewPort"; var id = this.div.id + "_OpenLayers_ViewPort";

View File

@@ -7,7 +7,7 @@
var map; var map;
function test_Map_constructor (t) { function test_Map_constructor (t) {
t.plan( 10 ); t.plan( 11 );
map = new OpenLayers.Map('map'); map = new OpenLayers.Map('map');
var baseLayer = new OpenLayers.Layer.WMS("Test Layer", var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
@@ -15,6 +15,8 @@
{map: "/mapdata/vmap_wms.map", layers: "basic"}); {map: "/mapdata/vmap_wms.map", layers: "basic"});
map.addLayer(baseLayer); map.addLayer(baseLayer);
t.ok( OpenLayers.Element.hasClass(map.div, "olMap"), "Map div has olMap class");
t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map returns object" ); t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map returns object" );
if (!isMozilla) { if (!isMozilla) {
t.ok( true, "skipping element test outside of Mozilla"); t.ok( true, "skipping element test outside of Mozilla");

View File

@@ -1,3 +1,8 @@
div.olMap {
padding: 0px!important;
margin: 0px!important;
}
div.olMapViewport { div.olMapViewport {
text-align: left; text-align: left;
} }