mirror of
https://github.com/trafficlunar/blockmatic.git
synced 2026-06-28 14:44:12 +00:00
feat: add loading indicator
This commit is contained in:
parent
a93073caf9
commit
41ab349e43
8 changed files with 70 additions and 22 deletions
|
|
@ -14,12 +14,13 @@ interface Props {
|
|||
imageDimensions: Dimension;
|
||||
coords: Position;
|
||||
scale: number;
|
||||
setLoading: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
}
|
||||
|
||||
// Lifts 16,000 tiles limit
|
||||
settings.use32bitIndex = true;
|
||||
|
||||
function Blocks({ blocks, setBlocks, textures, image, imageDimensions, coords, scale }: Props) {
|
||||
function Blocks({ blocks, setBlocks, textures, image, imageDimensions, coords, scale, setLoading }: Props) {
|
||||
const app = useApp();
|
||||
const [missingTexture, setMissingTexture] = useState<PIXI.Texture>();
|
||||
|
||||
|
|
@ -109,6 +110,7 @@ function Blocks({ blocks, setBlocks, textures, image, imageDimensions, coords, s
|
|||
}
|
||||
|
||||
setBlocks(newBlocks);
|
||||
setLoading(false);
|
||||
}
|
||||
}, [image, imageDimensions]);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { Container, Stage } from "@pixi/react";
|
|||
|
||||
import { CanvasContext } from "@/context/Canvas";
|
||||
import { ImageContext } from "@/context/Image";
|
||||
import { LoadingContext } from "@/context/Loading";
|
||||
import { SettingsContext } from "@/context/Settings";
|
||||
import { TexturesContext } from "@/context/Textures";
|
||||
import { ToolContext } from "@/context/Tool";
|
||||
|
|
@ -25,6 +26,7 @@ PIXI.settings.SCALE_MODE = PIXI.SCALE_MODES.NEAREST;
|
|||
function Canvas() {
|
||||
const { stageSize, canvasSize, blocks, coords, scale, setStageSize, setBlocks, setCoords, setScale } = useContext(CanvasContext);
|
||||
const { image, imageDimensions } = useContext(ImageContext);
|
||||
const { setLoading } = useContext(LoadingContext);
|
||||
const { settings } = useContext(SettingsContext);
|
||||
const textures = useContext(TexturesContext);
|
||||
const { tool, selectedBlock, cssCursor, setTool, setCssCursor } = useContext(ToolContext);
|
||||
|
|
@ -252,6 +254,7 @@ function Canvas() {
|
|||
imageDimensions={imageDimensions}
|
||||
coords={coords}
|
||||
scale={scale}
|
||||
setLoading={setLoading}
|
||||
/>
|
||||
|
||||
<Container x={coords.x} y={coords.y} scale={scale}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue