parent
846f427732
commit
2d66616e3f
@ -1010,20 +1010,16 @@ class App extends React.Component<{}, AppState> {
|
|||||||
) {
|
) {
|
||||||
clearSelection(elements);
|
clearSelection(elements);
|
||||||
|
|
||||||
let dx: number;
|
if (x == null) x = 10 - this.state.scrollX;
|
||||||
let dy: number;
|
if (y == null) y = 10 - this.state.scrollY;
|
||||||
if (x) {
|
const minX = Math.min(...parsedElements.map(element => element.x));
|
||||||
let minX = Math.min(...parsedElements.map(element => element.x));
|
const minY = Math.min(...parsedElements.map(element => element.y));
|
||||||
dx = x - minX;
|
const dx = x - minX;
|
||||||
}
|
const dy = y - minY;
|
||||||
if (y) {
|
|
||||||
let minY = Math.min(...parsedElements.map(element => element.y));
|
|
||||||
dy = y - minY;
|
|
||||||
}
|
|
||||||
|
|
||||||
parsedElements.forEach(parsedElement => {
|
parsedElements.forEach(parsedElement => {
|
||||||
parsedElement.x = dx ? parsedElement.x + dx : 10 - this.state.scrollX;
|
parsedElement.x += dx;
|
||||||
parsedElement.y = dy ? parsedElement.y + dy : 10 - this.state.scrollY;
|
parsedElement.y += dy;
|
||||||
parsedElement.seed = randomSeed();
|
parsedElement.seed = randomSeed();
|
||||||
elements.push(parsedElement);
|
elements.push(parsedElement);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user