since we can technically register events for any domelement, there is no reason this variable should be named 'div'. Change it to 'element' and update its use everywhere.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@866 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-07-04 11:57:18 +00:00
parent 994e00ad20
commit 10cbef9274
4 changed files with 15 additions and 15 deletions

View File

@@ -76,7 +76,7 @@ OpenLayers.Control.MouseToolbar.prototype =
buttonClick: function(evt) {
if (!Event.isLeftClick(evt)) return;
this.switchModeTo(evt.div.action);
this.switchModeTo(evt.element.action);
Event.stop(evt);
},

View File

@@ -23,7 +23,7 @@ OpenLayers.Events.prototype = {
object: null,
/** @type DOMElement: the DOM element receiving browser events */
div: null,
element: null,
/** @type Array: list of support application events */
eventTypes: null,
@@ -34,12 +34,12 @@ OpenLayers.Events.prototype = {
*
* @param {OpenLayers.Map} object The js object to which this Events object
* is being added
* @param {DOMElement} div A dom element to respond to browser events
* @param {DOMElement} element A dom element to respond to browser events
* @param {Array} eventTypes Array of custom application events
*/
initialize: function (object, div, eventTypes) {
initialize: function (object, element, eventTypes) {
this.object = object;
this.div = div;
this.element = element;
this.eventTypes = eventTypes;
this.listeners = new Object();
@@ -56,7 +56,7 @@ OpenLayers.Events.prototype = {
// if a dom element is specified, add a listeners list
// for browser events on the element and register them
if (div != null) {
if (element != null) {
for (var i = 0; i < this.BROWSER_EVENTS.length; i++) {
var eventType = this.BROWSER_EVENTS[i];
@@ -66,12 +66,12 @@ OpenLayers.Events.prototype = {
this.listeners[ eventType ] = new Array();
// use Prototype to register the event cross-browser
Event.observe(div, eventType,
Event.observe(element, eventType,
this.handleBrowserEvent.bindAsEventListener(this));
}
// disable dragstart in IE so that mousedown/move/up works normally
Event.observe(div, "dragstart", Event.stop);
Event.observe(element, "dragstart", Event.stop);
}
},
@@ -138,7 +138,7 @@ OpenLayers.Events.prototype = {
evt = new Object();
}
evt.object = this.object;
evt.div = this.div;
evt.element = this.element;
// execute all callbacks registered for specified type
var listeners = this.listeners[type];
@@ -177,12 +177,12 @@ OpenLayers.Events.prototype = {
* @type OpenLayers.Pixel
*/
getMousePosition: function (evt) {
if (!this.div.offsets) {
this.div.offsets = Position.page(this.div);
if (!this.element.offsets) {
this.element.offsets = Position.page(this.element);
}
return new OpenLayers.Pixel(
evt.clientX - this.div.offsets[0],
evt.clientY - this.div.offsets[1]);
evt.clientX - this.element.offsets[0],
evt.clientY - this.element.offsets[1]);
},
/** @final @type String */

View File

@@ -368,7 +368,7 @@ OpenLayers.Map.prototype = {
var newSize = this.getCurrentSize();
if (!newSize.equals(this.getSize())) {
this.events.div.offsets = null;
this.events.element.offsets = null;
this.size = newSize;
}
},

View File

@@ -12,7 +12,7 @@
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( events.div instanceof HTMLDivElement, "events.div isa HTMLDivElement" );
t.ok( events.element instanceof HTMLDivElement, "events.element isa HTMLDivElement" );
t.ok( events.object === obj, "events.object is the object we passed" );
var builtin = OpenLayers.Events.prototype.BROWSER_EVENTS;