mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-24 07:06:38 +00:00
Remove last dependecies on selection store
This commit is contained in:
parent
c25e7f538d
commit
9e54287e1c
@ -47,7 +47,7 @@ import { ProjectWebServiceHandler } from "./handlers/project-web-service-handler
|
||||
import { LinksDataSource } from "./cartography/datasources/links-datasource";
|
||||
import { NodesDataSource } from "./cartography/datasources/nodes-datasource";
|
||||
import { SymbolsDataSource } from "./cartography/datasources/symbols-datasource";
|
||||
import { SelectionManager, SelectionStore } from "./cartography/managers/selection-manager";
|
||||
import { SelectionManager } from "./cartography/managers/selection-manager";
|
||||
import { InRectangleHelper } from "./cartography/helpers/in-rectangle-helper";
|
||||
import { DrawingsDataSource } from "./cartography/datasources/drawings-datasource";
|
||||
import { MoveLayerDownActionComponent } from './components/project-map/node-context-menu/actions/move-layer-down-action/move-layer-down-action.component';
|
||||
@ -149,7 +149,6 @@ if (environment.production) {
|
||||
LinksDataSource,
|
||||
NodesDataSource,
|
||||
SymbolsDataSource,
|
||||
SelectionStore,
|
||||
SelectionManager,
|
||||
InRectangleHelper,
|
||||
DrawingsDataSource,
|
||||
|
@ -37,6 +37,7 @@ import { LinkNodeToMapLinkNodeConverter } from './converters/map/link-node-to-ma
|
||||
import { GraphDataManager } from './managers/graph-data-manager';
|
||||
import { SelectionUpdateListener } from './listeners/selection-update-listener';
|
||||
import { MapNodesDataSource, MapLinksDataSource, MapDrawingsDataSource, MapSymbolsDataSource } from './datasources/map-datasource';
|
||||
import { SelectionListener } from './listeners/selection-listener';
|
||||
|
||||
|
||||
@NgModule({
|
||||
@ -63,6 +64,7 @@ import { MapNodesDataSource, MapLinksDataSource, MapDrawingsDataSource, MapSymbo
|
||||
SelectionUpdateListener,
|
||||
MapListeners,
|
||||
DraggableListener,
|
||||
SelectionListener,
|
||||
DrawingsEventSource,
|
||||
NodesEventSource,
|
||||
DrawingToMapDrawingConverter,
|
||||
|
@ -28,7 +28,6 @@ import { Symbol } from '../../../models/symbol';
|
||||
import { MapNodeToNodeConverter } from '../../converters/map/map-node-to-node-converter';
|
||||
import { MapPortToPortConverter } from '../../converters/map/map-port-to-port-converter';
|
||||
import { GraphDataManager } from '../../managers/graph-data-manager';
|
||||
import { SelectionManager } from '../../managers/selection-manager';
|
||||
import { MapDrawingToDrawingConverter } from '../../converters/map/map-drawing-to-drawing-converter';
|
||||
|
||||
|
||||
@ -71,7 +70,6 @@ export class MapComponent implements OnInit, OnChanges, OnDestroy {
|
||||
private mapNodeToNode: MapNodeToNodeConverter,
|
||||
private mapPortToPort: MapPortToPortConverter,
|
||||
private mapDrawingToDrawing: MapDrawingToDrawingConverter,
|
||||
private selectionManager: SelectionManager,
|
||||
protected element: ElementRef,
|
||||
protected nodesWidget: NodesWidget,
|
||||
protected nodeWidget: NodeWidget,
|
||||
@ -151,8 +149,6 @@ export class MapComponent implements OnInit, OnChanges, OnDestroy {
|
||||
this.drawingDragged.emit(new DraggedDataEvent<Drawing>(this.mapDrawingToDrawing.convert(evt.datum), evt.dx, evt.dy));
|
||||
});
|
||||
|
||||
this.selectionChanged = this.selectionManager.subscribe(this.selectionToolWidget.rectangleSelected);
|
||||
|
||||
this.mapListeners.onInit(this.svg);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ import { Injectable } from "@angular/core";
|
||||
import { MapListener } from "./map-listener";
|
||||
import { DraggableListener } from "./draggable-listener";
|
||||
import { SelectionUpdateListener } from "./selection-update-listener";
|
||||
import { SelectionListener } from "./selection-listener";
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -9,9 +10,11 @@ export class MapListeners {
|
||||
private listeners: MapListener[] = [];
|
||||
constructor(
|
||||
private nodesDraggableListener: DraggableListener,
|
||||
private selectionListener: SelectionUpdateListener
|
||||
private selectionUpdateListener: SelectionUpdateListener,
|
||||
private selectionListener: SelectionListener
|
||||
) {
|
||||
this.listeners.push(this.nodesDraggableListener);
|
||||
this.listeners.push(this.selectionUpdateListener);
|
||||
this.listeners.push(this.selectionListener);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import { Subscription } from "rxjs";
|
||||
import { SelectionStore } from "../managers/selection-manager";
|
||||
import { MapChangeDetectorRef } from "../services/map-change-detector-ref";
|
||||
import { SelectionManager } from "../managers/selection-manager";
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -10,16 +10,16 @@ export class SelectionUpdateListener {
|
||||
private onUnselected: Subscription;
|
||||
|
||||
constructor(
|
||||
private selectionStore: SelectionStore,
|
||||
private selectionManager: SelectionManager,
|
||||
private mapChangeDetectorRef: MapChangeDetectorRef
|
||||
) {
|
||||
}
|
||||
|
||||
public onInit(svg: any) {
|
||||
this.onSelected = this.selectionStore.selected.subscribe(() => {
|
||||
this.onSelected = this.selectionManager.selected.subscribe(() => {
|
||||
this.mapChangeDetectorRef.detectChanges();
|
||||
});
|
||||
this.onUnselected = this.selectionStore.unselected.subscribe(() => {
|
||||
this.onUnselected = this.selectionManager.unselected.subscribe(() => {
|
||||
this.mapChangeDetectorRef.detectChanges();
|
||||
});
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import { MultiLinkCalculatorHelper } from "../helpers/multi-link-calculator-help
|
||||
import { InterfaceLabelWidget } from "./interface-label";
|
||||
import { InterfaceStatusWidget } from "./interface-status";
|
||||
import { MapLink } from "../models/map/map-link";
|
||||
import { SelectionStore } from "../managers/selection-manager";
|
||||
import { SelectionManager } from "../managers/selection-manager";
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -18,7 +18,7 @@ export class LinkWidget implements Widget {
|
||||
private multiLinkCalculatorHelper: MultiLinkCalculatorHelper,
|
||||
private interfaceLabelWidget: InterfaceLabelWidget,
|
||||
private interfaceStatusWidget: InterfaceStatusWidget,
|
||||
private selectionStore: SelectionStore
|
||||
private selectionManager: SelectionManager
|
||||
) {}
|
||||
|
||||
public draw(view: SVGSelection) {
|
||||
@ -43,7 +43,7 @@ export class LinkWidget implements Widget {
|
||||
|
||||
link_body_merge
|
||||
.select<SVGPathElement>('path')
|
||||
.classed('selected', (l: MapLink) => this.selectionStore.isSelected(l));
|
||||
.classed('selected', (l: MapLink) => this.selectionManager.isSelected(l));
|
||||
|
||||
this.interfaceLabelWidget.draw(link_body_merge);
|
||||
this.interfaceStatusWidget.draw(link_body_merge);
|
||||
|
@ -9,7 +9,7 @@ import { select, event } from "d3-selection";
|
||||
import { MapSymbol } from "../models/map/map-symbol";
|
||||
import { MapNode } from "../models/map/map-node";
|
||||
import { GraphDataManager } from "../managers/graph-data-manager";
|
||||
import { SelectionStore } from "../managers/selection-manager";
|
||||
import { SelectionManager } from "../managers/selection-manager";
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -25,7 +25,7 @@ export class NodeWidget implements Widget {
|
||||
private cssFixer: CssFixer,
|
||||
private fontFixer: FontFixer,
|
||||
private graphDataManager: GraphDataManager,
|
||||
private selectionStore: SelectionStore
|
||||
private selectionManager: SelectionManager
|
||||
) {}
|
||||
|
||||
public draw(view: SVGSelection) {
|
||||
@ -47,7 +47,7 @@ export class NodeWidget implements Widget {
|
||||
.attr('class', 'label');
|
||||
|
||||
const node_body_merge = node_body.merge(node_body_enter)
|
||||
.classed('selected', (n: MapNode) => this.selectionStore.isSelected(n))
|
||||
.classed('selected', (n: MapNode) => this.selectionManager.isSelected(n))
|
||||
.on("contextmenu", function (n: MapNode, i: number) {
|
||||
event.preventDefault();
|
||||
self.onContextMenu.emit(new NodeContextMenu(event, n));
|
||||
|
Loading…
Reference in New Issue
Block a user