Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export { Editor } from './editor/Editor.js';

export { default as CellHighlight } from './view/cell/CellHighlight.js';
export { default as CellMarker } from './view/cell/CellMarker.js';
export { ConnectionHandlerCellMarker } from './view/plugins/ConnectionHandler.js';
export { default as CellTracker } from './view/cell/CellTracker.js';
export { default as ConstraintHandler } from './view/handler/ConstraintHandler.js';
export { default as EdgeHandler } from './view/handler/EdgeHandler.js';
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/view/GraphView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1138,10 +1138,10 @@ export class GraphView extends EventSource {
edge: CellState,
terminal: CellState | null,
source: boolean,
constraint: ConnectionConstraint
constraint: ConnectionConstraint | null
) {
edge.setAbsoluteTerminalPoint(
<Point>this.getFixedTerminalPoint(edge, terminal, source, constraint),
this.getFixedTerminalPoint(edge, terminal, source, constraint),
source
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/view/cell/CellHighlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class CellHighlight {
}

/**
* Marks the {@link arkedState} and fires a {@link ark} event.
* Marks the {@link CellState} and fires a {@link InternalEvent.MARK} event.
*/
highlight(state: CellState | null = null): void {
if (this.state !== state) {
Expand Down
10 changes: 9 additions & 1 deletion packages/core/src/view/cell/CellMarker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,15 @@ class CellMarker extends EventSource {
this.validColor = validColor;
this.invalidColor = invalidColor;
this.hotspot = hotspot;
this.highlight = new CellHighlight(graph);
this.highlight = this.createCellHighlight(graph);
}

/**
* Hook method to override the implementation of {@link highlight}.
* @since 0.22.0
*/
protected createCellHighlight(graph: AbstractGraph): CellHighlight {
return new CellHighlight(graph);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/view/geometry/Geometry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class Geometry extends Rectangle {
* @param {Point} point to be used as the new source or target point.
* @param {Boolean} isSource that specifies if the source or target point should be set.
*/
setTerminalPoint(point: Point, isSource: boolean) {
setTerminalPoint(point: Point | null, isSource: boolean) {
if (isSource) {
this.sourcePoint = point;
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/view/mixins/CellsMixin.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ declare module '../AbstractGraph' {
*/
addCell: (
cell: Cell,
parent: Cell | null,
parent?: Cell | null,
index?: number | null,
source?: Cell | null,
target?: Cell | null
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/view/mixins/EdgeMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,16 +247,16 @@ export const EdgeMixin: PartialType = {
},

createEdge(
parent = null,
_parent = null,
id,
value,
source = null,
target = null,
_source = null,
_target = null,
style: CellStyle = {}
) {
// Creates the edge
const edge = new Cell(value, new Geometry(), style);
edge.setId(id);
edge.setId(id!); // this is not an issue to set undefined here. If so, the id will be auto-generated when adding the cell to the model
edge.setEdge(true);
edge.geometry!.relative = true; // geometry is set when creating the cell above
return edge;
Expand Down
16 changes: 8 additions & 8 deletions packages/core/src/view/mixins/EdgeMixin.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ declare module '../AbstractGraph' {
* @param style Optional object that defines the cell style.
*/
insertEdge(
parent: Cell | null,
id: string | null | undefined,
value: EdgeParametersValue,
parent?: Cell | null,
id?: string | null,
value?: EdgeParametersValue,
source?: Cell | null,
target?: Cell | null,
style?: CellStyle
Expand Down Expand Up @@ -213,11 +213,11 @@ declare module '../AbstractGraph' {
* @param style Optional object that defines the cell style.
*/
createEdge: (
parent: Cell | null,
id: string,
value: any,
source: Cell | null,
target: Cell | null,
parent?: Cell | null,
id?: string,
value?: any,
source?: Cell | null,
target?: Cell | null,
style?: CellStyle
) => Cell;

Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/view/mixins/VertexMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ export const VertexMixin: PartialType = {
},

createVertex(
_parent: Cell | null,
id: string,
value: any,
_parent?: Cell | null,
id?: string,
value?: any,
x?: number,
y?: number,
width?: number,
Expand All @@ -115,7 +115,7 @@ export const VertexMixin: PartialType = {

// Creates the vertex
const vertex = new Cell(value, geometry, style);
vertex.setId(id);
vertex.setId(id!); // this is not an issue to set undefined here. If so, the id will be auto-generated when adding the cell to the model
vertex.setVertex(true);
vertex.setConnectable(true);

Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/view/mixins/VertexMixin.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ declare module '../AbstractGraph' {
* This can be useful for defining custom constraints. Default is {@link Geometry}.
*/
insertVertex(
parent: Cell | null,
id: string | null | undefined,
value: any,
parent?: Cell | null,
id?: string | null,
value?: any,
x?: number,
y?: number,
width?: number,
Expand Down Expand Up @@ -162,9 +162,9 @@ declare module '../AbstractGraph' {
* This can be useful for defining custom constraints. Default is {@link Geometry}.
*/
createVertex(
parent: Cell | null,
id: string | null | undefined,
value: any,
parent?: Cell | null,
id?: string | null,
value?: any,
x?: number,
y?: number,
width?: number,
Expand Down
Loading