summaryrefslogtreecommitdiffstats
path: root/src/util/units.cpp
diff options
context:
space:
mode:
authorMatthew Petroff <matthew@mpetroff.net>2013-07-20 16:29:12 +0000
committerMatthew Petroff <matthew@mpetroff.net>2013-07-20 16:29:12 +0000
commitb4b22e6dba56bc9b0b8c35a9d484f1d86d61f45b (patch)
tree4033a8bbfa9e152d85efb1256e1daef271f08e2d /src/util/units.cpp
parentCleanup. (diff)
downloadinkscape-b4b22e6dba56bc9b0b8c35a9d484f1d86d61f45b.tar.gz
inkscape-b4b22e6dba56bc9b0b8c35a9d484f1d86d61f45b.zip
Added percentage support to "Inkscape::Util::Quantity::convert".
(bzr r12380.1.43)
Diffstat (limited to 'src/util/units.cpp')
-rw-r--r--src/util/units.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util/units.cpp b/src/util/units.cpp
index 78531bfaf..dcb3ae4b1 100644
--- a/src/util/units.cpp
+++ b/src/util/units.cpp
@@ -504,6 +504,11 @@ double Quantity::value(const Glib::ustring u) const
/** Convert distances. */
double Quantity::convert(const double from_dist, const Unit &from, const Unit &to)
{
+ // Percentage
+ if (to.type == UNIT_TYPE_DIMENSIONLESS) {
+ return from_dist * to.factor;
+ }
+
// Incompatible units
if (from.type != to.type) {
return -1;