mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
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:
parent
d2827aa40b
commit
097c5dfad7
14 changed files with 190 additions and 185 deletions
|
@ -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));
|
||||
}}
|
||||
/>
|
||||
),
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}}
|
||||
|
|
|
@ -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}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue