diff options
| author | Shlomi Fish <shlomif@shlomifish.org> | 2017-10-05 14:56:20 +0000 |
|---|---|---|
| committer | Shlomi Fish <shlomif@shlomifish.org> | 2017-10-05 14:56:20 +0000 |
| commit | 01abd8ec977b4caae888b7e315c6c18ced52e74c (patch) | |
| tree | e4284c4b77cede6f1ac7e20236bdc916dd8b5e44 /src | |
| parent | Extract a base class, SPDimensions. (diff) | |
| download | inkscape-01abd8ec977b4caae888b7e315c6c18ced52e74c.tar.gz inkscape-01abd8ec977b4caae888b7e315c6c18ced52e74c.zip | |
Extract SPDimensions from spuse
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp-use.cpp | 21 | ||||
| -rw-r--r-- | src/sp-use.h | 7 |
2 files changed, 4 insertions, 24 deletions
diff --git a/src/sp-use.cpp b/src/sp-use.cpp index fae442cfa..61e8002bb 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -43,11 +43,8 @@ SPUse::SPUse() : SPItem(), + SPDimensions(), child(NULL), - x(), - y(), - width(), - height(), href(NULL), ref(new SPUseReference(this)), _delete_connection(), @@ -581,21 +578,7 @@ void SPUse::update(SPCtx *ctx, unsigned flags) { childflags &= SP_OBJECT_MODIFIED_CASCADE; /* Set up child viewport */ - if (this->x.unit == SVGLength::PERCENT) { - this->x.computed = this->x.value * ictx->viewport.width(); - } - - if (this->y.unit == SVGLength::PERCENT) { - this->y.computed = this->y.value * ictx->viewport.height(); - } - - if (this->width.unit == SVGLength::PERCENT) { - this->width.computed = this->width.value * ictx->viewport.width(); - } - - if (this->height.unit == SVGLength::PERCENT) { - this->height.computed = this->height.value * ictx->viewport.height(); - } + this->calcDimsFromParentViewport(ictx); childflags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B; diff --git a/src/sp-use.h b/src/sp-use.h index 81e4391aa..bcf0a8513 100644 --- a/src/sp-use.h +++ b/src/sp-use.h @@ -19,12 +19,13 @@ #include <sigc++/sigc++.h> #include "svg/svg-length.h" +#include "sp-dimensions.h" #include "sp-item.h" #include "enums.h" class SPUseReference; -class SPUse : public SPItem { +class SPUse : public SPItem, public SPDimensions { public: SPUse(); virtual ~SPUse(); @@ -34,10 +35,6 @@ public: SPItem *child; // SVG attrs - SVGLength x; - SVGLength y; - SVGLength width; - SVGLength height; char *href; // the reference to the original object |
