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:
@@ -76,7 +76,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
|||||||
|
|
||||||
buttonClick: function(evt) {
|
buttonClick: function(evt) {
|
||||||
if (!Event.isLeftClick(evt)) return;
|
if (!Event.isLeftClick(evt)) return;
|
||||||
this.switchModeTo(evt.div.action);
|
this.switchModeTo(evt.element.action);
|
||||||
Event.stop(evt);
|
Event.stop(evt);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -23,7 +23,7 @@ OpenLayers.Events.prototype = {
|
|||||||
object: null,
|
object: null,
|
||||||
|
|
||||||
/** @type DOMElement: the DOM element receiving browser events */
|
/** @type DOMElement: the DOM element receiving browser events */
|
||||||
div: null,
|
element: null,
|
||||||
|
|
||||||
/** @type Array: list of support application events */
|
/** @type Array: list of support application events */
|
||||||
eventTypes: null,
|
eventTypes: null,
|
||||||
@@ -34,12 +34,12 @@ OpenLayers.Events.prototype = {
|
|||||||
*
|
*
|
||||||
* @param {OpenLayers.Map} object The js object to which this Events object
|
* @param {OpenLayers.Map} object The js object to which this Events object
|
||||||
* is being added
|
* 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
|
* @param {Array} eventTypes Array of custom application events
|
||||||
*/
|
*/
|
||||||
initialize: function (object, div, eventTypes) {
|
initialize: function (object, element, eventTypes) {
|
||||||
this.object = object;
|
this.object = object;
|
||||||
this.div = div;
|
this.element = element;
|
||||||
this.eventTypes = eventTypes;
|
this.eventTypes = eventTypes;
|
||||||
|
|
||||||
this.listeners = new Object();
|
this.listeners = new Object();
|
||||||
@@ -56,7 +56,7 @@ OpenLayers.Events.prototype = {
|
|||||||
|
|
||||||
// if a dom element is specified, add a listeners list
|
// if a dom element is specified, add a listeners list
|
||||||
// for browser events on the element and register them
|
// 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++) {
|
for (var i = 0; i < this.BROWSER_EVENTS.length; i++) {
|
||||||
var eventType = this.BROWSER_EVENTS[i];
|
var eventType = this.BROWSER_EVENTS[i];
|
||||||
@@ -66,12 +66,12 @@ OpenLayers.Events.prototype = {
|
|||||||
this.listeners[ eventType ] = new Array();
|
this.listeners[ eventType ] = new Array();
|
||||||
|
|
||||||
// use Prototype to register the event cross-browser
|
// use Prototype to register the event cross-browser
|
||||||
Event.observe(div, eventType,
|
Event.observe(element, eventType,
|
||||||
this.handleBrowserEvent.bindAsEventListener(this));
|
this.handleBrowserEvent.bindAsEventListener(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable dragstart in IE so that mousedown/move/up works normally
|
// 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 = new Object();
|
||||||
}
|
}
|
||||||
evt.object = this.object;
|
evt.object = this.object;
|
||||||
evt.div = this.div;
|
evt.element = this.element;
|
||||||
|
|
||||||
// execute all callbacks registered for specified type
|
// execute all callbacks registered for specified type
|
||||||
var listeners = this.listeners[type];
|
var listeners = this.listeners[type];
|
||||||
@@ -177,12 +177,12 @@ OpenLayers.Events.prototype = {
|
|||||||
* @type OpenLayers.Pixel
|
* @type OpenLayers.Pixel
|
||||||
*/
|
*/
|
||||||
getMousePosition: function (evt) {
|
getMousePosition: function (evt) {
|
||||||
if (!this.div.offsets) {
|
if (!this.element.offsets) {
|
||||||
this.div.offsets = Position.page(this.div);
|
this.element.offsets = Position.page(this.element);
|
||||||
}
|
}
|
||||||
return new OpenLayers.Pixel(
|
return new OpenLayers.Pixel(
|
||||||
evt.clientX - this.div.offsets[0],
|
evt.clientX - this.element.offsets[0],
|
||||||
evt.clientY - this.div.offsets[1]);
|
evt.clientY - this.element.offsets[1]);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ OpenLayers.Map.prototype = {
|
|||||||
var newSize = this.getCurrentSize();
|
var newSize = this.getCurrentSize();
|
||||||
|
|
||||||
if (!newSize.equals(this.getSize())) {
|
if (!newSize.equals(this.getSize())) {
|
||||||
this.events.div.offsets = null;
|
this.events.element.offsets = null;
|
||||||
this.size = newSize;
|
this.size = newSize;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
if (!isMozilla)
|
if (!isMozilla)
|
||||||
t.ok( true, "skipping element test outside of Mozilla");
|
t.ok( true, "skipping element test outside of Mozilla");
|
||||||
else
|
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" );
|
t.ok( events.object === obj, "events.object is the object we passed" );
|
||||||
|
|
||||||
var builtin = OpenLayers.Events.prototype.BROWSER_EVENTS;
|
var builtin = OpenLayers.Events.prototype.BROWSER_EVENTS;
|
||||||
|
|||||||
Reference in New Issue
Block a user