add support for clearing canvas (#108)
This commit is contained in:
parent
2d0934fdd9
commit
c623312380
@ -773,6 +773,18 @@ class App extends React.Component<{}, AppState> {
|
|||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private clearCanvas = () => {
|
||||||
|
if (window.confirm("This will clear the whole canvas. Are you sure?")) {
|
||||||
|
elements = [];
|
||||||
|
this.setState({
|
||||||
|
viewBackgroundColor: "#ffffff",
|
||||||
|
scrollX: 0,
|
||||||
|
scrollY: 0
|
||||||
|
});
|
||||||
|
this.forceUpdate();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private moveAllLeft = () => {
|
private moveAllLeft = () => {
|
||||||
moveAllLeft(elements, getSelectedIndices());
|
moveAllLeft(elements, getSelectedIndices());
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
@ -890,6 +902,15 @@ class App extends React.Component<{}, AppState> {
|
|||||||
Shape Background
|
Shape Background
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<h4>Canvas</h4>
|
||||||
|
<div className="panelColumn">
|
||||||
|
<button
|
||||||
|
onClick={this.clearCanvas}
|
||||||
|
title="Clear the canvas & reset background color"
|
||||||
|
>
|
||||||
|
Clear canvas
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<h4>Export</h4>
|
<h4>Export</h4>
|
||||||
<div className="panelColumn">
|
<div className="panelColumn">
|
||||||
<button
|
<button
|
||||||
|
@ -78,3 +78,7 @@ button {
|
|||||||
|
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button:disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user