Commit e094da34 authored by Craig Watson's avatar Craig Watson

Fix saving/loading of strokes' positions

Fixed issue that appeared with previous commit, where grouped strokes'
positions were sometimes saved and loaded incorrectly.

Strokes and their transforms should now be saved correctly whether they
are grouped or not
parent f2786221
...@@ -1145,11 +1145,6 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(UBDocumentProxy* proxy, ...@@ -1145,11 +1145,6 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(UBDocumentProxy* proxy,
mXmlWriter.writeStartElement("g"); mXmlWriter.writeStartElement("g");
openStroke = currentStroke; openStroke = currentStroke;
QMatrix matrix = item->sceneMatrix();
if (!matrix.isIdentity())
mXmlWriter.writeAttribute("transform", toSvgTransform(matrix));
UBGraphicsStroke* stroke = dynamic_cast<UBGraphicsStroke* >(currentStroke); UBGraphicsStroke* stroke = dynamic_cast<UBGraphicsStroke* >(currentStroke);
if (stroke) if (stroke)
...@@ -1170,6 +1165,10 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(UBDocumentProxy* proxy, ...@@ -1170,6 +1165,10 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(UBDocumentProxy* proxy,
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(sg->uuid())); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "uuid", UBStringUtils::toCanonicalUuid(sg->uuid()));
QMatrix matrix = sg->sceneMatrix();
if (!matrix.isIdentity())
mXmlWriter.writeAttribute("transform", toSvgTransform(matrix));
qDebug() << "Attributes written"; qDebug() << "Attributes written";
groupHoldsInfo = true; groupHoldsInfo = true;
......
...@@ -173,7 +173,7 @@ UBItem* UBGraphicsStrokesGroup::deepCopy() const ...@@ -173,7 +173,7 @@ UBItem* UBGraphicsStrokesGroup::deepCopy() const
} }
} }
const_cast<UBGraphicsStrokesGroup*>(this)->setTransform(groupTransform); const_cast<UBGraphicsStrokesGroup*>(this)->setTransform(groupTransform);
copy->setTransform(sceneTransform()); copy->setTransform(groupTransform);
return copy; return copy;
} }
...@@ -184,6 +184,7 @@ void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const ...@@ -184,6 +184,7 @@ void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const
if(NULL != cp) if(NULL != cp)
{ {
cp->setTransform(transform()); cp->setTransform(transform());
cp->setPos(pos());
cp->setFlag(QGraphicsItem::ItemIsMovable, true); cp->setFlag(QGraphicsItem::ItemIsMovable, true);
cp->setFlag(QGraphicsItem::ItemIsSelectable, true); cp->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment