Add stroke/fill swap button.
rodzic
82f8972662
commit
1824d7249b
|
@ -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"
|
||||||
|
|
Ładowanie…
Reference in New Issue