Skip to content

Commit 3d178a0

Browse files
Diede Kerkhofkodiakhq[bot]
Diede Kerkhof
authored andcommitted
feat: add setting for lock on node
1 parent 1146e68 commit 3d178a0

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

frank-flow/src/frontend/src/app/header/settings/options/default-settings.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ export class DefaultSettings implements Settings {
1717
ignoreConfigurationSettings = false;
1818
showExplorer = true;
1919
showUnsavedChangesWarning = true;
20+
automaticPanzoom = false;
2021
}

frank-flow/src/frontend/src/app/header/settings/settings.component.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,5 +198,17 @@ <h2>Flow</h2>
198198
(stateChange)="setSettings()"
199199
></app-toggle>
200200
</div>
201+
<hr />
202+
<h2>Assistance</h2>
203+
<div class="input-row">
204+
<label
205+
title="When pressing code in the editor the flow automatically locks onto the corresponding node in the flowchart"
206+
>Automatically move flow to selected code</label
207+
>
208+
<app-toggle
209+
[(state)]="settings.automaticPanzoom"
210+
(stateChange)="setSettings()"
211+
></app-toggle>
212+
</div>
201213
</div>
202214
</ngx-smart-modal>

frank-flow/src/frontend/src/app/header/settings/settings.model.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ export interface Settings extends FlowSettings {
1111
useLastMode: boolean;
1212
switchWithoutSaving: SwitchWithoutSavingOption;
1313
ignoreConfigurationSettings: boolean;
14+
automaticPanzoom: boolean;
1415
}

frank-flow/src/frontend/src/app/shared/services/flow-structure.service.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ import { File } from '../models/file.model';
1313
import { FlowStructure } from '../models/flow-structure.model';
1414
import { ChangedAttribute } from '../models/changed-attribute.model';
1515
import { PanZoomService } from './pan-zoom.service';
16+
import { SettingsService } from '../../header/settings/settings.service';
17+
import { Settings } from '../../header/settings/settings.model';
1618

1719
@Injectable({
1820
providedIn: 'root',
1921
})
2022
export class FlowStructureService {
2123
public monacoEditorComponent?: MonacoEditorComponent;
2224
public selectedNode?: FlowStructureNode;
25+
public settings!: Settings;
2326

2427
private currentFile!: File;
2528
private flowStructure!: FlowStructure;
@@ -29,9 +32,17 @@ export class FlowStructureService {
2932

3033
constructor(
3134
private currentFileService: CurrentFileService,
32-
private panZoomService: PanZoomService
35+
private panZoomService: PanZoomService,
36+
private settingsService: SettingsService
3337
) {
3438
this.getCurrentFile();
39+
this.subscribeToSettings();
40+
}
41+
42+
subscribeToSettings(): void {
43+
this.settingsService
44+
.getSettings()
45+
.subscribe((settings) => (this.settings = settings));
3546
}
3647

3748
getCurrentFile(): void {
@@ -63,7 +74,9 @@ export class FlowStructureService {
6374
this.isNodeAtPosition(node, position)
6475
);
6576
this.resetHighlightNodeInXml();
66-
this.panToNode();
77+
if (this.settings.automaticPanzoom) {
78+
this.panToNode();
79+
}
6780
}
6881

6982
isNodeAtPosition(

0 commit comments

Comments
 (0)