diff --git a/src/app/components/Octicon.tsx b/src/app/components/Octicon.tsx index 891a67ec..97dcf1e1 100644 --- a/src/app/components/Octicon.tsx +++ b/src/app/components/Octicon.tsx @@ -35,6 +35,8 @@ export const Octicon = { search: , sort_asc: , sort_desc: , + square: , + square_fill: , stack: , sun: , sync: , diff --git a/src/app/components/previews/NoiseSettingsPreview.tsx b/src/app/components/previews/NoiseSettingsPreview.tsx index bb00bf2c..5bbcf737 100644 --- a/src/app/components/previews/NoiseSettingsPreview.tsx +++ b/src/app/components/previews/NoiseSettingsPreview.tsx @@ -13,8 +13,10 @@ export const NoiseSettingsPreview = ({ data, shown, version }: PreviewProps) => const [biome, setBiome] = useState('minecraft:plains') const [biomeScale, setBiomeScale] = useState(0.2) const [biomeDepth, setBiomeDepth] = useState(0.1) + const [autoScroll, setAutoScroll] = useState(false) const [focused, setFocused] = useState(undefined) const offset = useRef(0) + const scrollInterval = useRef(undefined) const state = JSON.stringify([data, biomeScale, biomeDepth]) const size = data?.noise?.height ?? 256 @@ -42,10 +44,19 @@ export const NoiseSettingsPreview = ({ data, shown, version }: PreviewProps) => }, [state, seed]) useEffect(() => { + if (scrollInterval.current) { + clearInterval(scrollInterval.current) + } if (shown) { redraw() + if (autoScroll) { + scrollInterval.current = setInterval(() => { + offset.current -= 8 + redraw() + }, 100) as any + } } - }, [state, seed, shown, biome, biomeScale, biomeDepth]) + }, [state, seed, shown, biome, biomeScale, biomeDepth, autoScroll]) const allBiomes = useMemo(() => CachedCollections?.get('worldgen/biome') ?? [], [version]) @@ -59,6 +70,7 @@ export const NoiseSettingsPreview = ({ data, shown, version }: PreviewProps) => : } + setAutoScroll(!autoScroll)} /> setSeed(randomSeed())} /> diff --git a/src/locales/en.json b/src/locales/en.json index 0a63908e..0f44bd6b 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -80,6 +80,7 @@ "title.sounds": "Sound Explorer", "presets": "Presets", "preview": "Visualize", + "preview.auto_scroll": "Auto scroll", "preview.biome": "Biome", "preview.scale": "Scale", "preview.depth": "Depth",