Skip to content

Commit f40a1ec

Browse files
fix: add will-change and transform properties for canvas during dragging
1 parent 3800230 commit f40a1ec

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

projects/f-flow/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@foblex/flow",
3-
"version": "17.8.9",
3+
"version": "17.9.0",
44
"description": "An Angular library designed to simplify the creation and manipulation of dynamic flow. Provides components for flows, nodes, and connections, automating node manipulation and inter-node connections.",
55
"main": "index.js",
66
"types": "index.d.ts",

projects/f-flow/src/f-canvas/f-canvas.component.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,9 @@
77
top: 0;
88
transform-origin: 0 0;
99
pointer-events: none;
10+
11+
&.canvas-dragging {
12+
will-change: transform;
13+
transform: translateZ(0);
14+
}
1015
}

projects/f-flow/src/f-draggable/f-canvas/f-canvas.drag-handler.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ import { FComponentsStore } from '../../f-storage';
44
import { Injector } from '@angular/core';
55

66
export class FCanvasDragHandler implements IFDragHandler {
7-
87
public fEventType = 'canvas-move';
98

109
private readonly _store: FComponentsStore;
1110
private _onPointerDownPosition: IPoint = PointExtensions.initialize();
1211

13-
constructor(
14-
_injector: Injector,
15-
) {
12+
constructor(_injector: Injector) {
1613
this._store = _injector.get(FComponentsStore);
14+
this._store.fCanvas?.hostElement.classList.add('canvas-dragging');
1715
}
1816

1917
public prepareDragSequence(): void {
@@ -27,5 +25,6 @@ export class FCanvasDragHandler implements IFDragHandler {
2725

2826
public onPointerUp(): void {
2927
this._store.fCanvas!.emitCanvasChangeEvent();
28+
this._store.fCanvas?.hostElement.classList.remove('canvas-dragging');
3029
}
3130
}

projects/f-flow/src/f-flow/f-flow.component.scss

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,4 @@
2828
left: 0 !important;
2929
top: 0 !important;
3030
}
31-
32-
&.f-dragging {
33-
.f-canvas {
34-
will-change: transform;
35-
transform: translateZ(0);
36-
}
37-
}
3831
}

0 commit comments

Comments
 (0)