Allow string to be passed as ol.interaction.Draw type
This commit is contained in:
@@ -54,7 +54,7 @@ var typeSelect = document.getElementById('type');
|
||||
function addInteractions() {
|
||||
draw = new ol.interaction.Draw({
|
||||
source: source,
|
||||
type: /** @type {ol.geom.GeometryType} */ (typeSelect.value)
|
||||
type: typeSelect.value
|
||||
});
|
||||
map.addInteraction(draw);
|
||||
snap = new ol.interaction.Snap({source: source});
|
||||
|
||||
@@ -33,7 +33,7 @@ function addInteraction() {
|
||||
if (value !== 'None') {
|
||||
draw = new ol.interaction.Draw({
|
||||
source: source,
|
||||
type: /** @type {ol.geom.GeometryType} */ (typeSelect.value)
|
||||
type: typeSelect.value
|
||||
});
|
||||
map.addInteraction(draw);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ function addInteraction() {
|
||||
if (value !== 'None') {
|
||||
draw = new ol.interaction.Draw({
|
||||
source: source,
|
||||
type: /** @type {ol.geom.GeometryType} */ (typeSelect.value),
|
||||
type: typeSelect.value,
|
||||
freehand: true
|
||||
});
|
||||
map.addInteraction(draw);
|
||||
|
||||
@@ -67,7 +67,7 @@ function addInteraction() {
|
||||
}
|
||||
draw = new ol.interaction.Draw({
|
||||
source: source,
|
||||
type: /** @type {ol.geom.GeometryType} */ (value),
|
||||
type: value,
|
||||
geometryFunction: geometryFunction
|
||||
});
|
||||
map.addInteraction(draw);
|
||||
|
||||
@@ -62,5 +62,5 @@ var map = new ol.Map({
|
||||
|
||||
map.addInteraction(new ol.interaction.Draw({
|
||||
source: source,
|
||||
type: /** @type {ol.geom.GeometryType} */ ('LineString')
|
||||
type: 'LineString'
|
||||
}));
|
||||
|
||||
@@ -179,7 +179,7 @@ function addInteraction() {
|
||||
var type = (typeSelect.value == 'area' ? 'Polygon' : 'LineString');
|
||||
draw = new ol.interaction.Draw({
|
||||
source: source,
|
||||
type: /** @type {ol.geom.GeometryType} */ (type),
|
||||
type: type,
|
||||
style: new ol.style.Style({
|
||||
fill: new ol.style.Fill({
|
||||
color: 'rgba(255, 255, 255, 0.2)'
|
||||
|
||||
@@ -86,19 +86,19 @@ var Draw = {
|
||||
},
|
||||
Point: new ol.interaction.Draw({
|
||||
source: vector.getSource(),
|
||||
type: /** @type {ol.geom.GeometryType} */ ('Point')
|
||||
type: 'Point'
|
||||
}),
|
||||
LineString: new ol.interaction.Draw({
|
||||
source: vector.getSource(),
|
||||
type: /** @type {ol.geom.GeometryType} */ ('LineString')
|
||||
type: 'LineString'
|
||||
}),
|
||||
Polygon: new ol.interaction.Draw({
|
||||
source: vector.getSource(),
|
||||
type: /** @type {ol.geom.GeometryType} */ ('Polygon')
|
||||
type: 'Polygon'
|
||||
}),
|
||||
Circle: new ol.interaction.Draw({
|
||||
source: vector.getSource(),
|
||||
type: /** @type {ol.geom.GeometryType} */ ('Circle')
|
||||
type: 'Circle'
|
||||
}),
|
||||
getActive: function() {
|
||||
return this.activeType ? this[this.activeType].getActive() : false;
|
||||
|
||||
@@ -64,7 +64,7 @@ var raster = new ol.layer.Tile({
|
||||
|
||||
var draw = new ol.interaction.Draw({
|
||||
source: vectorSource,
|
||||
type: /** @type {ol.geom.GeometryType} */ ('Polygon')
|
||||
type: 'Polygon'
|
||||
});
|
||||
|
||||
var select = new ol.interaction.Select();
|
||||
|
||||
@@ -3004,7 +3004,7 @@ olx.interaction.DragZoomOptions.prototype.out;
|
||||
* features: (ol.Collection.<ol.Feature>|undefined),
|
||||
* source: (ol.source.Vector|undefined),
|
||||
* snapTolerance: (number|undefined),
|
||||
* type: ol.geom.GeometryType,
|
||||
* type: (ol.geom.GeometryType|string),
|
||||
* maxPoints: (number|undefined),
|
||||
* minPoints: (number|undefined),
|
||||
* finishCondition: (ol.EventsConditionType|undefined),
|
||||
@@ -3058,7 +3058,7 @@ olx.interaction.DrawOptions.prototype.snapTolerance;
|
||||
/**
|
||||
* Drawing type ('Point', 'LineString', 'Polygon', 'MultiPoint',
|
||||
* 'MultiLineString', 'MultiPolygon' or 'Circle').
|
||||
* @type {ol.geom.GeometryType}
|
||||
* @type {ol.geom.GeometryType|string}
|
||||
* @api
|
||||
*/
|
||||
olx.interaction.DrawOptions.prototype.type;
|
||||
|
||||
@@ -88,7 +88,7 @@ ol.interaction.Draw = function(options) {
|
||||
* @type {ol.geom.GeometryType}
|
||||
* @private
|
||||
*/
|
||||
this.type_ = options.type;
|
||||
this.type_ = /** @type {ol.geom.GeometryType} */ (options.type);
|
||||
|
||||
/**
|
||||
* Drawing mode (derived from geometry type.
|
||||
|
||||
Reference in New Issue
Block a user