fix copy/paste regression (#291)

This commit is contained in:
David Luzar 2020-01-09 18:43:24 +01:00 committed by GitHub
parent deee57314d
commit 2fb3cdd5e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1198,8 +1198,8 @@ export class App extends React.Component<{}, AppState> {
let subCanvasY1 = Infinity; let subCanvasY1 = Infinity;
let subCanvasY2 = 0; let subCanvasY2 = 0;
//const minX = Math.min(parsedElements.map(element => element.x)); const minX = Math.min(...parsedElements.map(element => element.x));
//const minY = Math.min(parsedElements.map(element => element.y)); const minY = Math.min(...parsedElements.map(element => element.y));
const distance = (x: number, y: number) => { const distance = (x: number, y: number) => {
return Math.abs(x > y ? x - y : y - x); return Math.abs(x > y ? x - y : y - x);
@ -1231,8 +1231,8 @@ export class App extends React.Component<{}, AppState> {
...elements, ...elements,
...parsedElements.map(parsedElement => { ...parsedElements.map(parsedElement => {
const duplicate = duplicateElement(parsedElement); const duplicate = duplicateElement(parsedElement);
duplicate.x += dx; duplicate.x += dx - minX;
duplicate.y += dy; duplicate.y += dy - minY;
return duplicate; return duplicate;
}) })
]; ];