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
preferencesAboutTextFull
Craig Watson 8 years ago
parent f2786221c3
commit e094da34bc
  1. 9
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 3
      src/domain/UBGraphicsStrokesGroup.cpp

@ -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,
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
} }
} }
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
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);

Loading…
Cancel
Save