Skip to content

Commit

Permalink
Run code for toggling drag mode outside of Angular
Browse files Browse the repository at this point in the history
  • Loading branch information
tkleinke committed Jun 25, 2020
1 parent 15cfcff commit de96f2d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/app/components/resources/map/map/editable-map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,21 @@ export class EditableMapComponent extends LayerMapComponent {

public toggleDragMode() {

if (this.map.pm.globalDragModeEnabled()) {
if (this.selectedPolyline) (this.selectedPolyline as any).pm.enable();
if (this.selectedPolygon) (this.selectedPolygon as any).pm.enable();
this.map.dragging.enable();
} else {
if (this.selectedPolyline) (this.selectedPolyline as any).pm.disable();
if (this.selectedPolygon) (this.selectedPolygon as any).pm.disable();
this.map.dragging.disable();
}
this.zone.runOutsideAngular(() => {
if (this.map.pm.globalDragModeEnabled()) {
if (this.selectedPolyline) (this.selectedPolyline as any).pm.enable();
if (this.selectedPolygon) (this.selectedPolygon as any).pm.enable();
this.map.dragging.enable();
} else {
if (this.selectedPolyline) (this.selectedPolyline as any).pm.disable();
if (this.selectedPolygon) (this.selectedPolygon as any).pm.disable();
this.map.dragging.disable();
}

this.map.pm.toggleGlobalDragMode();
this.map.pm.toggleGlobalDragMode();

this.redrawGeometries();
this.redrawGeometries();
});
}


Expand Down

0 comments on commit de96f2d

Please sign in to comment.