Skip to content

Commit 0368c83

Browse files
committed
Fix the playground
1 parent 2a260b7 commit 0368c83

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

projects/frank-config-layout/src/public_api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,6 @@ export {
136136
calculateNumCrossingsChangesFromAligning,
137137
minimizeNumCrossings,
138138
} from './lib/model/layout-base';
139-
export { getDerivedDimensions } from './lib/dimensions';
139+
export { getDerivedDimensions, DerivedDimensions } from './lib/dimensions';
140140
export { LayoutModel, LayoutModelBuilder } from './lib/model/layout-model';
141141
export { LayoutBuilder, Layout, PlacedNode, EdgeLabel, getNumCrossingLines } from './lib/graphics/layout';

src/app/components/flow-chart-editor/flow-chart-editor.component.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ import {
3232
GraphForLayers,
3333
Dimensions,
3434
getFactoryDimensions,
35-
getDerivedEdgeLabelDimensions,
3635
Layout,
3736
PlacedNode,
3837
OriginalGraphReferencingIntermediates,
3938
LayoutModel,
4039
LayoutModelBuilder,
4140
LayoutBuilder,
4241
getNumCrossingLines,
42+
getDerivedDimensions,
43+
DerivedDimensions,
4344
} from 'frank-config-layout';
4445
import { IntermediatesCreationResult } from 'frank-config-layout';
4546

@@ -103,7 +104,7 @@ export class FlowChartEditorComponent implements OnInit {
103104
}
104105
}
105106

106-
dimensions = getFactoryDimensions();
107+
dimensions = getDerivedDimensions(getFactoryDimensions());
107108
drawing: Drawing | null = null;
108109
numCrossingLines: number = 0;
109110

@@ -138,7 +139,7 @@ export class FlowChartEditorComponent implements OnInit {
138139
mermaid2graph(text: string): OriginalGraphOrError {
139140
let graph: OriginalGraph;
140141
try {
141-
const b = getGraphFromMermaid(text, this.dimensions, this.dimensions);
142+
const b = getGraphFromMermaid(text, this.dimensions);
142143
graph = findErrorFlow(b);
143144
} catch (error) {
144145
return { graph: null, error: `Invalid mermaid text: ${(error as Error).message}` };
@@ -220,20 +221,15 @@ export class FlowChartEditorComponent implements OnInit {
220221

221222
static model2layout(
222223
model: NodeSequenceEditor,
223-
inDimensions: Dimensions,
224+
inDimensions: DerivedDimensions,
224225
originalGraph: OriginalGraphReferencingIntermediates,
225226
): Layout {
226227
const layoutModel: LayoutModel = new LayoutModelBuilder(model.getShownNodesLayoutBase(), model.graph).run();
227-
return new LayoutBuilder(
228-
layoutModel,
229-
originalGraph,
230-
inDimensions,
231-
getDerivedEdgeLabelDimensions(inDimensions),
232-
).run();
228+
return new LayoutBuilder(layoutModel, originalGraph, inDimensions, inDimensions).run();
233229
}
234230

235231
onNewDimensions(d: Dimensions): void {
236-
this.dimensions = d;
232+
this.dimensions = getDerivedDimensions(d);
237233
this.updateDrawing();
238234
}
239235
}

0 commit comments

Comments
 (0)