Compare commits
3 Commits
claude/aff
...
9acc1d93b4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9acc1d93b4 | ||
|
|
08cce17976 | ||
|
|
202d4333a8 |
@@ -30,6 +30,7 @@ export default function DrawIt() {
|
|||||||
|
|
||||||
const [pictureList, setPictureList] = useState<DirectusPicture[]>([])
|
const [pictureList, setPictureList] = useState<DirectusPicture[]>([])
|
||||||
const [currentIndex, setCurrentIndex] = useState(-1)
|
const [currentIndex, setCurrentIndex] = useState(-1)
|
||||||
|
const [debouncedIndex, setDebouncedIndex] = useState(-1)
|
||||||
const [objects, setObjects] = useState<DirectusObject[]>([])
|
const [objects, setObjects] = useState<DirectusObject[]>([])
|
||||||
const [selectedObjectId, setSelectedObjectId] = useState<string | null>(null)
|
const [selectedObjectId, setSelectedObjectId] = useState<string | null>(null)
|
||||||
const [currentSelections, setCurrentSelections] = useState<Selection[]>([])
|
const [currentSelections, setCurrentSelections] = useState<Selection[]>([])
|
||||||
@@ -52,6 +53,12 @@ export default function DrawIt() {
|
|||||||
|
|
||||||
const canvasRef = useRef<DrawCanvasHandle>(null)
|
const canvasRef = useRef<DrawCanvasHandle>(null)
|
||||||
|
|
||||||
|
// Debounce: Bild erst laden wenn 350ms keine weitere Navigation
|
||||||
|
useEffect(() => {
|
||||||
|
const t = setTimeout(() => setDebouncedIndex(currentIndex), 350)
|
||||||
|
return () => clearTimeout(t)
|
||||||
|
}, [currentIndex])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (safeWordInputVisible) safeWordInputRef.current?.focus()
|
if (safeWordInputVisible) safeWordInputRef.current?.focus()
|
||||||
}, [safeWordInputVisible])
|
}, [safeWordInputVisible])
|
||||||
@@ -83,8 +90,9 @@ export default function DrawIt() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// currentPicture folgt dem debouncedIndex → lädt erst wenn Navigation pausiert
|
||||||
const currentPicture: DirectusPicture | null =
|
const currentPicture: DirectusPicture | null =
|
||||||
currentIndex >= 0 && currentIndex < pictureList.length ? pictureList[currentIndex] : null
|
debouncedIndex >= 0 && debouncedIndex < pictureList.length ? pictureList[debouncedIndex] : null
|
||||||
|
|
||||||
// Map DirectusObject → CanvasObject for rendering
|
// Map DirectusObject → CanvasObject for rendering
|
||||||
const canvasObjects: CanvasObject[] = objects.map((obj, i) => ({
|
const canvasObjects: CanvasObject[] = objects.map((obj, i) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user