Skip to content

Commit

Permalink
Merge pull request #5479 from camptocamp/gsgmf-1204-fix-gmf-draw-move
Browse files Browse the repository at this point in the history
Fix Translate and Modify interactions
  • Loading branch information
adube committed Feb 3, 2020
2 parents cb78de2 + 45beb67 commit 3844521
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/interaction/Modify.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,14 @@ export default class extends olInteractionInteraction {
*/
setState_() {
const map = this.getMap();
if (!map) {
return;
}
const active = this.getActive();
const interactions = this.interactions_;
const keys = this.listenerKeys_;

if (!interactions || !keys) {
return;
}

interactions.forEach((interaction) => {
interaction.setActive(active && !!map);
});
Expand Down
10 changes: 4 additions & 6 deletions src/interaction/Translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,14 @@ export default class extends olInteractionTranslate {
*/
setState_() {
const map = this.getMap();
if (!map) {
return;
}
const active = this.getActive();
const features = this.myFeatures_;
if (!features) {
throw new Error('Missing features');
}
const keys = this.listenerKeys_;

if (!features || !keys) {
return;
}

if (map && active && features) {
features.forEach(feature => this.addFeature_(feature));
keys.push(
Expand Down

0 comments on commit 3844521

Please sign in to comment.