@@ -14,8 +14,19 @@ import { TBlock } from "../../components/canvas/blocks/Block";
1414import { random } from "../../components/canvas/blocks/generate" ;
1515import { ConnectionLayer } from "../../components/canvas/layers/connectionLayer/ConnectionLayer" ;
1616import { Graph , GraphState , TGraphConfig } from "../../graph" ;
17- import { GraphBlock , GraphCanvas , HookGraphParams , useGraph , useGraphEvent , useLayer } from "../../react-components" ;
17+ import { TComponentState } from "../../lib/Component" ;
18+ import {
19+ GraphBlock ,
20+ GraphCanvas ,
21+ GraphLayer ,
22+ GraphPortal ,
23+ HookGraphParams ,
24+ useGraph ,
25+ useGraphEvent ,
26+ useLayer ,
27+ } from "../../react-components" ;
1828import { useFn } from "../../react-components/utils/hooks/useFn" ;
29+ import { Layer , LayerContext , LayerProps } from "../../services/Layer" ;
1930import { ECanChangeBlockGeometry } from "../../store/settings" ;
2031import { EAnchorType } from "../configurations/definitions" ;
2132
@@ -331,7 +342,14 @@ export function GraphPLayground() {
331342 < Toolbox graph = { graph } className = "graph-tools-zoom button-group" />
332343 < GraphSettings className = "graph-tools-settings" graph = { graph } />
333344 </ Flex >
334- < GraphCanvas graph = { graph } renderBlock = { renderBlockFn } />
345+ < GraphCanvas graph = { graph } renderBlock = { renderBlockFn } >
346+ < GraphPortal className = "no-pointer-events" zIndex = { 1 } transformByCameraPosition = { true } >
347+ < div >
348+ < h1 > DevTools</ h1 >
349+ </ div >
350+ </ GraphPortal >
351+ < GraphLayer layer = { SomeLayer } />
352+ </ GraphCanvas >
335353 </ Flex >
336354 </ Flex >
337355 < Flex direction = "column" grow = { 1 } className = "content" gap = { 6 } >
@@ -351,4 +369,22 @@ export function GraphPLayground() {
351369 ) ;
352370}
353371
372+ class SomeLayer extends Layer < LayerProps , LayerContext , TComponentState > {
373+ constructor ( props : LayerProps ) {
374+ super ( {
375+ canvas : {
376+ zIndex : 100 ,
377+ transformByCameraPosition : true ,
378+ } ,
379+ ...props ,
380+ } ) ;
381+ }
382+
383+ protected render ( ) : void {
384+ super . render ( ) ;
385+ this . context . ctx . fillStyle = "red" ;
386+ this . context . ctx . fillRect ( 0 , 0 , 100 , 100 ) ;
387+ }
388+ }
389+
354390export const Default : StoryFn = ( ) => < GraphPLayground /> ;
0 commit comments