Skip to content
Open
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# CHANGELOG

## HEAD (unreleased)
## 10.0.0-alpha.1 (HEAD) (unreleased)

- Fix: Prevent click event on a node when dragged

## 10.0.0-alpha.0 (unreleased)

- Enhancement: Support Angular 19, `standalone` now required in all `@Component`

Expand Down
2 changes: 1 addition & 1 deletion projects/swimlane/ngx-graph/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@swimlane/ngx-graph",
"version": "10.0.0-alpha.0",
"version": "10.0.0-alpha.1",
"description": "Graph visualization for angular",
"repository": {
"type": "git",
Expand Down
7 changes: 6 additions & 1 deletion projects/swimlane/ngx-graph/src/lib/graph/graph.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export class GraphComponent implements OnInit, OnChanges, OnDestroy, AfterViewIn
public chartWidth: any;

private isMouseMoveCalled: boolean = false;
private isMouseMoveCalledOnNode: boolean = false;

graphSubscription: Subscription = new Subscription();
colors: ColorHelper;
Expand Down Expand Up @@ -888,6 +889,7 @@ export class GraphComponent implements OnInit, OnChanges, OnDestroy, AfterViewIn
if (!this.draggingEnabled) {
return;
}
this.isMouseMoveCalledOnNode = true;
const node = this.draggingNode;
if (this.layout && typeof this.layout !== 'string' && this.layout.onDrag) {
this.layout.onDrag(node, event);
Expand Down Expand Up @@ -950,7 +952,9 @@ export class GraphComponent implements OnInit, OnChanges, OnDestroy, AfterViewIn
* @memberOf GraphComponent
*/
onClick(event: any): void {
this.select.emit(event);
if (!this.isMouseMoveCalledOnNode) {
this.select.emit(event);
}
}

/**
Expand Down Expand Up @@ -1111,6 +1115,7 @@ export class GraphComponent implements OnInit, OnChanges, OnDestroy, AfterViewIn
if (!this.draggingEnabled) {
return;
}
this.isMouseMoveCalledOnNode = false;
this.isDragging = true;
this.draggingNode = node;

Expand Down