[Summary] Fixed issue when width request from Cavas text returned old width value
authorGZharun <grygoriiz@wavesglobal.com>
Mon, 15 Dec 2014 11:17:44 +0000 (13:17 +0200)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 29 Apr 2015 11:27:34 +0000 (07:27 -0400)
[Reviewed by] Paul Davis

Conflicts:
libs/canvas/canvas/text.h

libs/canvas/canvas/text.h
libs/canvas/text.cc

index a967206e65f70019206f9c0e74e371c1b5d95c50..ee22a3ecdaa6056dc9be3fb9a92c6771c9057712 100644 (file)
@@ -51,6 +51,7 @@ public:
         void dump (std::ostream&) const;
 
        std::string text() const { return _text; }
+       double text_width() const;
 
 private:
        std::string             _text;
index c1b1c517c8ff5444f1e41f2d5d92853ac754aecb..86d8aa9136c15637bf1dbf4cb40be82bdc32ed91 100644 (file)
@@ -244,3 +244,14 @@ Text::dump (ostream& o) const
 
        o << endl;
 }
+
+
+double
+Text::text_width() const
+{
+    if (_need_redraw) {
+        redraw ();
+    }
+    
+    return _width;
+}