From 097c5dfad77ac0f70015dfa12b1ce6dc6a2f4090 Mon Sep 17 00:00:00 2001 From: Lipis Date: Fri, 28 Feb 2020 23:03:53 +0100 Subject: [PATCH] Refactor: e -> event or error, err -> error, p -> pointer (#831) * Refactor: e -> event or error, err -> error, p -> pointer * simplify --- src/actions/actionExport.tsx | 8 +- src/actions/actionProperties.tsx | 12 +- src/actions/actionZindex.tsx | 8 +- src/clipboard.ts | 28 ++--- src/components/ColorPicker.tsx | 48 ++++---- src/components/ContextMenu.tsx | 5 +- src/components/ExportDialog.tsx | 16 +-- src/components/Modal.tsx | 6 +- src/components/Popover.tsx | 4 +- src/components/ProjectName.tsx | 18 +-- src/element/textWysiwyg.tsx | 4 +- src/gesture.ts | 4 +- src/index.tsx | 202 ++++++++++++++++--------------- src/scene/data.ts | 12 +- 14 files changed, 190 insertions(+), 185 deletions(-) diff --git a/src/actions/actionExport.tsx b/src/actions/actionExport.tsx index 29c5c31f..531dd2f8 100644 --- a/src/actions/actionExport.tsx +++ b/src/actions/actionExport.tsx @@ -31,9 +31,7 @@ export const actionChangeExportBackground: Action = { { - updateData(e.target.checked); - }} + onChange={event => updateData(event.target.checked)} />{" "} {t("labels.withBackground")} @@ -43,7 +41,7 @@ export const actionChangeExportBackground: Action = { export const actionSaveScene: Action = { name: "saveScene", perform: (elements, appState, value) => { - saveAsJSON(elements, appState).catch(err => console.error(err)); + saveAsJSON(elements, appState).catch(error => console.error(error)); return {}; }, PanelComponent: ({ updateData }) => ( @@ -79,7 +77,7 @@ export const actionLoadScene: Action = { .then(({ elements, appState }) => { updateData({ elements: elements, appState: appState }); }) - .catch(err => console.error(err)); + .catch(error => console.error(error)); }} /> ), diff --git a/src/actions/actionProperties.tsx b/src/actions/actionProperties.tsx index f184c850..b012308c 100644 --- a/src/actions/actionProperties.tsx +++ b/src/actions/actionProperties.tsx @@ -229,18 +229,18 @@ export const actionChangeOpacity: Action = { min="0" max="100" step="10" - onChange={e => updateData(+e.target.value)} - onWheel={e => { - e.stopPropagation(); - const target = e.target as HTMLInputElement; + onChange={event => updateData(+event.target.value)} + onWheel={event => { + event.stopPropagation(); + const target = event.target as HTMLInputElement; const STEP = 10; const MAX = 100; const MIN = 0; const value = +target.value; - if (e.deltaY < 0 && value < MAX) { + if (event.deltaY < 0 && value < MAX) { updateData(value + STEP); - } else if (e.deltaY > 0 && value > MIN) { + } else if (event.deltaY > 0 && value > MIN) { updateData(value - STEP); } }} diff --git a/src/actions/actionZindex.tsx b/src/actions/actionZindex.tsx index 9f591f34..b957b650 100644 --- a/src/actions/actionZindex.tsx +++ b/src/actions/actionZindex.tsx @@ -91,7 +91,7 @@ export const actionSendBackward: Action = {