From 48860654436ecd5ced6ab3d7f696879f2319128c Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Fri, 3 Jan 2020 21:46:49 -0800 Subject: [PATCH] Wire up forward (#101) * Wire up forward * Match words with Keynote/Powerpoint --- src/index.tsx | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index addd06b5..434422ae 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -11,7 +11,7 @@ import { faFont } from "@fortawesome/free-solid-svg-icons"; -import { moveOneLeft, moveAllLeft } from "./zindex"; +import { moveOneLeft, moveAllLeft, moveOneRight, moveAllRight } from "./zindex"; import "./styles.css"; @@ -726,7 +726,7 @@ class App extends React.Component<{}, AppState> { this.forceUpdate(); event.preventDefault(); - // Send backwards: Cmd-Shift-Alt-B + // Send backward: Cmd-Shift-Alt-B } else if ( event.metaKey && event.shiftKey && @@ -741,6 +741,21 @@ class App extends React.Component<{}, AppState> { this.moveAllLeft(); event.preventDefault(); + // Bring forward: Cmd-Shift-Alt-F + } else if ( + event.metaKey && + event.shiftKey && + event.altKey && + event.code === "KeyF" + ) { + this.moveOneRight(); + event.preventDefault(); + + // Bring to front: Cmd-Shift-F + } else if (event.metaKey && event.shiftKey && event.code === "KeyF") { + this.moveAllRight(); + event.preventDefault(); + // Select all: Cmd-A } else if (event.metaKey && event.code === "KeyA") { elements.forEach(element => { @@ -768,6 +783,16 @@ class App extends React.Component<{}, AppState> { this.forceUpdate(); }; + private moveAllRight = () => { + moveAllRight(elements, getSelectedIndices()); + this.forceUpdate(); + }; + + private moveOneRight = () => { + moveOneRight(elements, getSelectedIndices()); + this.forceUpdate(); + }; + public render() { return (
{

Shape options

- - + + +