Skip to content

Commit

Permalink
fix FS#1729 - Wrong sizes for dimensions in blocks viewed through
Browse files Browse the repository at this point in the history
viewport
  • Loading branch information
qcad committed Mar 26, 2018
1 parent 7b8232f commit 54b7331
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/core/RBlockReferenceData.cpp
Expand Up @@ -28,7 +28,8 @@ RBlockReferenceData::RBlockReferenceData() :
columnCount(1),
rowCount(1),
columnSpacing(0),
rowSpacing(0) {
rowSpacing(0),
visualPropertiesScale(1.0) {
}

RBlockReferenceData::RBlockReferenceData(RDocument* document,
Expand Down Expand Up @@ -356,6 +357,9 @@ bool RBlockReferenceData::applyTransformationTo(REntity& entity) const {
blockReference->rotate(-2*blockReference->getRotation(), blockReference->getPosition());
blockReference->rotate(rotation);
blockReference->move(position);
if (!RMath::fuzzyCompare(visualPropertiesScale, 1.0)) {
blockReference->scaleVisualProperties(visualPropertiesScale);
}
return true;
}

Expand All @@ -364,6 +368,10 @@ bool RBlockReferenceData::applyTransformationTo(REntity& entity) const {
entity.rotate(rotation);
entity.move(position);

if (!RMath::fuzzyCompare(visualPropertiesScale, 1.0)) {
entity.scaleVisualProperties(visualPropertiesScale);
}

return true;
}

Expand Down Expand Up @@ -580,6 +588,10 @@ bool RBlockReferenceData::scale(const RVector& scaleFactors, const RVector& cent
return true;
}

void RBlockReferenceData::scaleVisualProperties(double scaleFactor) {
visualPropertiesScale = scaleFactor;
}

void RBlockReferenceData::setReferencedBlockId(RBlock::Id blockId) {
referencedBlockId = blockId;
update();
Expand Down
5 changes: 5 additions & 0 deletions src/core/RBlockReferenceData.h
Expand Up @@ -79,6 +79,8 @@ friend class RViewportEntity;
virtual bool scale(const RVector& scaleFactors,
const RVector& center = RDEFAULT_RVECTOR);

virtual void scaleVisualProperties(double scaleFactor);

void setReferencedBlockId(RBlock::Id blockId);

void groundReferencedBlockId() const;
Expand Down Expand Up @@ -152,6 +154,9 @@ friend class RViewportEntity;
int rowCount;
double columnSpacing;
double rowSpacing;

double visualPropertiesScale;

mutable QList<RBox> boundingBoxes;
mutable QList<RBox> boundingBoxesIgnoreEmpty;
mutable QMap<REntity::Id, QSharedPointer<REntity> > cache;
Expand Down

0 comments on commit 54b7331

Please sign in to comment.