Started palette editor.
Test and Build / test-and-build (push) Failing after 1m47s

Cleaned up tests and lint errors.
Upgraded npm packages.
This commit is contained in:
Jay
2026-03-19 18:54:44 -04:00
parent 6be2d9e41a
commit 9fec89949b
36 changed files with 1484 additions and 1229 deletions
+24 -21
View File
@@ -12,7 +12,7 @@ import {
import { useSmoothAnimation } from "./animation";
if (typeof TouchEvent === "undefined") {
// @ts-ignore - intentionally creating global
// @ts-expect-error - intentionally creating global
window.TouchEvent = window.MouseEvent;
}
@@ -61,37 +61,40 @@ export function useCrosshair({
yValueRangeRef.current = yValueRange;
}, [xValueRange, yValueRange]);
const calculatePositions = useCallback((event: MouseEvent | TouchEvent) => {
const orig = originRef.current;
const dims = dimensionsRef.current;
const xRange = xValueRangeRef.current;
const yRange = yValueRangeRef.current;
const calculatePositions = useCallback(
(event: MouseEvent | TouchEvent) => {
const orig = originRef.current;
const dims = dimensionsRef.current;
const xRange = xValueRangeRef.current;
const yRange = yValueRangeRef.current;
const { clientX, clientY } = extractEventCoordinates(event);
const { clientX, clientY } = extractEventCoordinates(event);
const xPos = minmax(clientX - orig.x, 0, dims.x - 1);
const yPos = minmax(clientY - orig.y, 0, dims.y - 1);
let newXValue = positionToValue(xPos, dims.x - 1, xRange);
let newYValue = positionToValue(yPos, dims.y - 1, yRange);
const xPos = minmax(clientX - orig.x, 0, dims.x - 1);
const yPos = minmax(clientY - orig.y, 0, dims.y - 1);
let newXValue = positionToValue(xPos, dims.x - 1, xRange);
let newYValue = positionToValue(yPos, dims.y - 1, yRange);
if (invertX) {
newXValue = xRange.max - newXValue;
}
if (invertX) {
newXValue = xRange.max - newXValue;
}
if (invertY) {
newYValue = yRange.max - newYValue;
}
if (invertY) {
newYValue = yRange.max - newYValue;
}
setXValueRef.current(newXValue);
setYValueRef.current(newYValue);
}, []);
setXValueRef.current(newXValue);
setYValueRef.current(newYValue);
},
[invertX, invertY],
);
const handleMove = useCallback(
(event: MouseEvent | TouchEvent) => {
event.preventDefault();
smoothAnimation(() => calculatePositions(event));
},
[calculatePositions],
[calculatePositions, smoothAnimation],
);
const handleEnd = useCallback(