@visuallyjs/browser-ui 1.2.10 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/visuallyjs.browser-ui.cjs.js +69 -69
- package/js/visuallyjs.browser-ui.esm.js +69 -69
- package/package.json +1 -1
- package/types/browser-ui/browser-visuallyjs-instance.d.ts +2 -0
- package/types/browser-ui/drag-element-bounds.d.ts +19 -0
- package/types/browser-ui/element-drag-handler-2.d.ts +1 -0
- package/types/browser-ui/pan-zoom.d.ts +3 -0
- package/types/browser-ui/surface-renderer/diagrams/definitions.d.ts +16 -27
- package/types/browser-ui/surface-renderer/surface.d.ts +2 -0
- package/types/browser-ui/svg-element-connector.d.ts +1 -0
- package/types/browser-ui/svg-util.d.ts +5 -0
- package/types/core/astar/astar-path-finder.d.ts +4 -3
- package/types/core/astar/astar-util.d.ts +13 -3
- package/types/core/astar/candidate-sorter.d.ts +10 -4
- package/types/core/astar/definitions.d.ts +4 -1
- package/types/core/geom.d.ts +7 -0
- package/types/core/rtree/hilbert.d.ts +2 -1
- package/types/core/rtree/rtree.d.ts +2 -1
- package/types/core/rtree/util.d.ts +6 -0
- package/types/ui/common/paint-style.d.ts +28 -7
- package/types/ui/core/core.d.ts +3 -1
- package/types/ui/core/defaults.d.ts +6 -0
- package/types/ui/core/router/astar-path-finder.d.ts +2 -1
- package/types/ui/core/router/default-router.d.ts +2 -0
- package/types/ui/core/type-descriptors.d.ts +3 -1
- package/types/version.d.ts +1 -1
package/package.json
CHANGED
|
@@ -318,6 +318,8 @@ export declare abstract class BrowserUI<EVT = any> extends UICore<BrowserElement
|
|
|
318
318
|
* @param spec If `ctx` is an element, this is the selector
|
|
319
319
|
*/
|
|
320
320
|
$getSelector(ctx: string | Element, spec?: string): Array<VisuallyJSDOMElement>;
|
|
321
|
+
/** @internal Prepare screen bounds for a vertex drag. Other renderers retain DOM measurement. */
|
|
322
|
+
$prepareDragElementBounds(element: ViewportNodeElement<BrowserElement>): () => DOMRect;
|
|
321
323
|
$setViewportElementPosition(el: ViewportElement<BrowserElement>, p: PointXY): void;
|
|
322
324
|
/**
|
|
323
325
|
* Sets whether or not the given element, or element representing the given vertex, is draggable.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PointXY, Rotations } from "../core";
|
|
2
|
+
import { ViewportNodeElement } from "../ui";
|
|
3
|
+
import { BrowserElement } from "./util";
|
|
4
|
+
/**
|
|
5
|
+
* Screen bounds for a translated/rotated HTML vertex. The measured reference accounts for
|
|
6
|
+
* template offsets; subsequent bounds use the applied geometry without a layout read.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare class DragElementBounds {
|
|
10
|
+
private element;
|
|
11
|
+
private mapPoint;
|
|
12
|
+
private getRotations;
|
|
13
|
+
private offset;
|
|
14
|
+
private supported;
|
|
15
|
+
constructor(element: ViewportNodeElement<BrowserElement>, mapPoint: (point: PointXY) => PointXY, getRotations: () => Rotations);
|
|
16
|
+
private rotation;
|
|
17
|
+
private calculate;
|
|
18
|
+
get(): DOMRect;
|
|
19
|
+
}
|
|
@@ -123,6 +123,7 @@ export declare class ElementDragHandler2 {
|
|
|
123
123
|
* This is the current element (and associated model object) that is being dragged.
|
|
124
124
|
*/
|
|
125
125
|
private _dragContext;
|
|
126
|
+
private _getDragElementBounds;
|
|
126
127
|
/**
|
|
127
128
|
* This is the parent group of the current drag object. This is only set if the drag object was in a group at the start of the drag
|
|
128
129
|
*/
|
|
@@ -37,6 +37,7 @@ export declare class PanZoom {
|
|
|
37
37
|
private readonly _doWheelZoom;
|
|
38
38
|
eventManager: EventManager;
|
|
39
39
|
pinchListener: PinchListener;
|
|
40
|
+
private _dragViewportOffset;
|
|
40
41
|
position: PointXY;
|
|
41
42
|
zoom: number;
|
|
42
43
|
transformOrigin: PointXY;
|
|
@@ -471,6 +472,8 @@ export declare class PanZoom {
|
|
|
471
472
|
* @param y - Position of the Y coordinate of the transform origin.
|
|
472
473
|
*/
|
|
473
474
|
setTransformOrigin(x: number, y: number): void;
|
|
475
|
+
/** @internal Maps using the viewport measurement already made for the current pointer event. */
|
|
476
|
+
$toWindowLocationForDrag(point: PointXY): PointXY;
|
|
474
477
|
/**
|
|
475
478
|
* Maps the given page location to a value relative to the viewport origin, allowing for zoom and pan of the canvas. This takes into account the offset of the viewport in the page so that what you get back is the mapped position relative to the target element's [left,top] corner.
|
|
476
479
|
* @param left X location
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LabelBackgroundOptions, LabelPosition, ShapeSet } from "../../shape-library";
|
|
2
2
|
import { Group, ObjectData, PointXY, Size, Vertex, Node, BeforeConnectInterceptor } from "../../../core";
|
|
3
3
|
import { DiagramCell } from "./diagram-cell";
|
|
4
|
-
import { GridOptions, UIExportOptions, UICoreDefaults, EdgeEventOptions, OverlaySpec, ConnectorSpec, NodeEventOptions, GroupMapping, NodeMapping, AnchorSpec, EdgePropertyMappings, MagnetizeOptions, PaintStyle, OverlayVisibility, EdgeDeleteConfirmationFunction, LabelBackgroundStyle, FontSpec } from "../../../ui";
|
|
4
|
+
import { GridOptions, UIExportOptions, UICoreDefaults, EdgeEventOptions, OverlaySpec, ConnectorSpec, NodeEventOptions, GroupMapping, NodeMapping, AnchorSpec, EdgePropertyMappings, MagnetizeOptions, PaintStyle, OverlayVisibility, EdgeDeleteConfirmationFunction, LabelBackgroundStyle, FontSpec, LineStyle } from "../../../ui";
|
|
5
5
|
import type { BindableViewEvent } from "../../../ui";
|
|
6
6
|
import { SurfaceSaveData } from "../definitions";
|
|
7
7
|
import { BrowserElement } from "../../util";
|
|
@@ -150,6 +150,20 @@ export interface DiagramOptions {
|
|
|
150
150
|
* Defaults to false. If true, edges will attempt to avoid vertices wherever possible.
|
|
151
151
|
*/
|
|
152
152
|
avoidVertices?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Size of each cell in the grid that the AStar routine uses to calculate paths that avoid vertices. This defaults to 10 pixels.If you do change it, keep in mind that a) a smaller grid size increases the runtime of the routine, and b) a large grid size will render the UI unusable.
|
|
155
|
+
*/
|
|
156
|
+
astarGridCellSize?: number;
|
|
157
|
+
/**
|
|
158
|
+
* Number of cells to pad each vertex with that act as its border: edges will be routed around the border wherever possible. Defaults to 2
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
161
|
+
astarVertexBorder?: number;
|
|
162
|
+
/**
|
|
163
|
+
* Number of cells to pad each vertex with that act as its buffer: edges will be routed around the buffer wherever possible. Defaults to 2 - but note this value is added the vertex border, whose default is 2, so the computed default is 4 grid cells.
|
|
164
|
+
*
|
|
165
|
+
*/
|
|
166
|
+
astarVertexBuffer?: number;
|
|
153
167
|
/**
|
|
154
168
|
* Defaults to true - edges are editable when the user taps on them.
|
|
155
169
|
*/
|
|
@@ -259,32 +273,7 @@ export interface DiagramOptions {
|
|
|
259
273
|
/**
|
|
260
274
|
* Optional default styles for edges. These are overwritten by edges that have values in their backing data.
|
|
261
275
|
*/
|
|
262
|
-
lineStyle?:
|
|
263
|
-
/**
|
|
264
|
-
* Width of the edge path
|
|
265
|
-
*/
|
|
266
|
-
lineWidth?: number;
|
|
267
|
-
/**
|
|
268
|
-
* Width to draw the edge's outline path
|
|
269
|
-
*/
|
|
270
|
-
outlineWidth?: number;
|
|
271
|
-
/**
|
|
272
|
-
* Color to paint the edge's path
|
|
273
|
-
*/
|
|
274
|
-
color?: string;
|
|
275
|
-
/**
|
|
276
|
-
* Color to paint the edge's outline path
|
|
277
|
-
*/
|
|
278
|
-
outlineColor?: string;
|
|
279
|
-
/**
|
|
280
|
-
* Definition of dash pattern to use to draw the edge path
|
|
281
|
-
*/
|
|
282
|
-
dashArray?: string;
|
|
283
|
-
/**
|
|
284
|
-
* An array of color stops to use as a linear gradient for the edge path. When this is set, `color` is ignored.
|
|
285
|
-
*/
|
|
286
|
-
gradient?: Array<[number, string]>;
|
|
287
|
-
};
|
|
276
|
+
lineStyle?: Omit<LineStyle, "label" | "labelLocation" | "fontSize" | "fontStyle" | "fontFamily">;
|
|
288
277
|
};
|
|
289
278
|
/**
|
|
290
279
|
* Defaults to #FFFFFF
|
|
@@ -600,6 +600,8 @@ export declare class Surface extends BrowserUI<SurfaceEvents> implements Support
|
|
|
600
600
|
* @returns The mapped location, as a PointXY object.
|
|
601
601
|
*/
|
|
602
602
|
toPageLocation(left: number, top: number): PointXY;
|
|
603
|
+
/** @internal */
|
|
604
|
+
$prepareDragElementBounds(element: ViewportNodeElement<BrowserElement>): () => DOMRect;
|
|
603
605
|
/**
|
|
604
606
|
* Maps the given canvas location to a point, in page coordinates, relative to the surface container's origin. A return value of [0,0] from this method indicates the top left corner of the surface's container as seen by the user; negative values for x and/or y mean that the point is not in the visible viewport. Similarly, values for x greater the container width, or y greater than the container height, indicate that the point is not in the visible viewport.
|
|
605
607
|
*
|
|
@@ -5,6 +5,11 @@ import { LabelPosition } from "./shape-library";
|
|
|
5
5
|
export type ElementAttributes = Record<string, string | number | object>;
|
|
6
6
|
export declare function $attr(node: BrowserElement, attributes: ElementAttributes): void;
|
|
7
7
|
export declare function $svgNode(name: string, attributes?: ElementAttributes, style?: Record<string, any>, clazz?: string): SVGElement;
|
|
8
|
+
/**
|
|
9
|
+
* Release resources owned by a painted path before removing it.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function $removeSvgPathGradient(connector: SvgConnector, node: SVGElement): void;
|
|
8
13
|
/**
|
|
9
14
|
* Creates a lineargradient from the given spec.
|
|
10
15
|
* @param x1
|
|
@@ -16,14 +16,15 @@ import { HasId, HasWidthHeight, HasXY } from "../model/graph";
|
|
|
16
16
|
* @param distanceHeuristic The heuristic to use when estimating the distance between two cells in the grid.
|
|
17
17
|
* @param vertexBorder Number of cells to pad around each vertex to establish its 'border' - the vertex and the border
|
|
18
18
|
* region are considered as obstacles.
|
|
19
|
-
* @param vertexBuffer
|
|
20
|
-
* may
|
|
19
|
+
* @param vertexBuffer Additional search clearance in grid cells. Generated paths
|
|
20
|
+
* may enter this buffer while respecting vertexBorder.
|
|
21
21
|
* @param getObstacles
|
|
22
22
|
* @param getObstaclesRect
|
|
23
23
|
* @param getAdjacentCells
|
|
24
24
|
* @param hasLineOfSight
|
|
25
25
|
* @param grid
|
|
26
26
|
* @param pathId
|
|
27
|
+
* @param maxIterations Maximum heading states examined; independent of endpoint distance.
|
|
27
28
|
* @internal
|
|
28
29
|
*/
|
|
29
30
|
export declare function astar(source: PointXY, target: PointXY, sourceId: string, targetId: string, sourceOrientation: {
|
|
@@ -32,6 +33,6 @@ export declare function astar(source: PointXY, target: PointXY, sourceId: string
|
|
|
32
33
|
}, targetOrientation: {
|
|
33
34
|
ox: 1 | 0 | -1;
|
|
34
35
|
oy: 1 | 0 | -1;
|
|
35
|
-
}, gridCellSize: number, constrain: AStarPathConstrainment, distanceHeuristic: DistanceHeuristic, vertexBorder: number, vertexBuffer: number, getObstacles: (x: number, y: number, margin?: number) => Array<AStarObstacle>, getObstaclesRect: (rect: RectangleXY, margin?: number) => Array<AStarObstacle>, getAdjacentCells: AdjacentCellsFinder, hasLineOfSight: (grid: AStarGrid, l: LineXY) => boolean, grid?: AStarGrid, pathId?: string): AStarPath;
|
|
36
|
+
}, gridCellSize: number, constrain: AStarPathConstrainment, distanceHeuristic: DistanceHeuristic, vertexBorder: number, vertexBuffer: number, getObstacles: (x: number, y: number, margin?: number) => Array<AStarObstacle>, getObstaclesRect: (rect: RectangleXY, margin?: number) => Array<AStarObstacle>, getAdjacentCells: AdjacentCellsFinder, hasLineOfSight: (grid: AStarGrid, l: LineXY) => boolean, grid?: AStarGrid, pathId?: string, maxIterations?: number): AStarPath;
|
|
36
37
|
export interface AStarObstacle extends HasId, HasXY, HasWidthHeight {
|
|
37
38
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DirectionFromParent, ParentAxis, PathFinderGridCell } from "./definitions";
|
|
2
2
|
import { AStarObstacle } from "./astar-path-finder";
|
|
3
|
-
import { PointXY, RectangleXY } from "../util";
|
|
3
|
+
import { LineXY, PointXY, RectangleXY } from "../util";
|
|
4
4
|
/**
|
|
5
|
-
* Grid for an A* path search. Access to grid cells is via the `getCell` method, which lazy loads cell entries. This implementation uses an object in the back end, whose keys are in the form `${x}_${y}`.
|
|
5
|
+
* Grid for an A* path search. Access to grid cells is via the `getCell` method, which lazy loads cell entries. This implementation uses an object in the back end, whose keys are in the form `${x}_${y}`. Cached obstacle membership is independent of endpoint exemptions so the grid can be reused for searches against the same viewport state.
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
export declare class AStarGrid {
|
|
@@ -11,6 +11,7 @@ export declare class AStarGrid {
|
|
|
11
11
|
vertexBuffer: number;
|
|
12
12
|
private getCoincidentObstacles;
|
|
13
13
|
private _grid;
|
|
14
|
+
private _states;
|
|
14
15
|
private _canvasOrigin;
|
|
15
16
|
private readonly _obstaclePadding;
|
|
16
17
|
constructor(source: PointXY, target: PointXY, gridCellSize: number, vertexBorder: number, vertexBuffer: number, getCoincidentObstacles: (canvasX: number, canvasY: number, padding: number) => Array<AStarObstacle>);
|
|
@@ -29,16 +30,25 @@ export declare class AStarGrid {
|
|
|
29
30
|
targetObstacles: Array<string>;
|
|
30
31
|
sourceBuffers: Array<string>;
|
|
31
32
|
targetBuffers: Array<string>;
|
|
33
|
+
private _endpointPositions;
|
|
32
34
|
sourceAxis: ParentAxis;
|
|
33
35
|
sourceDirection: DirectionFromParent;
|
|
34
36
|
targetAxis: ParentAxis;
|
|
35
37
|
targetDirection: DirectionFromParent;
|
|
36
38
|
makeKey(x: number, y: number): string;
|
|
39
|
+
/** Search scores belong to an arrival heading; obstacle membership is shared. */
|
|
40
|
+
getState(x: number, y: number, axis: ParentAxis, direction: DirectionFromParent): PathFinderGridCell;
|
|
37
41
|
private _shouldIgnoreObstacle;
|
|
42
|
+
/** Apply this search's endpoint exemptions without changing cached occupancy. */
|
|
43
|
+
isCellBlocked(cell: PathFinderGridCell): boolean;
|
|
44
|
+
/** Check the complete segment, including space between adjacent grid samples. */
|
|
45
|
+
isLineClear(line: LineXY, padding: number, getObstaclesRect: (rect: RectangleXY, margin?: number) => Array<AStarObstacle>): boolean;
|
|
38
46
|
private _getCell;
|
|
39
47
|
setSourceCell(id: string, x: number, y: number, ax: number, ay: number, axis: ParentAxis, direction: DirectionFromParent): PathFinderGridCell;
|
|
40
48
|
setTargetCell(id: string, x: number, y: number, ax: number, ay: number, axis: ParentAxis, direction: DirectionFromParent): PathFinderGridCell;
|
|
41
49
|
get sourceAndTargetObstacles(): string[];
|
|
50
|
+
/** Whole-vertex exemptions for the current connection, including endpoint buffers. */
|
|
51
|
+
get sourceAndTargetExemptions(): Array<string>;
|
|
42
52
|
/**
|
|
43
53
|
* Gets a cell from the grid, lazy loading it if it does not exist.
|
|
44
54
|
* @param x Grid X
|
|
@@ -48,7 +58,7 @@ export declare class AStarGrid {
|
|
|
48
58
|
*/
|
|
49
59
|
getCell(x: number, y: number, ax: number, ay: number): PathFinderGridCell;
|
|
50
60
|
/**
|
|
51
|
-
*
|
|
61
|
+
* Reset search state and endpoint exemptions, retaining raw obstacle membership.
|
|
52
62
|
*/
|
|
53
63
|
reinitialize(): void;
|
|
54
64
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { PathFinderGridCell } from "./definitions";
|
|
2
|
+
import { PointXY } from "../util";
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* Stable priority ordering: estimated total cost, remaining cost, exact endpoint
|
|
5
|
+
* distance, then discovery order. Comparisons never depend on the focus node.
|
|
4
6
|
* @internal
|
|
5
7
|
*/
|
|
6
8
|
export declare class CandidateSorter {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
private readonly _sequence;
|
|
10
|
+
private _nextSequence;
|
|
11
|
+
private readonly _target;
|
|
12
|
+
constructor(target?: PointXY);
|
|
13
|
+
/** Register a cell once, before adding it to the queue. Updates retain its order. */
|
|
14
|
+
register(cell: PathFinderGridCell): void;
|
|
15
|
+
sort(n1: PathFinderGridCell, n2: PathFinderGridCell): number;
|
|
10
16
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { DiagonalAxis, OrthogonalAxis, PATH_CONSTRAIN_DIAGONAL, PATH_CONSTRAIN_MANHATTAN, PATH_CONSTRAIN_METRO, PATH_CONSTRAIN_NONE, PATH_CONSTRAIN_ORTHOGONAL } from "../constants";
|
|
2
2
|
export type DistanceHeuristic = (x1: number, y1: number, x2: number, y2: number) => number;
|
|
3
|
+
/** Default maximum number of heading states examined by one search. @internal */
|
|
4
|
+
export declare const DEFAULT_ASTAR_MAX_ITERATIONS = 10000;
|
|
3
5
|
/**
|
|
4
6
|
* A segment in an a* path
|
|
5
7
|
* @internal
|
|
@@ -24,7 +26,8 @@ export interface AStarPath {
|
|
|
24
26
|
isEmpty: boolean;
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
|
-
* A
|
|
29
|
+
* A grid location or search state. Heading-specific states share the location's
|
|
30
|
+
* obstacle arrays but have independent scores, parents and open/closed flags.
|
|
28
31
|
* @internal
|
|
29
32
|
*/
|
|
30
33
|
export interface PathFinderGridCell {
|
package/types/core/geom.d.ts
CHANGED
|
@@ -114,6 +114,13 @@ export declare function lineRectangleIntersection(line: LineXY, r: RectangleXY):
|
|
|
114
114
|
* @internal
|
|
115
115
|
*/
|
|
116
116
|
export declare function lineIntersectsOrIsEnclosedByRectangle(line: LineXY, r: RectangleXY): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Whether a segment enters the interior of a rectangle expanded by `padding`.
|
|
119
|
+
* Contact with the clearance boundary is permitted. Unlike offset-line tests,
|
|
120
|
+
* this also detects small obstacles and segments entirely inside an obstacle.
|
|
121
|
+
* @internal
|
|
122
|
+
*/
|
|
123
|
+
export declare function lineIntersectsRectangleInterior(line: LineXY, r: RectangleXY, padding?: number): boolean;
|
|
117
124
|
/**
|
|
118
125
|
* Calculates whether or not r2 is completely enclosed by r1.
|
|
119
126
|
* @param r1 First rectangle
|
|
@@ -4,6 +4,7 @@ import { RectangleXY } from "../util";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const HilbertCurves: {
|
|
6
6
|
sortRect: <T extends RectangleXY>(listOfRectangles: Array<T>) => Array<T>;
|
|
7
|
-
|
|
7
|
+
/** Convert integer coordinates on a 2^order square to an unsigned Hilbert key (orders 1–16). */
|
|
8
|
+
toHilbertCoordinates: (order: number, x: number, y: number) => number;
|
|
8
9
|
hilbertInterleaveBits: (odd: number, even: number) => number;
|
|
9
10
|
};
|
|
@@ -87,7 +87,8 @@ export declare class RTree<DataPayload extends ObjectData = ObjectData> {
|
|
|
87
87
|
*/
|
|
88
88
|
searchById(id: string): RTreeRegion;
|
|
89
89
|
/**
|
|
90
|
-
* Update the position of the given record
|
|
90
|
+
* Update the position of the given record without condensing nonempty branches.
|
|
91
|
+
* Only the updated record is reinserted; its old ancestor bounds are refitted once.
|
|
91
92
|
* @param id
|
|
92
93
|
* @param x
|
|
93
94
|
* @param y
|
|
@@ -8,6 +8,12 @@ export declare function _growToFit(rectToGrow: RTreeRegion, otherRect: RTreeRegi
|
|
|
8
8
|
* @private
|
|
9
9
|
*/
|
|
10
10
|
export declare function _updateRTreeRegionBounds(rect: RTreeRegion): void;
|
|
11
|
+
/**
|
|
12
|
+
* Refit only this region to its immediate children. Empty regions use the same
|
|
13
|
+
* bounds as `_emptyRTreeRegion`; callers prune empty branches before refitting parents.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare function _refitRTreeRegionBounds(rect: RTreeRegion): void;
|
|
11
17
|
export declare function _areaIfGrownBy(rectToGrow: RTreeRegion, otherRect: RTreeRegion): number;
|
|
12
18
|
export declare function splitIntoSiblings(r: RTreeRegion): [RTreeRegion, RTreeRegion];
|
|
13
19
|
/**
|
|
@@ -4,7 +4,7 @@ import { LineStyle } from "../core";
|
|
|
4
4
|
* @group UI
|
|
5
5
|
* @category Definitions
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface StrokePaintStyle {
|
|
8
8
|
/**
|
|
9
9
|
* Stroke color for the edge
|
|
10
10
|
*/
|
|
@@ -17,6 +17,30 @@ export interface PaintStyle {
|
|
|
17
17
|
* Width of the stroke
|
|
18
18
|
*/
|
|
19
19
|
strokeWidth?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Definition for stroke pattern
|
|
22
|
+
*/
|
|
23
|
+
dashArray?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Definition of a linear gradient to apply. Each entry is [offset, color].
|
|
26
|
+
*/
|
|
27
|
+
gradient?: Array<[number, string]>;
|
|
28
|
+
opacity?: number;
|
|
29
|
+
strokeOpacity?: number;
|
|
30
|
+
"stroke-linejoin"?: string;
|
|
31
|
+
"stroke-dashoffset"?: string | number;
|
|
32
|
+
"stroke-linecap"?: string;
|
|
33
|
+
}
|
|
34
|
+
/** An outline's width increment is added to each side of the preceding stroke. */
|
|
35
|
+
export interface ConnectorOutline extends Omit<StrokePaintStyle, "strokeWidth"> {
|
|
36
|
+
outlineWidth: number;
|
|
37
|
+
}
|
|
38
|
+
/** Edge-facing outline settings. Width is added on each side of the preceding stroke. */
|
|
39
|
+
export interface EdgeOutlineStyle extends Omit<StrokePaintStyle, "stroke" | "strokeWidth"> {
|
|
40
|
+
width: number;
|
|
41
|
+
color?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface PaintStyle extends StrokePaintStyle {
|
|
20
44
|
/**
|
|
21
45
|
* Color for the outline path
|
|
22
46
|
*/
|
|
@@ -26,13 +50,10 @@ export interface PaintStyle {
|
|
|
26
50
|
*/
|
|
27
51
|
outlineWidth?: number;
|
|
28
52
|
/**
|
|
29
|
-
*
|
|
30
|
-
|
|
31
|
-
dashArray?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Definition of a linear gradient to apply. Each entry is [offset, color].
|
|
53
|
+
* Low-level decorative layers, innermost first. Replaces legacy outline settings
|
|
54
|
+
* when supplied; [] disables decorative outlines. Layers do not change on hover.
|
|
34
55
|
*/
|
|
35
|
-
|
|
56
|
+
outlines?: Array<ConnectorOutline>;
|
|
36
57
|
}
|
|
37
58
|
/**
|
|
38
59
|
* @internal
|
package/types/ui/core/core.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ConnectionEstablishedParams } from "./callbacks";
|
|
|
6
6
|
import { Viewport, ViewportElement, ViewportGroupElement, ViewportNodeElement } from "./viewport";
|
|
7
7
|
import { ComponentBase } from './component/component';
|
|
8
8
|
import { LabelOverlay } from './overlay/label-overlay';
|
|
9
|
-
import { AnchorSpec, LightweightAnchor, FullOverlaySpec, OverlaySpec, Connector, PaintStyle, ConnectorSpec, SingleAnchorSpec } from "../common";
|
|
9
|
+
import { AnchorSpec, LightweightAnchor, FullOverlaySpec, OverlaySpec, Connector, PaintStyle, ConnectorSpec, SingleAnchorSpec, EdgeOutlineStyle } from "../common";
|
|
10
10
|
import { GroupRelayoutReason } from './event-constants';
|
|
11
11
|
import { Connection } from "./connector/connection-impl";
|
|
12
12
|
import { Base, Edge, Group, Node, ObjectData, Port, Vertex, IntersectingVertex, PortRemovedParams, PortAddedParams, ProxyLocation, ObjectAnchorSpec } from "../../core";
|
|
@@ -82,6 +82,8 @@ export interface LineStyle {
|
|
|
82
82
|
* An array of color stops to use as a linear gradient for the edge path. When this is set, `color` is ignored.
|
|
83
83
|
*/
|
|
84
84
|
gradient?: Array<[number, string]>;
|
|
85
|
+
/** Ordered outline layers. Each width increment is added to each side. */
|
|
86
|
+
outlines?: Array<EdgeOutlineStyle>;
|
|
85
87
|
/**
|
|
86
88
|
* Label to show on the edge
|
|
87
89
|
*/
|
|
@@ -92,6 +92,12 @@ export interface UIEdgeOptions {
|
|
|
92
92
|
* Size of each cell in the grid that the AStar routine uses to calculate paths that avoid vertices. This defaults to 10 pixels and is not something you'll really need to change. If you do change it, keep in mind that a) a smaller grid size increases the runtime of the routine, and b) a large grid size will render the UI unusable.
|
|
93
93
|
*/
|
|
94
94
|
astarGridCellSize?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Maximum heading states examined per vertex-avoidance search. Defaults to
|
|
97
|
+
* 10000, regardless of endpoint distance. Must be a positive integer.
|
|
98
|
+
* Exhaustion uses the normal connector fallback.
|
|
99
|
+
*/
|
|
100
|
+
astarMaxIterations?: number;
|
|
95
101
|
/**
|
|
96
102
|
* Number of cells to pad each vertex with that act as its border: edges will be routed around the border wherever possible. Defaults to 2
|
|
97
103
|
*
|
|
@@ -18,6 +18,7 @@ import { AStarGrid } from "../../../core/astar/astar-util";
|
|
|
18
18
|
* @param vertexBuffer
|
|
19
19
|
* @param grid
|
|
20
20
|
* @param pathId
|
|
21
|
+
* @param maxIterations Maximum heading states examined by this search.
|
|
21
22
|
* @internal
|
|
22
23
|
*/
|
|
23
24
|
export declare function astarFromViewport(source: PointXY, target: PointXY, sourceId: string, targetId: string, sourceOrientation: {
|
|
@@ -26,4 +27,4 @@ export declare function astarFromViewport(source: PointXY, target: PointXY, sour
|
|
|
26
27
|
}, targetOrientation: {
|
|
27
28
|
ox: 1 | 0 | -1;
|
|
28
29
|
oy: 1 | 0 | -1;
|
|
29
|
-
}, viewport: Viewport<any>, gridCellSize: number, constrain: AStarPathConstrainment, distanceHeuristic: DistanceHeuristic, vertexBorder: number, vertexBuffer: number, grid?: AStarGrid, pathId?: string): AStarPath;
|
|
30
|
+
}, viewport: Viewport<any>, gridCellSize: number, constrain: AStarPathConstrainment, distanceHeuristic: DistanceHeuristic, vertexBorder: number, vertexBuffer: number, grid?: AStarGrid, pathId?: string, maxIterations?: number): AStarPath;
|
|
@@ -13,6 +13,7 @@ export interface DefaultRouterOptions {
|
|
|
13
13
|
avoidVertices?: boolean;
|
|
14
14
|
vertexBuffer?: number;
|
|
15
15
|
vertexBorder?: number;
|
|
16
|
+
maxIterations?: number;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* The default router paints edges with anchor computation. This class manages continuous anchors and offers A* vertex avoidance.
|
|
@@ -26,6 +27,7 @@ export declare class DefaultRouter<EL> implements Router<EL> {
|
|
|
26
27
|
private _gridCellSize;
|
|
27
28
|
private _vertexBuffer;
|
|
28
29
|
private _vertexBorder;
|
|
30
|
+
private _maxIterations;
|
|
29
31
|
private _orientationCache;
|
|
30
32
|
private _orientationCacheTimestamp;
|
|
31
33
|
private _grid;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnchorSpec, OverlaySpec, PaintStyle, ConnectorSpec, FullOverlaySpec, InternalOverlaySpec } from "../common";
|
|
1
|
+
import { AnchorSpec, OverlaySpec, PaintStyle, ConnectorSpec, FullOverlaySpec, InternalOverlaySpec, EdgeOutlineStyle } from "../common";
|
|
2
2
|
/**
|
|
3
3
|
* Base interface for vertex/edge types. This interface contains parameters that are common between the two types, and is shared by internal methods and public methods.
|
|
4
4
|
* @group UI
|
|
@@ -13,6 +13,8 @@ export interface TypeDescriptorBase {
|
|
|
13
13
|
* Paint style to use for the component.
|
|
14
14
|
*/
|
|
15
15
|
paintStyle?: PaintStyle;
|
|
16
|
+
/** Edge outline layers. When supplied, replaces the existing edge outline array. */
|
|
17
|
+
outlines?: Array<EdgeOutlineStyle>;
|
|
16
18
|
/**
|
|
17
19
|
* Paint style to use for the component when the pointer is hovering over it.
|
|
18
20
|
*/
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.2.
|
|
1
|
+
export declare const VERSION = "1.2.12";
|