Skip to content

Commit

Permalink
fix(draw): fixes issues with draw interaction selections
Browse files Browse the repository at this point in the history
The draw controls will now only use the interactions intended for
general map drawing. It will no longer select interactions added to the
map from other drawing controls.

THIN-14237
  • Loading branch information
jsalankey committed Aug 29, 2019
1 parent a9b49f4 commit 5825ef1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/os/ui/draw/basedrawcontrols.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,24 @@ os.ui.draw.BaseDrawControlsCtrl.prototype.setFeature = function(f) {
* @protected
*/
os.ui.draw.BaseDrawControlsCtrl.prototype.setSelectedControl = function(type) {
this.interaction = null;
if (this.interaction) {
this.interaction.setActive(false);
this.interaction = null;
}

var map = this.getMap();
if (map) {
var interactions = map.getInteractions().getArray();
for (var i = 0, n = interactions.length; i < n; i++) {
var interaction = /** @type {os.ui.ol.interaction.AbstractDraw} */ (interactions[i]);
if (interaction instanceof os.ui.ol.interaction.AbstractDraw) {
if (interaction instanceof os.ui.ol.interaction.AbstractDraw &&
!(interaction instanceof os.interaction.DragZoom)) {
var active = interaction.isType(type);
interaction.setActive(active);

if (active) {
this.interaction = interaction;
break;
}
}
}
Expand Down

0 comments on commit 5825ef1

Please sign in to comment.