/******************************************************************************** * Copyright (c) 2022-2026 Imixs Software Solutions GmbH. * Copyright (c) 2026 EclipseSource 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 { DefaultAnchors, GRoutableElement, GRoutingHandle, LinearRouteOptions, Point, ResolvedHandleMove, RoutedPoint, Side } from '@eclipse-glsp/sprotty'; import { GLSPAbstractEdgeRouter } from './edge-router'; export interface StickyManhattanRouterOptions extends LinearRouteOptions { /** * Tolerance in pixels for deciding whether a segment is strictly vertical or * horizontal. Defaults to `1` to accommodate the sub-pixel drift typical for * Manhattan-routed coordinates. */ axisTolerance: number; } /** * An alternative Manhattan-style edge router that preserves existing bend points. * * In contrast to the standard {@link GLSPManhattanEdgeRouter} which recomputes the * full route whenever a connected node moves, this router only adjusts the corner * adjacent to the moved endpoint. Intermediate bend points are kept in place, which * results in more predictable routing when users reposition nodes in complex * diagrams. * * Opt-in per edge by setting `edge.routerKind = 'sticky-manhattan'`. * * @experimental The API surface and implementation details of this router may * change in future releases, potentially in breaking ways, as we iterate on the * initial implementation. * * Based on the original `BPMNManhattanRouter` by Ralph Soika (Imixs Software * Solutions GmbH), contributed via https://github.com/eclipse-glsp/glsp/discussions/1642. */ export declare class GLSPStickyManhattanEdgeRouter extends GLSPAbstractEdgeRouter { static readonly KIND = "sticky-manhattan"; /** Move-detection baseline: source/target bounds at the last persistence. */ protected readonly elementPositions: WeakMap; get kind(): string; protected getOptions(edge: GRoutableElement): StickyManhattanRouterOptions; route(edge: GRoutableElement): RoutedPoint[]; protected commitRoute(edge: GRoutableElement, routedPoints: RoutedPoint[]): void; /** Snapshots current source/target bounds as the move-detection baseline. */ protected captureBaseline(edge: GRoutableElement): void; /** * Computes the intermediate corner points between source and target anchors. * * If the edge already has routing points and the connected nodes have moved * since the previous route, the existing corners are preserved and only the * endpoints closest to the moved node(s) slide along their constrained axis. * Otherwise the corners are recomputed from scratch based on the current node * geometry. */ protected createRoutedCorners(edge: GRoutableElement): RoutedPoint[]; /** * Adjusts the endpoints of the existing route so they follow the moved node(s). * The corner adjacent to a moved endpoint slides along its constrained axis so * that the route stays orthogonal without discarding intermediate bend points. */ protected applyFollowLogic(points: Point[], edge: GRoutableElement, sourceAnchors?: DefaultAnchors): void; createRoutingHandles(edge: GRoutableElement): void; protected getInnerHandlePosition(edge: GRoutableElement, route: RoutedPoint[], handle: GRoutingHandle): Point | undefined; protected applyInnerHandleMoves(edge: GRoutableElement, moves: ResolvedHandleMove[]): void; cleanupRoutingPoints(edge: GRoutableElement, routingPoints: Point[], updateHandles: boolean, addRoutingPoints: boolean, sourceAnchors?: DefaultAnchors, targetAnchors?: DefaultAnchors): void; protected removeHandle(edge: GRoutableElement, pointIndex: number): void; /** * Inserts an additional corner when the first/last routing point is outside * the node bounds in the direction of the adjacent segment. This keeps the * route orthogonal after routing points have been dragged outside the node. */ protected addAdditionalCorner(edge: GRoutableElement, points: Point[], currentAnchors: DefaultAnchors, otherAnchors: DefaultAnchors, updateHandles: boolean): void; /** Inserts intermediate corner points so every segment is strictly orthogonal. */ protected manhattanify(points: Point[], edge: GRoutableElement): void; /** * Picks the sides on source and target for a fresh default route, preferring * (in order) direct, one-corner, and finally two-corner connections. */ protected getBestConnectionAnchors(sourceAnchors: DefaultAnchors, targetAnchors: DefaultAnchors, options: StickyManhattanRouterOptions): { source: Side; target: Side; }; /** Computes 0, 1, or 2 corner points for a fresh default route between the given sides. */ protected calculateCorners(sourceAnchors: DefaultAnchors, targetAnchors: DefaultAnchors, sides: { source: Side; target: Side; }, options: StickyManhattanRouterOptions): Point[]; protected correctX(routingPoints: Point[], index: number, x: number, minimalPointDistance: number): number; protected correctY(routingPoints: Point[], index: number, y: number, minimalPointDistance: number): number; protected alignX(points: Point[], index: number, x: number): void; protected alignY(points: Point[], index: number, y: number): void; } //# sourceMappingURL=sticky-manhattan-edge-router.d.ts.map