[OpenLayers-Dev] my first control
toni hernández
tonidelacalle at gmail.com
Tue Feb 24 10:54:31 EST 2009
hi,
I am trying to create a new control called parallelLine.
When I activate the control I get this error in Openlayers.js line 276
this.events has no properties
[Break on this error]
this.active=true;this.events.triggerEvent("activate");return
true;},deactivate:f...
What am I missing? do I need to create an events variable? Isn't it expanded
from control class?
This is part of the code of my control (created based on ModifyFeature).
OpenLayers.Control.ParallelLine = OpenLayers.Class(OpenLayers.Control, {
geometryTypes: null,
clickout: true,
toggle: true,
layer: null,
feature: null,
selectControl: null,
handlers: null,
initialize: function(layer, options) {
this.layer = layer;
var control = this;
// configure the select control
var selectOptions = {
geometryTypes: this.geometryTypes,
multiple: false,
hover: true,
clickout: this.clickout,
toggle: this.toggle
};
this.selectControl = new OpenLayers.Control.SelectFeature(
layer, selectOptions
);
this.layer.events.on({
"beforefeatureselected": this.beforeSelectFeature,
"featureselected": this.selectFeature,
"featureunselected": this.unselectFeature,
scope: this
});
// Regiter the events (sigte)
this.layer.events.register("mousemove", this, this.mmove );
this.layer.events.register("mousedown", this, this.mdown );
// configure the keyboard handler
var keyboardOptions = {
keydown: this.handleKeypress
};
this.handlers = {
keyboard: new OpenLayers.Handler.Keyboard(this, keyboardOptions)
};
}
....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20090224/f75a7d80/attachment.html
More information about the Dev
mailing list