mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-25 05:19:43 +00:00
Disable/enable selection
This commit is contained in:
parent
320ce4a827
commit
e174de142c
@ -55,7 +55,6 @@ export class MapComponent implements OnInit, OnChanges, OnDestroy {
|
||||
private onChangesDetected: Subscription;
|
||||
private nodeDraggedSub: Subscription;
|
||||
private drawingDraggedSub: Subscription;
|
||||
private selectionChanged: Subscription;
|
||||
|
||||
protected settings = {
|
||||
'show_interface_labels': true
|
||||
@ -83,6 +82,9 @@ export class MapComponent implements OnInit, OnChanges, OnDestroy {
|
||||
private drawingsEventSource: DrawingsEventSource,
|
||||
) {
|
||||
this.parentNativeElement = element.nativeElement;
|
||||
|
||||
this.selectionToolWidget.setEnabled(false);
|
||||
this.movingToolWidget.setEnabled(false);
|
||||
}
|
||||
|
||||
@Input('show-interface-labels')
|
||||
@ -157,7 +159,7 @@ export class MapComponent implements OnInit, OnChanges, OnDestroy {
|
||||
this.onChangesDetected.unsubscribe();
|
||||
this.mapListeners.onDestroy();
|
||||
this.nodeDraggedSub.unsubscribe();
|
||||
this.selectionChanged.unsubscribe();
|
||||
this.drawingDraggedSub.unsubscribe();
|
||||
}
|
||||
|
||||
public createGraph(domElement: HTMLElement) {
|
||||
|
@ -1,5 +1,3 @@
|
||||
import { Subject} from "rxjs";
|
||||
|
||||
import { Rectangle } from "../models/rectangle";
|
||||
import { InRectangleHelper } from "../helpers/in-rectangle-helper";
|
||||
import { MapNode } from "../models/map/map-node";
|
||||
|
@ -23,14 +23,6 @@ export class SelectionTool {
|
||||
) {}
|
||||
|
||||
public setEnabled(enabled) {
|
||||
if (this.enabled != enabled) {
|
||||
if (enabled) {
|
||||
this.needsActivate = true;
|
||||
}
|
||||
else {
|
||||
this.needsDeactivate = true;
|
||||
}
|
||||
}
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
@ -80,13 +72,17 @@ export class SelectionTool {
|
||||
.attr("visibility", "hidden");
|
||||
}
|
||||
|
||||
if(this.needsActivate) {
|
||||
const tool = canvas.select<SVGGElement>("g.selection-line-tool");
|
||||
const status = tool.attr('status');
|
||||
|
||||
|
||||
if(status !== 'activated' && this.enabled) {
|
||||
this.activate(selection);
|
||||
this.needsActivate = false;
|
||||
tool.attr('activated');
|
||||
}
|
||||
if(this.needsDeactivate) {
|
||||
if(status !== 'deactivated' && !this.enabled) {
|
||||
this.deactivate(selection);
|
||||
this.needsDeactivate = false;
|
||||
tool.attr('deactivated');
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user