mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-05-03 01:02:54 +00:00
Merge pull request #433 from GNS3/Lock/unlock-all-items-on-map
Lock/unlock all items on map
This commit is contained in:
commit
79b5909b7a
@ -187,6 +187,7 @@ import { DefaultConsoleService } from './services/settings/default-console.servi
|
|||||||
import { NodeCreatedLabelStylesFixer } from './components/project-map/helpers/node-created-label-styles-fixer';
|
import { NodeCreatedLabelStylesFixer } from './components/project-map/helpers/node-created-label-styles-fixer';
|
||||||
import { NonNegativeValidator } from './validators/non-negative-validator';
|
import { NonNegativeValidator } from './validators/non-negative-validator';
|
||||||
import { RotationValidator } from './validators/rotation-validator';
|
import { RotationValidator } from './validators/rotation-validator';
|
||||||
|
import { MapSettingService } from './services/mapsettings.service';
|
||||||
import { HelpComponent } from './components/help/help.component';
|
import { HelpComponent } from './components/help/help.component';
|
||||||
|
|
||||||
if (environment.production) {
|
if (environment.production) {
|
||||||
@ -382,7 +383,8 @@ if (environment.production) {
|
|||||||
DefaultConsoleService,
|
DefaultConsoleService,
|
||||||
NodeCreatedLabelStylesFixer,
|
NodeCreatedLabelStylesFixer,
|
||||||
NonNegativeValidator,
|
NonNegativeValidator,
|
||||||
RotationValidator
|
RotationValidator,
|
||||||
|
MapSettingService
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
AddServerDialogComponent,
|
AddServerDialogComponent,
|
||||||
|
@ -21,6 +21,7 @@ import { MapLabel } from '../../models/map/map-label';
|
|||||||
import { MapLinkNode } from '../../models/map/map-link-node';
|
import { MapLinkNode } from '../../models/map/map-link-node';
|
||||||
import { select } from 'd3-selection';
|
import { select } from 'd3-selection';
|
||||||
import { MapLink } from '../../models/map/map-link';
|
import { MapLink } from '../../models/map/map-link';
|
||||||
|
import { MapSettingService } from '../../../services/mapsettings.service';
|
||||||
|
|
||||||
describe('DraggableSelectionComponent', () => {
|
describe('DraggableSelectionComponent', () => {
|
||||||
let component: DraggableSelectionComponent;
|
let component: DraggableSelectionComponent;
|
||||||
@ -121,7 +122,8 @@ describe('DraggableSelectionComponent', () => {
|
|||||||
{ provide: NodesEventSource, useValue: nodesEventSourceStub },
|
{ provide: NodesEventSource, useValue: nodesEventSourceStub },
|
||||||
{ provide: DrawingsEventSource, useValue: drawingsEventSourceStub },
|
{ provide: DrawingsEventSource, useValue: drawingsEventSourceStub },
|
||||||
{ provide: GraphDataManager, useValue: mockedGraphDataManager },
|
{ provide: GraphDataManager, useValue: mockedGraphDataManager },
|
||||||
{ provide: LinksEventSource, useValue: linksEventSourceStub }
|
{ provide: LinksEventSource, useValue: linksEventSourceStub },
|
||||||
|
{ provide: MapSettingService, useClass: MapSettingService }
|
||||||
],
|
],
|
||||||
declarations: [DraggableSelectionComponent]
|
declarations: [DraggableSelectionComponent]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
@ -17,6 +17,7 @@ import { LabelWidget } from '../../widgets/label';
|
|||||||
import { InterfaceLabelWidget } from '../../widgets/interface-label';
|
import { InterfaceLabelWidget } from '../../widgets/interface-label';
|
||||||
import { MapLinkNode } from '../../models/map/map-link-node';
|
import { MapLinkNode } from '../../models/map/map-link-node';
|
||||||
import { LinksEventSource } from '../../events/links-event-source';
|
import { LinksEventSource } from '../../events/links-event-source';
|
||||||
|
import { MapSettingService } from '../../../services/mapsettings.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-draggable-selection',
|
selector: 'app-draggable-selection',
|
||||||
@ -27,6 +28,8 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
|||||||
private start: Subscription;
|
private start: Subscription;
|
||||||
private drag: Subscription;
|
private drag: Subscription;
|
||||||
private end: Subscription;
|
private end: Subscription;
|
||||||
|
private mapSettingsSubscription: Subscription;
|
||||||
|
private isMapLocked: boolean = false;
|
||||||
|
|
||||||
@Input('svg') svg: SVGSVGElement;
|
@Input('svg') svg: SVGSVGElement;
|
||||||
|
|
||||||
@ -40,12 +43,17 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
|||||||
private nodesEventSource: NodesEventSource,
|
private nodesEventSource: NodesEventSource,
|
||||||
private drawingsEventSource: DrawingsEventSource,
|
private drawingsEventSource: DrawingsEventSource,
|
||||||
private graphDataManager: GraphDataManager,
|
private graphDataManager: GraphDataManager,
|
||||||
private linksEventSource: LinksEventSource
|
private linksEventSource: LinksEventSource,
|
||||||
|
private mapSettingsService: MapSettingService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
const svg = select(this.svg);
|
const svg = select(this.svg);
|
||||||
|
|
||||||
|
this.mapSettingsService.isMapLocked.subscribe((value) => {
|
||||||
|
this.isMapLocked = value;
|
||||||
|
});
|
||||||
|
|
||||||
this.start = merge(
|
this.start = merge(
|
||||||
this.nodesWidget.draggable.start,
|
this.nodesWidget.draggable.start,
|
||||||
this.drawingsWidget.draggable.start,
|
this.drawingsWidget.draggable.start,
|
||||||
@ -84,75 +92,77 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
|||||||
this.labelWidget.draggable.drag,
|
this.labelWidget.draggable.drag,
|
||||||
this.interfaceWidget.draggable.drag
|
this.interfaceWidget.draggable.drag
|
||||||
).subscribe((evt: DraggableDrag<any>) => {
|
).subscribe((evt: DraggableDrag<any>) => {
|
||||||
const selected = this.selectionManager.getSelected();
|
if (!this.isMapLocked) {
|
||||||
const selectedNodes = selected.filter(item => item instanceof MapNode);
|
const selected = this.selectionManager.getSelected();
|
||||||
// update nodes
|
const selectedNodes = selected.filter(item => item instanceof MapNode);
|
||||||
selectedNodes.forEach((node: MapNode) => {
|
// update nodes
|
||||||
node.x += evt.dx;
|
selectedNodes.forEach((node: MapNode) => {
|
||||||
node.y += evt.dy;
|
node.x += evt.dx;
|
||||||
|
node.y += evt.dy;
|
||||||
|
|
||||||
this.nodesWidget.redrawNode(svg, node);
|
this.nodesWidget.redrawNode(svg, node);
|
||||||
|
|
||||||
const links = this.graphDataManager
|
const links = this.graphDataManager
|
||||||
.getLinks()
|
|
||||||
.filter(
|
|
||||||
link =>
|
|
||||||
(link.target !== undefined && link.target.id === node.id) ||
|
|
||||||
(link.source !== undefined && link.source.id === node.id)
|
|
||||||
);
|
|
||||||
|
|
||||||
links.forEach(link => {
|
|
||||||
this.linksWidget.redrawLink(svg, link);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// update drawings
|
|
||||||
selected
|
|
||||||
.filter(item => item instanceof MapDrawing)
|
|
||||||
.forEach((drawing: MapDrawing) => {
|
|
||||||
drawing.x += evt.dx;
|
|
||||||
drawing.y += evt.dy;
|
|
||||||
this.drawingsWidget.redrawDrawing(svg, drawing);
|
|
||||||
});
|
|
||||||
|
|
||||||
// update labels
|
|
||||||
selected
|
|
||||||
.filter(item => item instanceof MapLabel)
|
|
||||||
.forEach((label: MapLabel) => {
|
|
||||||
const isParentNodeSelected = selectedNodes.filter(node => node.id === label.nodeId).length > 0;
|
|
||||||
if (isParentNodeSelected) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const node = this.graphDataManager.getNodes().filter(node => node.id === label.nodeId)[0];
|
|
||||||
node.label.x += evt.dx;
|
|
||||||
node.label.y += evt.dy;
|
|
||||||
this.labelWidget.redrawLabel(svg, label);
|
|
||||||
});
|
|
||||||
|
|
||||||
// update interface labels
|
|
||||||
selected
|
|
||||||
.filter(item => item instanceof MapLinkNode)
|
|
||||||
.forEach((interfaceLabel: MapLinkNode) => {
|
|
||||||
const isParentNodeSelected = selectedNodes.filter(node => node.id === interfaceLabel.nodeId).length > 0;
|
|
||||||
if (isParentNodeSelected) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const link = this.graphDataManager
|
|
||||||
.getLinks()
|
.getLinks()
|
||||||
.filter(link => link.nodes[0].id === interfaceLabel.id || link.nodes[1].id === interfaceLabel.id)[0];
|
.filter(
|
||||||
if (link.nodes[0].id === interfaceLabel.id) {
|
link =>
|
||||||
link.nodes[0].label.x += evt.dx;
|
(link.target !== undefined && link.target.id === node.id) ||
|
||||||
link.nodes[0].label.y += evt.dy;
|
(link.source !== undefined && link.source.id === node.id)
|
||||||
}
|
);
|
||||||
if (link.nodes[1].id === interfaceLabel.id) {
|
|
||||||
link.nodes[1].label.x += evt.dx;
|
|
||||||
link.nodes[1].label.y += evt.dy;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.linksWidget.redrawLink(svg, link);
|
links.forEach(link => {
|
||||||
|
this.linksWidget.redrawLink(svg, link);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// update drawings
|
||||||
|
selected
|
||||||
|
.filter(item => item instanceof MapDrawing)
|
||||||
|
.forEach((drawing: MapDrawing) => {
|
||||||
|
drawing.x += evt.dx;
|
||||||
|
drawing.y += evt.dy;
|
||||||
|
this.drawingsWidget.redrawDrawing(svg, drawing);
|
||||||
|
});
|
||||||
|
|
||||||
|
// update labels
|
||||||
|
selected
|
||||||
|
.filter(item => item instanceof MapLabel)
|
||||||
|
.forEach((label: MapLabel) => {
|
||||||
|
const isParentNodeSelected = selectedNodes.filter(node => node.id === label.nodeId).length > 0;
|
||||||
|
if (isParentNodeSelected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const node = this.graphDataManager.getNodes().filter(node => node.id === label.nodeId)[0];
|
||||||
|
node.label.x += evt.dx;
|
||||||
|
node.label.y += evt.dy;
|
||||||
|
this.labelWidget.redrawLabel(svg, label);
|
||||||
|
});
|
||||||
|
|
||||||
|
// update interface labels
|
||||||
|
selected
|
||||||
|
.filter(item => item instanceof MapLinkNode)
|
||||||
|
.forEach((interfaceLabel: MapLinkNode) => {
|
||||||
|
const isParentNodeSelected = selectedNodes.filter(node => node.id === interfaceLabel.nodeId).length > 0;
|
||||||
|
if (isParentNodeSelected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const link = this.graphDataManager
|
||||||
|
.getLinks()
|
||||||
|
.filter(link => link.nodes[0].id === interfaceLabel.id || link.nodes[1].id === interfaceLabel.id)[0];
|
||||||
|
if (link.nodes[0].id === interfaceLabel.id) {
|
||||||
|
link.nodes[0].label.x += evt.dx;
|
||||||
|
link.nodes[0].label.y += evt.dy;
|
||||||
|
}
|
||||||
|
if (link.nodes[1].id === interfaceLabel.id) {
|
||||||
|
link.nodes[1].label.x += evt.dx;
|
||||||
|
link.nodes[1].label.y += evt.dy;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.linksWidget.redrawLink(svg, link);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.end = merge(
|
this.end = merge(
|
||||||
@ -161,39 +171,41 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
|||||||
this.labelWidget.draggable.end,
|
this.labelWidget.draggable.end,
|
||||||
this.interfaceWidget.draggable.end
|
this.interfaceWidget.draggable.end
|
||||||
).subscribe((evt: DraggableEnd<any>) => {
|
).subscribe((evt: DraggableEnd<any>) => {
|
||||||
const selected = this.selectionManager.getSelected();
|
if (!this.isMapLocked) {
|
||||||
const selectedNodes = selected.filter(item => item instanceof MapNode);
|
const selected = this.selectionManager.getSelected();
|
||||||
|
const selectedNodes = selected.filter(item => item instanceof MapNode);
|
||||||
|
|
||||||
selectedNodes.forEach((item: MapNode) => {
|
selectedNodes.forEach((item: MapNode) => {
|
||||||
this.nodesEventSource.dragged.emit(new DraggedDataEvent<MapNode>(item, evt.dx, evt.dy));
|
this.nodesEventSource.dragged.emit(new DraggedDataEvent<MapNode>(item, evt.dx, evt.dy));
|
||||||
});
|
|
||||||
|
|
||||||
selected
|
|
||||||
.filter(item => item instanceof MapDrawing)
|
|
||||||
.forEach((item: MapDrawing) => {
|
|
||||||
this.drawingsEventSource.dragged.emit(new DraggedDataEvent<MapDrawing>(item, evt.dx, evt.dy));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
selected
|
selected
|
||||||
.filter(item => item instanceof MapLabel)
|
.filter(item => item instanceof MapDrawing)
|
||||||
.forEach((label: MapLabel) => {
|
.forEach((item: MapDrawing) => {
|
||||||
const isParentNodeSelected = selectedNodes.filter(node => node.id === label.nodeId).length > 0;
|
this.drawingsEventSource.dragged.emit(new DraggedDataEvent<MapDrawing>(item, evt.dx, evt.dy));
|
||||||
if (isParentNodeSelected) {
|
});
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.nodesEventSource.labelDragged.emit(new DraggedDataEvent<MapLabel>(label, evt.dx, evt.dy));
|
selected
|
||||||
});
|
.filter(item => item instanceof MapLabel)
|
||||||
|
.forEach((label: MapLabel) => {
|
||||||
|
const isParentNodeSelected = selectedNodes.filter(node => node.id === label.nodeId).length > 0;
|
||||||
|
if (isParentNodeSelected) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
selected
|
this.nodesEventSource.labelDragged.emit(new DraggedDataEvent<MapLabel>(label, evt.dx, evt.dy));
|
||||||
.filter(item => item instanceof MapLinkNode)
|
});
|
||||||
.forEach((label: MapLinkNode) => {
|
|
||||||
const isParentNodeSelected = selectedNodes.filter(node => node.id === label.nodeId).length > 0;
|
selected
|
||||||
if (isParentNodeSelected) {
|
.filter(item => item instanceof MapLinkNode)
|
||||||
return;
|
.forEach((label: MapLinkNode) => {
|
||||||
}
|
const isParentNodeSelected = selectedNodes.filter(node => node.id === label.nodeId).length > 0;
|
||||||
this.linksEventSource.interfaceDragged.emit(new DraggedDataEvent<MapLinkNode>(label, evt.dx, evt.dy));
|
if (isParentNodeSelected) {
|
||||||
});
|
return;
|
||||||
|
}
|
||||||
|
this.linksEventSource.interfaceDragged.emit(new DraggedDataEvent<MapLinkNode>(label, evt.dx, evt.dy));
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,5 +213,6 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
|||||||
this.start.unsubscribe();
|
this.start.unsubscribe();
|
||||||
this.drag.unsubscribe();
|
this.drag.unsubscribe();
|
||||||
this.end.unsubscribe();
|
this.end.unsubscribe();
|
||||||
|
this.mapSettingsSubscription.unsubscribe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,6 +148,16 @@
|
|||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
|
<mat-divider class="divider" [vertical]="true"></mat-divider>
|
||||||
|
<button
|
||||||
|
matTooltip="Lock or unlock all items"
|
||||||
|
mat-icon-button
|
||||||
|
class="menu-button"
|
||||||
|
[color]="isLocked ? 'primary' : 'basic'"
|
||||||
|
(click)="changeLockValue()"
|
||||||
|
>
|
||||||
|
<mat-icon>lock</mat-icon>
|
||||||
|
</button>
|
||||||
<button class="arrow-button" mat-icon-button (click)="hideMenu()"><mat-icon>keyboard_arrow_left</mat-icon></button>
|
<button class="arrow-button" mat-icon-button (click)="hideMenu()"><mat-icon>keyboard_arrow_left</mat-icon></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ g.node:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.extended {
|
.extended {
|
||||||
width: 640px !important;
|
width: 720px !important;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ import { CapturingSettings } from '../../models/capturingSettings';
|
|||||||
import { LinkWidget } from '../../cartography/widgets/link';
|
import { LinkWidget } from '../../cartography/widgets/link';
|
||||||
import { MapScaleService } from '../../services/mapScale.service';
|
import { MapScaleService } from '../../services/mapScale.service';
|
||||||
import { NodeCreatedLabelStylesFixer } from './helpers/node-created-label-styles-fixer';
|
import { NodeCreatedLabelStylesFixer } from './helpers/node-created-label-styles-fixer';
|
||||||
|
import { MapSettingService } from '../../services/mapsettings.service';
|
||||||
|
|
||||||
export class MockedProgressService {
|
export class MockedProgressService {
|
||||||
public activate() {}
|
public activate() {}
|
||||||
@ -186,6 +187,7 @@ describe('ProjectMapComponent', () => {
|
|||||||
let nodesDataSource = new MockedNodesDataSource();
|
let nodesDataSource = new MockedNodesDataSource();
|
||||||
let linksDataSource = new MockedLinksDataSource();
|
let linksDataSource = new MockedLinksDataSource();
|
||||||
let nodeCreatedLabelStylesFixer;
|
let nodeCreatedLabelStylesFixer;
|
||||||
|
let mapSettingService = new MapSettingService();
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
nodeCreatedLabelStylesFixer = {
|
nodeCreatedLabelStylesFixer = {
|
||||||
@ -223,6 +225,8 @@ describe('ProjectMapComponent', () => {
|
|||||||
provide: RecentlyOpenedProjectService,
|
provide: RecentlyOpenedProjectService,
|
||||||
useClass: RecentlyOpenedProjectService
|
useClass: RecentlyOpenedProjectService
|
||||||
},
|
},
|
||||||
|
{ provide: NodeCreatedLabelStylesFixer, useValue: nodeCreatedLabelStylesFixer},
|
||||||
|
{ provide: MapSettingService, useValue: mapSettingService },
|
||||||
{ provide: MapScaleService },
|
{ provide: MapScaleService },
|
||||||
{ provide: NodeCreatedLabelStylesFixer, useValue: nodeCreatedLabelStylesFixer}
|
{ provide: NodeCreatedLabelStylesFixer, useValue: nodeCreatedLabelStylesFixer}
|
||||||
],
|
],
|
||||||
@ -263,4 +267,22 @@ describe('ProjectMapComponent', () => {
|
|||||||
|
|
||||||
expect(component.resetDrawToolChoice).toHaveBeenCalled();
|
expect(component.resetDrawToolChoice).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should call map settings service when lock value was changed', () => {
|
||||||
|
spyOn(mapSettingService, 'changeMapLockValue');
|
||||||
|
|
||||||
|
component.changeLockValue();
|
||||||
|
|
||||||
|
expect(mapSettingService.changeMapLockValue).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call map settings service with proper value', () => {
|
||||||
|
spyOn(mapSettingService, 'changeMapLockValue');
|
||||||
|
|
||||||
|
component.changeLockValue();
|
||||||
|
expect(mapSettingService.changeMapLockValue).toHaveBeenCalledWith(true);
|
||||||
|
|
||||||
|
component.changeLockValue();
|
||||||
|
expect(mapSettingService.changeMapLockValue).toHaveBeenCalledWith(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -46,6 +46,7 @@ import { MovingEventSource } from '../../cartography/events/moving-event-source'
|
|||||||
import { LinkWidget } from '../../cartography/widgets/link';
|
import { LinkWidget } from '../../cartography/widgets/link';
|
||||||
import { MapScaleService } from '../../services/mapScale.service';
|
import { MapScaleService } from '../../services/mapScale.service';
|
||||||
import { NodeCreatedLabelStylesFixer } from './helpers/node-created-label-styles-fixer';
|
import { NodeCreatedLabelStylesFixer } from './helpers/node-created-label-styles-fixer';
|
||||||
|
import { MapSettingService } from '../../services/mapsettings.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -80,6 +81,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
isTextChosen: false,
|
isTextChosen: false,
|
||||||
visibility: false
|
visibility: false
|
||||||
};
|
};
|
||||||
|
protected isLocked: boolean = false;
|
||||||
|
|
||||||
private inReadOnlyMode = false;
|
private inReadOnlyMode = false;
|
||||||
|
|
||||||
@ -112,6 +114,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
private selectionManager: SelectionManager,
|
private selectionManager: SelectionManager,
|
||||||
private selectionTool: SelectionTool,
|
private selectionTool: SelectionTool,
|
||||||
private recentlyOpenedProjectService: RecentlyOpenedProjectService,
|
private recentlyOpenedProjectService: RecentlyOpenedProjectService,
|
||||||
|
private mapSettingsService: MapSettingService,
|
||||||
private movingEventSource: MovingEventSource,
|
private movingEventSource: MovingEventSource,
|
||||||
private mapScaleService: MapScaleService,
|
private mapScaleService: MapScaleService,
|
||||||
private nodeCreatedLabelStylesFixer: NodeCreatedLabelStylesFixer
|
private nodeCreatedLabelStylesFixer: NodeCreatedLabelStylesFixer
|
||||||
@ -428,6 +431,11 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
imageToUpload.src = window.URL.createObjectURL(file);
|
imageToUpload.src = window.URL.createObjectURL(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public changeLockValue() {
|
||||||
|
this.isLocked = !this.isLocked;
|
||||||
|
this.mapSettingsService.changeMapLockValue(this.isLocked);
|
||||||
|
}
|
||||||
|
|
||||||
public ngOnDestroy() {
|
public ngOnDestroy() {
|
||||||
this.drawingsDataSource.clear();
|
this.drawingsDataSource.clear();
|
||||||
this.nodesDataSource.clear();
|
this.nodesDataSource.clear();
|
||||||
|
13
src/app/services/mapsettings.service.ts
Normal file
13
src/app/services/mapsettings.service.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { Injectable } from "@angular/core";
|
||||||
|
import { Subject } from 'rxjs';
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class MapSettingService {
|
||||||
|
public isMapLocked = new Subject<boolean>();
|
||||||
|
|
||||||
|
constructor() {}
|
||||||
|
|
||||||
|
changeMapLockValue(value: boolean) {
|
||||||
|
this.isMapLocked.next(value);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user