Move layout types to a dedicated types file
These types are only used in the layout classes, so keep them located closed in the folder where they are used.development
parent
7c4b1111ee
commit
c4f537203b
|
@ -15,7 +15,6 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import { DIRECTION } from './util/Constants';
|
||||
import Dictionary from './util/Dictionary';
|
||||
import type Cell from './view/cell/Cell';
|
||||
import type CellState from './view/cell/CellState';
|
||||
import EventSource from './view/event/EventSource';
|
||||
|
@ -23,7 +22,6 @@ import type InternalMouseEvent from './view/event/InternalMouseEvent';
|
|||
import type Shape from './view/geometry/Shape';
|
||||
import type { Graph } from './view/Graph';
|
||||
import type ImageBox from './view/image/ImageBox';
|
||||
import GraphHierarchyNode from './view/layout/datatypes/GraphHierarchyNode';
|
||||
|
||||
export type CellMap = {
|
||||
[id: string]: Cell;
|
||||
|
@ -318,24 +316,3 @@ export interface PopupMenuItem extends HTMLElement {
|
|||
activeRow: PopupMenuItem | null;
|
||||
eventReceiver: HTMLElement | null;
|
||||
}
|
||||
|
||||
// GraphLayout
|
||||
|
||||
export interface GraphLayoutTraverseArgs {
|
||||
vertex: Cell | null;
|
||||
directed: boolean | null;
|
||||
func: Function | null;
|
||||
edge: Cell | null;
|
||||
visited: Dictionary<Cell, boolean> | null;
|
||||
}
|
||||
|
||||
export interface HierarchicalGraphLayoutTraverseArgs extends GraphLayoutTraverseArgs {
|
||||
allVertices: { [key: string]: Cell } | null;
|
||||
currentComp: { [key: string]: Cell | null };
|
||||
hierarchyVertices: GraphHierarchyNode[];
|
||||
filledVertexSet: { [key: string]: Cell } | null;
|
||||
}
|
||||
|
||||
export interface SwimlaneGraphLayoutTraverseArgs extends HierarchicalGraphLayoutTraverseArgs {
|
||||
swimlaneIndex: number;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import Geometry from '../geometry/Geometry';
|
|||
import Point from '../geometry/Point';
|
||||
import { Graph } from '../Graph';
|
||||
import Cell from '../cell/Cell';
|
||||
import { GraphLayoutTraverseArgs } from '../../types';
|
||||
import { GraphLayoutTraverseArgs } from './types';
|
||||
|
||||
/**
|
||||
* @class GraphLayout
|
||||
|
@ -163,9 +163,9 @@ class GraphLayout {
|
|||
const next = this.graph.view.getVisibleTerminal(e, !isSource);
|
||||
this.traverse({
|
||||
vertex: next,
|
||||
directed,
|
||||
func,
|
||||
edge: e,
|
||||
directed,
|
||||
func,
|
||||
edge: e,
|
||||
visited
|
||||
});
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import MedianHybridCrossingReduction from './hierarchical/MedianHybridCrossingRe
|
|||
import CoordinateAssignment from './hierarchical/CoordinateAssignment';
|
||||
import { Graph } from '../../view/Graph';
|
||||
import Cell from '../../view/cell/Cell';
|
||||
import { HierarchicalGraphLayoutTraverseArgs } from '../../types';
|
||||
import { HierarchicalGraphLayoutTraverseArgs } from './types';
|
||||
|
||||
/**
|
||||
* A hierarchical layout algorithm.
|
||||
|
@ -605,11 +605,11 @@ class HierarchicalLayout extends GraphLayout {
|
|||
* @param allVertices Array of cell paths for the visited cells.
|
||||
*/
|
||||
traverse({
|
||||
vertex,
|
||||
directed,
|
||||
allVertices,
|
||||
currentComp,
|
||||
hierarchyVertices,
|
||||
vertex,
|
||||
directed,
|
||||
allVertices,
|
||||
currentComp,
|
||||
hierarchyVertices,
|
||||
filledVertexSet
|
||||
}: HierarchicalGraphLayoutTraverseArgs) {
|
||||
if (vertex != null && allVertices != null) {
|
||||
|
|
|
@ -29,7 +29,7 @@ import CoordinateAssignment from './hierarchical/CoordinateAssignment';
|
|||
import { Graph } from '../Graph';
|
||||
import Cell from '../cell/Cell';
|
||||
import Geometry from '../../view/geometry/Geometry';
|
||||
import { SwimlaneGraphLayoutTraverseArgs } from '../../types';
|
||||
import { SwimlaneGraphLayoutTraverseArgs } from './types';
|
||||
|
||||
/**
|
||||
* A hierarchical layout algorithm.
|
||||
|
@ -806,7 +806,7 @@ class SwimlaneLayout extends GraphLayout {
|
|||
swimlaneIndex: otherIndex,
|
||||
func: null,
|
||||
visited: null
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (currentComp[vertexID] == null) {
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
Copyright 2022-present The maxGraph project Contributors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import type Cell from '../cell/Cell';
|
||||
import type Dictionary from '../../util/Dictionary';
|
||||
import type GraphHierarchyNode from './datatypes/GraphHierarchyNode';
|
||||
|
||||
export interface GraphLayoutTraverseArgs {
|
||||
vertex: Cell | null;
|
||||
directed: boolean | null;
|
||||
func: Function | null;
|
||||
edge: Cell | null;
|
||||
visited: Dictionary<Cell, boolean> | null;
|
||||
}
|
||||
|
||||
export interface HierarchicalGraphLayoutTraverseArgs extends GraphLayoutTraverseArgs {
|
||||
allVertices: { [key: string]: Cell } | null;
|
||||
currentComp: { [key: string]: Cell | null };
|
||||
hierarchyVertices: GraphHierarchyNode[];
|
||||
filledVertexSet: { [key: string]: Cell } | null;
|
||||
}
|
||||
|
||||
export interface SwimlaneGraphLayoutTraverseArgs extends HierarchicalGraphLayoutTraverseArgs {
|
||||
swimlaneIndex: number;
|
||||
}
|
Loading…
Reference in New Issue