Refactor: e -> event or error, err -> error, p -> pointer (#831)

* Refactor: e -> event or error, err -> error, p -> pointer

* simplify
This commit is contained in:
Lipis 2020-02-28 23:03:53 +01:00 committed by GitHub
parent d2827aa40b
commit 097c5dfad7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 190 additions and 185 deletions

View file

@ -31,9 +31,7 @@ export const actionChangeExportBackground: Action = {
<input
type="checkbox"
checked={appState.exportBackground}
onChange={e => {
updateData(e.target.checked);
}}
onChange={event => updateData(event.target.checked)}
/>{" "}
{t("labels.withBackground")}
</label>
@ -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));
}}
/>
),

View file

@ -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);
}
}}

View file

@ -91,7 +91,7 @@ export const actionSendBackward: Action = {
<button
type="button"
className="zIndexButton"
onClick={e => updateData(null)}
onClick={event => updateData(null)}
title={t("labels.sendBackward")}
>
{ICONS.sendBackward}
@ -115,7 +115,7 @@ export const actionBringForward: Action = {
<button
type="button"
className="zIndexButton"
onClick={e => updateData(null)}
onClick={event => updateData(null)}
title={t("labels.bringForward")}
>
{ICONS.bringForward}
@ -138,7 +138,7 @@ export const actionSendToBack: Action = {
<button
type="button"
className="zIndexButton"
onClick={e => updateData(null)}
onClick={event => updateData(null)}
title={t("labels.sendToBack")}
>
{ICONS.sendToBack}
@ -161,7 +161,7 @@ export const actionBringToFront: Action = {
<button
type="button"
className="zIndexButton"
onClick={e => updateData(null)}
onClick={event => updateData(null)}
title={t("labels.bringToFront")}
>
{ICONS.bringToFront}