@@ -48,6 +48,7 @@ import { IFlowCanvasBase } from './flow-canvas';
4848import { FlowCore } from './flow-core' ;
4949import { GetNodeTaskFactory } from '../interfaces/node-task-registry' ;
5050import { LayoutProperties } from '../interfaces/layout-properties' ;
51+ import { FlowCanvasOptions } from '../interfaces/flow-canvas' ;
5152
5253export const createFlowCanvas = < T extends BaseNodeInfo > (
5354 rootElement : HTMLElement ,
@@ -71,7 +72,8 @@ export const createFlowCanvas = <T extends BaseNodeInfo>(
7172 isCancelling : boolean
7273 ) => void ,
7374 rootFlowCanvas ?: IFlowCanvasBase < T > ,
74- getNodeTaskFactory ?: GetNodeTaskFactory < T >
75+ getNodeTaskFactory ?: GetNodeTaskFactory < T > ,
76+ options ?: FlowCanvasOptions
7577) : IFlowCanvasBase < T > => {
7678 return new FlowCanvas (
7779 rootElement ,
@@ -88,7 +90,8 @@ export const createFlowCanvas = <T extends BaseNodeInfo>(
8890 onDroppedOnNode ,
8991 onDraggingOverNode ,
9092 rootFlowCanvas ,
91- getNodeTaskFactory
93+ getNodeTaskFactory ,
94+ options
9295 ) ;
9396} ;
9497
@@ -107,6 +110,9 @@ export class FlowCanvas<T extends BaseNodeInfo>
107110 public isContextOnly = false ;
108111 public isComposition = false ;
109112
113+ public hasNodeTypeSideBar ?: boolean ;
114+ public nodeTypeSideBarSelector ?: string ;
115+
110116 private rectInstanceList : Record < string , Rect < T > > ;
111117 private CanvasClickEvent : Event ;
112118 private animationFunctions : undefined | AnimatePathFunctions < T > ;
@@ -179,6 +185,7 @@ export class FlowCanvas<T extends BaseNodeInfo>
179185 | undefined ;
180186
181187 private rootFlowCanvas : IFlowCanvasBase < T > | undefined ;
188+
182189 public getRootFlowCanvas = ( ) => this . rootFlowCanvas ;
183190 constructor (
184191 rootElement : HTMLElement ,
@@ -202,7 +209,8 @@ export class FlowCanvas<T extends BaseNodeInfo>
202209 isCancelling : boolean
203210 ) => void ,
204211 rootFlowCanvas ?: IFlowCanvasBase < T > ,
205- getNodeTaskFactory ?: GetNodeTaskFactory < T >
212+ getNodeTaskFactory ?: GetNodeTaskFactory < T > ,
213+ options ?: FlowCanvasOptions
206214 ) {
207215 super ( ) ;
208216 this . rootFlowCanvas = rootFlowCanvas ;
@@ -212,6 +220,9 @@ export class FlowCanvas<T extends BaseNodeInfo>
212220 heightSpaceForHeaderFooterToolbars ;
213221 this . widthSpaceForSideToobars = widthSpaceForSideToobars ;
214222
223+ this . hasNodeTypeSideBar = options ?. hasNodeTypeSideBar ;
224+ this . nodeTypeSideBarSelector = options ?. nodeTypeSideBarSelector ;
225+
215226 this . rootElement = rootElement ;
216227 this . theme = customTheme ?? standardTheme ;
217228 this . interactionStateMachine =
@@ -1193,8 +1204,11 @@ export class FlowCanvas<T extends BaseNodeInfo>
11931204 const helperScale = rootWidth / helperWidth ;
11941205 const helperHeight = maxY - minY ;
11951206 const helperScaleHeight = rootHeight / helperHeight ;
1196-
1197- const width = maxX - minX + 120 / helperScale ;
1207+ let offsetNodesidebar = 0 ;
1208+ if ( this . hasNodeTypeSideBar ) {
1209+ offsetNodesidebar = 280 ;
1210+ }
1211+ const width = maxX - minX + ( 120 + offsetNodesidebar ) / helperScale ;
11981212 const height = maxY - minY + 240 / helperScaleHeight ;
11991213
12001214 let scale = rootWidth / width ;
@@ -1242,11 +1256,16 @@ export class FlowCanvas<T extends BaseNodeInfo>
12421256 this . heightSpaceForHeaderFooterToolbars ?? 0
12431257 ) ; // 100; //-150 //-boundingBox.y; // -500; //boundingBox.y;
12441258
1259+ let xOffsetNodesidebar = 0 ;
1260+ if ( this . hasNodeTypeSideBar ) {
1261+ xOffsetNodesidebar = 200 ;
1262+ }
12451263 this . xCamera =
12461264 rootWidth / 2 -
12471265 ( scale * width ) / 2 -
12481266 scale * ( minX + ( - 60 + 60 ) / helperScale ) -
1249- boudingBoxCorrectionX ;
1267+ boudingBoxCorrectionX +
1268+ xOffsetNodesidebar ;
12501269 this . yCamera =
12511270 rootHeight / 2 -
12521271 ( scale * height ) / 2 -
0 commit comments