Add stroke/fill swap button.

pull/43/head
Atul Varma 2021-02-28 20:11:50 -05:00
rodzic 82f8972662
commit 1824d7249b
1 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

@ -10,6 +10,12 @@ export const SymbolContextWidget: React.FC<{
const updateCtx = (updates: Partial<SvgSymbolContext>) => { const updateCtx = (updates: Partial<SvgSymbolContext>) => {
onChange({ ...ctx, ...updates }); onChange({ ...ctx, ...updates });
}; };
const swapColors = () => {
updateCtx({
fill: ctx.stroke,
stroke: ctx.fill,
});
};
return ( return (
<p> <p>
@ -28,6 +34,7 @@ export const SymbolContextWidget: React.FC<{
onChange={(e) => updateCtx({ fill: e.target.value })} onChange={(e) => updateCtx({ fill: e.target.value })}
id="fill" id="fill"
/>{" "} />{" "}
<button onClick={swapColors}>Swap stroke/fill</button>{" "}
<label> <label>
<input <input
type="checkbox" type="checkbox"