Fix color assitant bug

This commit is contained in:
0xa663
2024-02-16 11:24:02 +01:00
parent 735091c51d
commit 7a84e8b690
3 changed files with 15 additions and 250 deletions
+9 -10
View File
@@ -7,7 +7,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import styled from "styled-components";
import { createCanvas, drawPixelsOntoCanvas } from "../../utils";
import { Palette } from "../../palette";
import { clamp, debounce } from "lodash";
import { clamp} from "lodash";
import { Store } from "../../store";
import { Storage } from "../../storage";
@@ -81,19 +81,18 @@ export class Minimap extends React.Component<Props, Stats> {
this.draw();
} else if (prevState.size !== this.state.size) {
this.draw();
}
}
}
private click = debounce((colorIndex: number) => {
private click(colorIndex: number) {
if (colorIndex >= 0 && colorIndex < this.props.palette.palette.length) {
if (!this.props.palette.buttons[colorIndex].classList.contains("outline-2")) {
if (this.state.colorAssistant) {
this.props.palette.buttons[colorIndex].click();
if (!this.props.palette.buttons[colorIndex].classList.contains("outline-2")) {
if (this.state.colorAssistant) {
this.props.palette.buttons[colorIndex].click();
}
}
}
}
}, 50);
}
}
componentDidMount () {