Add a 'place behind first circle' checkbox.
rodzic
d45cb3fb5c
commit
a70b4dfab3
|
@ -240,6 +240,7 @@ export const MandalaPage: React.FC<{}> = () => {
|
||||||
const [symbolCtx, setSymbolCtx] = useState(createSvgSymbolContext());
|
const [symbolCtx, setSymbolCtx] = useState(createSvgSymbolContext());
|
||||||
const [useTwoCircles, setUseTwoCircles] = useState(false);
|
const [useTwoCircles, setUseTwoCircles] = useState(false);
|
||||||
const [invertCircle2, setInvertCircle2] = useState(true);
|
const [invertCircle2, setInvertCircle2] = useState(true);
|
||||||
|
const [firstBehindSecond, setFirstBehindSecond] = useState(false);
|
||||||
const randomize = () => {
|
const randomize = () => {
|
||||||
const rng = new Random(Date.now());
|
const rng = new Random(Date.now());
|
||||||
setCircle1({ ...circle1, ...getRandomCircleParams(rng) });
|
setCircle1({ ...circle1, ...getRandomCircleParams(rng) });
|
||||||
|
@ -248,6 +249,19 @@ export const MandalaPage: React.FC<{}> = () => {
|
||||||
|
|
||||||
const circle2SymbolCtx = invertCircle2 ? swapColors(symbolCtx) : symbolCtx;
|
const circle2SymbolCtx = invertCircle2 ? swapColors(symbolCtx) : symbolCtx;
|
||||||
|
|
||||||
|
const circles = [
|
||||||
|
<ExtendedMandalaCircle key="first" {...circle1} {...symbolCtx} />,
|
||||||
|
];
|
||||||
|
|
||||||
|
if (useTwoCircles) {
|
||||||
|
circles.push(
|
||||||
|
<ExtendedMandalaCircle key="second" {...circle2} {...circle2SymbolCtx} />
|
||||||
|
);
|
||||||
|
if (firstBehindSecond) {
|
||||||
|
circles.reverse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h1>Mandala!</h1>
|
<h1>Mandala!</h1>
|
||||||
|
@ -281,6 +295,11 @@ export const MandalaPage: React.FC<{}> = () => {
|
||||||
label="Invert colors"
|
label="Invert colors"
|
||||||
value={invertCircle2}
|
value={invertCircle2}
|
||||||
onChange={setInvertCircle2}
|
onChange={setInvertCircle2}
|
||||||
|
/>{" "}
|
||||||
|
<Checkbox
|
||||||
|
label="Place behind first circle"
|
||||||
|
value={firstBehindSecond}
|
||||||
|
onChange={setFirstBehindSecond}
|
||||||
/>
|
/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
)}
|
)}
|
||||||
|
@ -292,12 +311,7 @@ export const MandalaPage: React.FC<{}> = () => {
|
||||||
</div>
|
</div>
|
||||||
<HoverDebugHelper>
|
<HoverDebugHelper>
|
||||||
<AutoSizingSvg padding={20} ref={svgRef} bgColor={bgColor}>
|
<AutoSizingSvg padding={20} ref={svgRef} bgColor={bgColor}>
|
||||||
<SvgTransform transform={svgScale(0.5)}>
|
<SvgTransform transform={svgScale(0.5)}>{circles}</SvgTransform>
|
||||||
<ExtendedMandalaCircle {...circle1} {...symbolCtx} />
|
|
||||||
{useTwoCircles && (
|
|
||||||
<ExtendedMandalaCircle {...circle2} {...circle2SymbolCtx} />
|
|
||||||
)}
|
|
||||||
</SvgTransform>
|
|
||||||
</AutoSizingSvg>
|
</AutoSizingSvg>
|
||||||
</HoverDebugHelper>
|
</HoverDebugHelper>
|
||||||
</>
|
</>
|
||||||
|
|
Ładowanie…
Reference in New Issue