sprotty
Version:
A next-gen framework for graphical views
71 lines • 3.78 kB
TypeScript
/********************************************************************************
* Copyright (c) 2021 TypeFox and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import { Action } from 'sprotty-protocol/lib/actions';
import { Point } from 'sprotty-protocol/lib/utils/geometry';
import { ResolvedHandleMove } from '../move/move';
import { SRoutableElementImpl, SRoutingHandleImpl } from './model';
import { SModelElementImpl } from '../../base/model/smodel';
import { EdgeRouterRegistry, RoutedPoint } from './routing';
import { AbstractEdgeRouter, LinearRouteOptions } from './abstract-edge-router';
import { MouseListener } from '../../base/views/mouse-tool';
import { Command, CommandExecutionContext, CommandReturn } from '../../base/commands/command';
export declare class BezierEdgeRouter extends AbstractEdgeRouter {
static readonly KIND = "bezier";
static readonly DEFAULT_BEZIER_HANDLE_OFFSET = 25;
get kind(): string;
route(edge: SRoutableElementImpl): RoutedPoint[];
private createDefaultBezierHandles;
createRoutingHandles(edge: SRoutableElementImpl): void;
private rebuildHandles;
getInnerHandlePosition(edge: SRoutableElementImpl, route: RoutedPoint[], handle: SRoutingHandleImpl): RoutedPoint | {
x: number;
y: number;
} | undefined;
protected findBezierControl(edge: SRoutableElementImpl, route: RoutedPoint[], handleIndex: number): Point;
applyHandleMoves(edge: SRoutableElementImpl, moves: ResolvedHandleMove[]): void;
protected applyInnerHandleMoves(edge: SRoutableElementImpl, moves: ResolvedHandleMove[]): void;
protected getOptions(edge: SRoutableElementImpl): LinearRouteOptions;
private calcRelativeMove;
createNewBezierSegment(index: number, edge: SRoutableElementImpl): void;
removeBezierSegment(index: number, edge: SRoutableElementImpl): void;
private moveBezierControlPair;
private setBezierMirror;
}
/**
* Reacts on mouseDown events if the target kind is bezier-add or bezier-remove
*/
export declare class BezierMouseListener extends MouseListener {
mouseDown(target: SModelElementImpl, event: MouseEvent): Action[];
}
export interface AddRemoveBezierSegmentAction extends Action {
kind: typeof AddRemoveBezierSegmentAction.KIND;
targetId: string;
actionTask: 'add' | 'remove';
}
export declare namespace AddRemoveBezierSegmentAction {
const KIND = "addRemoveBezierSegment";
function create(actionTask: 'add' | 'remove', targetId: string): AddRemoveBezierSegmentAction;
}
export declare class AddRemoveBezierSegmentCommand extends Command {
protected readonly action: AddRemoveBezierSegmentAction;
protected readonly edgeRouterRegistry?: EdgeRouterRegistry | undefined;
static readonly KIND = "addRemoveBezierSegment";
constructor(action: AddRemoveBezierSegmentAction, edgeRouterRegistry?: EdgeRouterRegistry | undefined);
execute(context: CommandExecutionContext): CommandReturn;
undo(context: CommandExecutionContext): CommandReturn;
redo(context: CommandExecutionContext): CommandReturn;
}
//# sourceMappingURL=bezier-edge-router.d.ts.map