This is an automated email from the ASF dual-hosted git repository.

tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git


The following commit(s) were added to refs/heads/main by this push:
     new 1d49795c5fb NO-ISSUE: DMN Editor: Holding alt and navigating away from 
the page locks the editor (#2368)
1d49795c5fb is described below

commit 1d49795c5fb1649aadda3a2bbc0222d2cc4244f3
Author: Kbowers <[email protected]>
AuthorDate: Fri May 24 18:14:36 2024 +0200

    NO-ISSUE: DMN Editor: Holding alt and navigating away from the page locks 
the editor (#2368)
---
 packages/dmn-editor-envelope/src/DmnEditorRoot.tsx |  7 +++----
 .../src/commands/CommandsContextProvider.tsx       |  8 --------
 packages/dmn-editor/src/diagram/Diagram.tsx        |  1 -
 .../dmn-editor/src/diagram/DiagramCommands.tsx     | 23 ----------------------
 4 files changed, 3 insertions(+), 36 deletions(-)

diff --git a/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx 
b/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
index c4ebb543da7..bfb9d1f0418 100644
--- a/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
+++ b/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
@@ -393,11 +393,10 @@ export class DmnEditorRoot extends 
React.Component<DmnEditorRootProps, DmnEditor
       "Navigate | Reset position to origin",
       async () => commands.resetPosition()
     );
-    const pan = this.props.keyboardShortcutsService?.registerKeyDownThenUp(
-      "Alt",
+    const pan = this.props.keyboardShortcutsService?.registerKeyPress(
+      "Right Mouse Button",
       "Navigate | Hold and drag to Pan",
-      async () => commands.panDown(),
-      async () => commands.panUp()
+      async () => {}
     );
     const zoom = this.props.keyboardShortcutsService?.registerKeyPress(
       "Ctrl",
diff --git a/packages/dmn-editor/src/commands/CommandsContextProvider.tsx 
b/packages/dmn-editor/src/commands/CommandsContextProvider.tsx
index ab664a26388..1a8cdaf7f82 100644
--- a/packages/dmn-editor/src/commands/CommandsContextProvider.tsx
+++ b/packages/dmn-editor/src/commands/CommandsContextProvider.tsx
@@ -26,8 +26,6 @@ export interface Commands {
   togglePropertiesPanel: () => void;
   createGroup: () => void;
   selectAll: () => void;
-  panDown: () => void;
-  panUp: () => void;
   paste: () => void;
   copy: () => void;
   cut: () => void;
@@ -61,12 +59,6 @@ export function CommandsContextProvider(props: 
React.PropsWithChildren<{}>) {
     selectAll: () => {
       throw new Error("DMN EDITOR: selectAll command not implemented.");
     },
-    panDown: () => {
-      throw new Error("DMN EDITOR: panDown command not implemented.");
-    },
-    panUp: () => {
-      throw new Error("DMN EDITOR: panUp command not implemented.");
-    },
     paste: () => {
       throw new Error("DMN EDITOR: paste command not implemented.");
     },
diff --git a/packages/dmn-editor/src/diagram/Diagram.tsx 
b/packages/dmn-editor/src/diagram/Diagram.tsx
index 57b4d7f0bbc..5c47b7f4e2d 100644
--- a/packages/dmn-editor/src/diagram/Diagram.tsx
+++ b/packages/dmn-editor/src/diagram/Diagram.tsx
@@ -1154,7 +1154,6 @@ export const Diagram = React.forwardRef<DiagramRef, { 
container: React.RefObject
             preventScrolling={true}
             selectionOnDrag={true}
             panOnDrag={PAN_ON_DRAG}
-            panActivationKeyCode={"Alt"}
             selectionMode={RF.SelectionMode.Full} // For selections happening 
inside Groups/DecisionServices it's better to leave it as "Full"
             isValidConnection={isValidConnection}
             connectionLineComponent={ConnectionLine}
diff --git a/packages/dmn-editor/src/diagram/DiagramCommands.tsx 
b/packages/dmn-editor/src/diagram/DiagramCommands.tsx
index 991bc0b4728..cabb6654d24 100644
--- a/packages/dmn-editor/src/diagram/DiagramCommands.tsx
+++ b/packages/dmn-editor/src/diagram/DiagramCommands.tsx
@@ -422,28 +422,5 @@ export function DiagramCommands(props: {}) {
       });
     };
   }, [dmnEditorStoreApi, externalModelsByNamespace, commandsRef, rf]);
-
-  useEffect(() => {
-    if (!commandsRef.current) {
-      return;
-    }
-    commandsRef.current.panDown = async () => {
-      console.debug("DMN DIAGRAM: COMMANDS: Panning down");
-      rfStoreApi.setState({
-        nodesDraggable: false,
-        nodesConnectable: false,
-        elementsSelectable: false,
-      });
-    };
-    commandsRef.current.panUp = async () => {
-      console.debug("DMN DIAGRAM: COMMANDS: Panning up");
-      rfStoreApi.setState({
-        nodesDraggable: true,
-        nodesConnectable: true,
-        elementsSelectable: true,
-      });
-    };
-  }, [commandsRef, rfStoreApi]);
-
   return <></>;
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to