Center element on paste

This commit is contained in:
Faustino Kialungila 2020-01-07 19:49:12 +01:00
parent 2f9aa0e3ca
commit 0fee1579e2

View file

@ -1009,9 +1009,8 @@ class App extends React.Component<{}, AppState> {
parsedElements[0].type // need to implement a better check here...
) {
clearSelection(elements);
if (x == null) x = 10 - this.state.scrollX;
if (y == null) y = 10 - this.state.scrollY;
if (x == null) x = window.innerWidth / 2 - this.state.scrollX - 10;
if (y == null) y = window.innerHeight / 2 - this.state.scrollY - 10;
const minX = Math.min(...parsedElements.map(element => element.x));
const minY = Math.min(...parsedElements.map(element => element.y));
const dx = x - minX;