Give ReglarPolygon handler a layerOptions config option. p=zanchin, r=me (closes #2755)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10645 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -55,6 +55,12 @@ OpenLayers.Handler.RegularPolygon = OpenLayers.Class(OpenLayers.Handler.Drag, {
|
||||
*/
|
||||
snapToggle: 'shiftKey',
|
||||
|
||||
/**
|
||||
* Property: layerOptions
|
||||
* {Object} Any optional properties to be set on the sketch layer.
|
||||
*/
|
||||
layerOptions: null,
|
||||
|
||||
/**
|
||||
* APIProperty: persist
|
||||
* {Boolean} Leave the feature rendered until clear is called. Default
|
||||
@@ -130,7 +136,9 @@ OpenLayers.Handler.RegularPolygon = OpenLayers.Class(OpenLayers.Handler.Drag, {
|
||||
* cancel callback will receive a geometry.
|
||||
*/
|
||||
initialize: function(control, callbacks, options) {
|
||||
if(!(options && options.layerOptions && options.layerOptions.styleMap)) {
|
||||
this.style = OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'], {});
|
||||
}
|
||||
|
||||
OpenLayers.Handler.prototype.initialize.apply(this,
|
||||
[control, callbacks, options]);
|
||||
@@ -159,14 +167,14 @@ OpenLayers.Handler.RegularPolygon = OpenLayers.Class(OpenLayers.Handler.Drag, {
|
||||
var activated = false;
|
||||
if(OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
|
||||
// create temporary vector layer for rendering geometry sketch
|
||||
var options = {
|
||||
var options = OpenLayers.Util.extend({
|
||||
displayInLayerSwitcher: false,
|
||||
// indicate that the temp vector layer will never be out of range
|
||||
// without this, resolution properties must be specified at the
|
||||
// map-level for this temporary layer to init its resolutions
|
||||
// correctly
|
||||
calculateInRange: OpenLayers.Function.True
|
||||
};
|
||||
}, this.layerOptions);
|
||||
this.layer = new OpenLayers.Layer.Vector(this.CLASS_NAME, options);
|
||||
this.map.addLayer(this.layer);
|
||||
activated = true;
|
||||
|
||||
Reference in New Issue
Block a user