Update ESLint rules (#2342)

This commit is contained in:
Lipis 2020-11-06 22:06:30 +02:00 committed by GitHub
parent 56938cf874
commit e05acd6fd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 107 additions and 101 deletions

View file

@ -2146,35 +2146,31 @@ class App extends React.Component<ExcalidrawProps, AppState> {
// in this branch, we're inside the commit zone, and no uncommitted
// point exists. Thus do nothing (don't add/remove points).
}
} else if (
points.length > 2 &&
lastCommittedPoint &&
distance2d(
scenePointerX - rx,
scenePointerY - ry,
lastCommittedPoint[0],
lastCommittedPoint[1],
) < LINE_CONFIRM_THRESHOLD
) {
document.documentElement.style.cursor = CURSOR_TYPE.POINTER;
mutateElement(multiElement, {
points: points.slice(0, -1),
});
} else {
// cursor moved inside commit zone, and there's uncommitted point,
// thus remove it
if (
points.length > 2 &&
lastCommittedPoint &&
distance2d(
scenePointerX - rx,
scenePointerY - ry,
lastCommittedPoint[0],
lastCommittedPoint[1],
) < LINE_CONFIRM_THRESHOLD
) {
if (isPathALoop(points)) {
document.documentElement.style.cursor = CURSOR_TYPE.POINTER;
mutateElement(multiElement, {
points: points.slice(0, -1),
});
} else {
if (isPathALoop(points)) {
document.documentElement.style.cursor = CURSOR_TYPE.POINTER;
}
// update last uncommitted point
mutateElement(multiElement, {
points: [
...points.slice(0, -1),
[scenePointerX - rx, scenePointerY - ry],
],
});
}
// update last uncommitted point
mutateElement(multiElement, {
points: [
...points.slice(0, -1),
[scenePointerX - rx, scenePointerY - ry],
],
});
}
return;

View file

@ -24,7 +24,7 @@ export const ButtonIconSelect = <T extends Object>({
type="radio"
name={group}
onChange={() => onChange(option.value)}
checked={value === option.value ? true : false}
checked={value === option.value}
/>
{option.icon}
</label>

View file

@ -22,7 +22,7 @@ export const ButtonSelect = <T extends Object>({
type="radio"
name={group}
onChange={() => onChange(option.value)}
checked={value === option.value ? true : false}
checked={value === option.value}
/>
{option.text}
</label>

View file

@ -78,11 +78,9 @@ const Picker = ({
colorInput.current?.focus();
event.preventDefault();
}
} else {
if (activeElement === colorInput.current) {
firstItem.current?.focus();
event.preventDefault();
}
} else if (activeElement === colorInput.current) {
firstItem.current?.focus();
event.preventDefault();
}
} else if (
event.key === KEYS.ARROW_RIGHT ||