@finos/legend-extension-dsl-diagram
Version:
Legend extension for Diagram DSL
73 lines • 3.69 kB
TypeScript
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* 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 { RelationshipView } from '../metamodel/pure/packageableElements/diagram/DSL_Diagram_RelationshipView.js';
import { Point } from '../metamodel/pure/packageableElements/diagram/geometry/DSL_Diagram_Point.js';
import { type PureModel } from '@finos/legend-graph';
import type { ClassView } from '../metamodel/pure/packageableElements/diagram/DSL_Diagram_ClassView.js';
import type { Diagram } from '../metamodel/pure/packageableElements/diagram/DSL_Diagram_Diagram.js';
import { PositionedRectangle } from '../metamodel/pure/packageableElements/diagram/geometry/DSL_Diagram_PositionedRectangle.js';
export declare class Vector {
readonly x: number;
readonly y: number;
constructor(x: number, y: number);
static fromPoints(a: Point, b: Point): Vector;
unit(): Vector;
normal(other: Vector): Vector;
dotProduct(other: Vector): number;
}
/**
* Get absolute position of element on the screen by recursively walking up element tree
*/
export declare const getElementPosition: (element: HTMLElement) => Point;
export declare const getClassView: (diagram: Diagram, sourceViewId: string) => ClassView | undefined;
export declare const cleanUpDeadReferencesInDiagram: (diagram: Diagram, graph: PureModel) => void;
export declare const _relationshipView_setPath: (relationshipView: RelationshipView, val: Point[]) => void;
/**
* Simplify the path.
*
* Flatten the path if the angle is wide enough between 3 consecutive points
* Also remove unnecessary inside points
*/
export declare const _relationshipView_simplifyPath: (relationshipView: RelationshipView) => void;
/**
* Based on the location, find the point on the path that matches or create new point
* (within a threshold of proximity) from the coordinate and put this in the path array
* so it doesn't look too weird
*/
export declare const _findOrBuildPoint: (relationshipView: RelationshipView, x: number, y: number, zoom: number, allowChange: boolean) => Point | undefined;
export declare const rotatePointX: (point: Point, angle: number) => number;
export declare const rotatePointY: (point: Point, angle: number) => number;
export declare const getBottomRightCornerPoint: (pR: PositionedRectangle) => Point;
/**
* Build a small box at the bottom right corner of the rectangle so we
* can use that for selection to resize the box
*/
export declare const buildBottomRightCornerBox: (pR: PositionedRectangle) => PositionedRectangle;
/**
* Check if a box contains another box
*/
export declare const boxContains: (box: PositionedRectangle, otherBox: PositionedRectangle) => boolean;
/**
* Manhattan grid layout: arranges ClassViews on a grid with a small gap
* between cells, placing connected nodes in adjacent cells via BFS so
* that edges stay short and crossings are minimised.
* The final layout is centred on (0, 0).
*
* Assumes rectangle dimensions on each ClassView have already been set
* (e.g. by DiagramRenderer.ensureClassViewMeetMinDimensions).
*/
export declare const layoutDiagram: (diagram: Diagram) => void;
//# sourceMappingURL=DSL_Diagram_Helper.d.ts.map