diff --git a/README.md b/README.md index c3c6b01..902f16a 100644 --- a/README.md +++ b/README.md @@ -312,6 +312,8 @@ cargo build --release ### Medium +* Shape event use also the screen edges/corners : adapt the filter or the GUI ( + bug or feature ?) * create ~/.config if it doesn't exist * fix exec cmd error `Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })` diff --git a/config-editor/src/App.tsx b/config-editor/src/App.tsx index e60e056..b0385a3 100644 --- a/config-editor/src/App.tsx +++ b/config-editor/src/App.tsx @@ -98,29 +98,26 @@ export default function App() { const addBinding = useCallback( (binding?: BindingType) => { setConfig((prevConfig) => { - const index = binding - ? prevConfig?.bindings.findIndex((b) => b.uid === binding.uid) - : undefined; + const index = prevConfig?.bindings.findIndex( + (b) => b.uid === binding?.uid + ); + const newConfig: ConfigType = { shape_button: prevConfig?.shape_button || "Right", bindings: [...(prevConfig?.bindings || [])], }; - newConfig.bindings?.splice( - (index || newConfig.bindings.length) + 1, - 0, - { - uid: self.crypto.randomUUID(), - cmd: ["TODO"], - comment: "TODO", - event: { - button: "Right", - event_type: "Click", - edges: ["Top"], - modifiers: [], - shapes_xy: [], - }, - } - ); + newConfig.bindings?.splice((index ?? -1) + 1, 0, { + uid: self.crypto.randomUUID(), + cmd: ["TODO"], + comment: "TODO", + event: { + button: "Right", + event_type: "Click", + edges: ["Top"], + modifiers: [], + shapes_xy: [], + }, + }); return newConfig; }); }, @@ -212,7 +209,13 @@ export default function App() { justifyContent: "center", }} > -