Show grid setting
This commit is contained in:
parent
94df100726
commit
df6b352824
@ -311,32 +311,36 @@ export default function Canvas(props) {
|
||||
cursor: cursor,
|
||||
}}
|
||||
>
|
||||
<defs>
|
||||
<pattern
|
||||
id="pattern-circles"
|
||||
x="0"
|
||||
y="0"
|
||||
width="24"
|
||||
height="24"
|
||||
patternUnits="userSpaceOnUse"
|
||||
patternContentUnits="userSpaceOnUse"
|
||||
>
|
||||
<circle
|
||||
id="pattern-circle"
|
||||
cx="4"
|
||||
cy="4"
|
||||
r="0.85"
|
||||
fill="rgb(99, 152, 191)"
|
||||
></circle>
|
||||
</pattern>
|
||||
</defs>
|
||||
<rect
|
||||
x="0"
|
||||
y="0"
|
||||
width="100%"
|
||||
height="100%"
|
||||
fill="url(#pattern-circles)"
|
||||
></rect>
|
||||
{settings.showGrid && (
|
||||
<>
|
||||
<defs>
|
||||
<pattern
|
||||
id="pattern-circles"
|
||||
x="0"
|
||||
y="0"
|
||||
width="24"
|
||||
height="24"
|
||||
patternUnits="userSpaceOnUse"
|
||||
patternContentUnits="userSpaceOnUse"
|
||||
>
|
||||
<circle
|
||||
id="pattern-circle"
|
||||
cx="4"
|
||||
cy="4"
|
||||
r="0.85"
|
||||
fill="rgb(99, 152, 191)"
|
||||
></circle>
|
||||
</pattern>
|
||||
</defs>
|
||||
<rect
|
||||
x="0"
|
||||
y="0"
|
||||
width="100%"
|
||||
height="100%"
|
||||
fill="url(#pattern-circles)"
|
||||
></rect>
|
||||
</>
|
||||
)}
|
||||
<g
|
||||
style={{
|
||||
transform: `scale(${settings.zoom})`,
|
||||
|
@ -25,6 +25,7 @@ import {
|
||||
Input,
|
||||
Upload,
|
||||
Banner,
|
||||
Toast,
|
||||
} from "@douyinfe/semi-ui";
|
||||
import { toPng, toJpeg, toSvg } from "html-to-image";
|
||||
import { saveAs } from "file-saver";
|
||||
@ -277,7 +278,8 @@ export default function ControlPanel(props) {
|
||||
},
|
||||
Grid: {
|
||||
children: [],
|
||||
function: () => {},
|
||||
function: () =>
|
||||
setSettings((prev) => ({ ...prev, showGrid: !prev.showGrid })),
|
||||
},
|
||||
Sidebar: {
|
||||
children: [],
|
||||
@ -291,6 +293,7 @@ export default function ControlPanel(props) {
|
||||
children: [],
|
||||
function: () => {
|
||||
setSettings((prev) => ({ ...prev, strictMode: !prev.strictMode }));
|
||||
Toast.success(`Stict mode is ${settings.strictMode ? "on" : "off"}.`);
|
||||
},
|
||||
},
|
||||
"Field summary": {
|
||||
@ -300,6 +303,9 @@ export default function ControlPanel(props) {
|
||||
...prev,
|
||||
showFieldSummary: !prev.showFieldSummary,
|
||||
}));
|
||||
Toast.success(
|
||||
`Field summary is ${settings.showFieldSummary ? "off" : "on"}.`
|
||||
);
|
||||
},
|
||||
},
|
||||
"Reset view": {
|
||||
|
@ -40,6 +40,7 @@ export default function Editor(props) {
|
||||
strictMode: false,
|
||||
showFieldSummary: true,
|
||||
zoom: 1,
|
||||
showGrid: true,
|
||||
});
|
||||
|
||||
const dragHandler = (e) => {
|
||||
|
Loading…
Reference in New Issue
Block a user