tiagobento commented on code in PR #2494:
URL:
https://github.com/apache/incubator-kie-tools/pull/2494#discussion_r1697123056
##########
packages/dmn-editor/src/diagram/Diagram.tsx:
##########
@@ -1610,6 +1614,22 @@ function DmnDiagramEmptyState({
);
}
+export function ViewportWatcher() {
Review Comment:
Although this works (and is properly named, I'd say :D), this is a "trick"
we did for when there was no way to do something without accessing ReactFlow's
context... I think you can use the `onViewportChange` on the <ReactFlow>
component directly, and get the exact same result.
##########
packages/dmn-editor/src/diagram/Diagram.tsx:
##########
@@ -178,6 +177,10 @@ export const Diagram = React.forwardRef<DiagramRef, {
container: React.RefObject
RF.ReactFlowInstance<DmnDiagramNodeData, DmnDiagramEdgeData> | undefined
>(undefined);
+ const viewportSettings = useMemo(() => {
+ return dmnEditorStoreApi.getState().diagram.viewport;
+ }, [dmnEditorStoreApi]);
Review Comment:
```suggestion
const viewport = useDmnEditorStore((s) => s.diagram.viewport);
```
##########
packages/dmn-editor/src/store/Store.ts:
##########
@@ -223,6 +228,11 @@ export const defaultStaticState = (): Omit<State, "dmn" |
"dispatch" | "computed
draggingWaypoints: [],
movingDividerLines: [],
isEditingStyle: false,
+ viewport: {
+ x: 100,
+ y: 100,
+ zoom: 1,
+ },
Review Comment:
Wouldn't it be the case of using DEFAULT_VIEWPORT here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]