diff --git a/src/control/tools/EditSelection.cpp b/src/control/tools/EditSelection.cpp index 7e9fd5dd..d99f9660 100644 --- a/src/control/tools/EditSelection.cpp +++ b/src/control/tools/EditSelection.cpp @@ -891,6 +891,11 @@ void EditSelection::serialize(ObjectOutputStream& out) { out.writeDouble(this->width); out.writeDouble(this->height); + out.writeDouble(this->snappedBounds.x); + out.writeDouble(this->snappedBounds.y); + out.writeDouble(this->snappedBounds.width); + out.writeDouble(this->snappedBounds.height); + this->contents->serialize(out); out.endObject(); @@ -907,6 +912,11 @@ void EditSelection::readSerialized(ObjectInputStream& in) { this->width = in.readDouble(); this->height = in.readDouble(); + double xSnap = in.readDouble(); + double ySnap = in.readDouble(); + double wSnap = in.readDouble(); + double hSnap = in.readDouble(); + this->snappedBounds = Rectangle{xSnap, ySnap, wSnap, hSnap}; this->contents->readSerialized(in); in.endObject(); diff --git a/src/control/tools/EditSelectionContents.cpp b/src/control/tools/EditSelectionContents.cpp index 8204f5c1..e530d212 100644 --- a/src/control/tools/EditSelectionContents.cpp +++ b/src/control/tools/EditSelectionContents.cpp @@ -508,11 +508,10 @@ auto EditSelectionContents::copySelection(PageRef page, XojPageView* view, doubl void EditSelectionContents::serialize(ObjectOutputStream& out) { out.writeObject("EditSelectionContents"); - out.writeDouble(this->originalBounds.width); - out.writeDouble(this->originalBounds.height); - out.writeDouble(this->originalBounds.x); out.writeDouble(this->originalBounds.y); + out.writeDouble(this->originalBounds.width); + out.writeDouble(this->originalBounds.height); out.writeDouble(this->relativeX); out.writeDouble(this->relativeY); @@ -523,13 +522,11 @@ void EditSelectionContents::serialize(ObjectOutputStream& out) { void EditSelectionContents::readSerialized(ObjectInputStream& in) { in.readObject("EditSelectionContents"); - double originalWidth = in.readDouble(); - double originalHeight = in.readDouble(); - double originalX = in.readDouble(); double originalY = in.readDouble(); - - this->originalBounds = Rectangle{originalX, originalY, originalWidth, originalHeight}; + double originalW = in.readDouble(); + double originalH = in.readDouble(); + this->originalBounds = Rectangle{originalX, originalY, originalW, originalH}; this->relativeX = in.readDouble(); this->relativeY = in.readDouble();