allowed for sticking to grid when pasting an element (#2107)
This commit is contained in:
parent
7ebeae2d38
commit
d15444e232
@ -1000,13 +1000,18 @@ class App extends React.Component<ExcalidrawProps, AppState> {
|
|||||||
|
|
||||||
const oldIdToDuplicatedId = new Map();
|
const oldIdToDuplicatedId = new Map();
|
||||||
const newElements = clipboardElements.map((element) => {
|
const newElements = clipboardElements.map((element) => {
|
||||||
|
const [pastedPositionX, pastedPositionY] = getGridPoint(
|
||||||
|
element.x + dx - minX,
|
||||||
|
element.y + dy - minY,
|
||||||
|
this.state.gridSize,
|
||||||
|
);
|
||||||
const newElement = duplicateElement(
|
const newElement = duplicateElement(
|
||||||
this.state.editingGroupId,
|
this.state.editingGroupId,
|
||||||
groupIdMap,
|
groupIdMap,
|
||||||
element,
|
element,
|
||||||
{
|
{
|
||||||
x: element.x + dx - minX,
|
x: pastedPositionX,
|
||||||
y: element.y + dy - minY,
|
y: pastedPositionY,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
oldIdToDuplicatedId.set(element.id, newElement.id);
|
oldIdToDuplicatedId.set(element.id, newElement.id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user