]> git.lyx.org Git - features.git/commitdiff
fix drawing of displayed formula
authorAndré Pönitz <poenitz@gmx.net>
Tue, 26 Aug 2003 11:06:04 +0000 (11:06 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 26 Aug 2003 11:06:04 +0000 (11:06 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7606 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formula.C
src/mathed/formula.h

index b7f3f9be185ae18e2556ef78640bc0692cb1506c..a2bd901a526370b96aa3a8f2457b6ece30430662 100644 (file)
@@ -234,7 +234,7 @@ void InsetFormula::draw(PainterInfo & pi, int x, int y) const
                        //p.pain.rectangle(x, y - a, w, h, LColor::mathframe);
                }
 
-               par_->draw(p, x, y);
+               par_->draw(p, x + offset_, y);
        }
 
        xo_ = x;
@@ -287,6 +287,14 @@ void InsetFormula::metrics(MetricsInfo & m, Dimension & dim) const
                dim.asc += 1;
                dim.des += 1;
        }
+
+       if (display()) {
+               offset_ = (m.base.textwidth - dim.wid) / 2;
+               dim.wid = m.base.textwidth;
+       } else {
+               offset_ = 0;
+       }
+
        dim_ = dim;
 }
 
index a0d7abc44f33102de4cc4ca0cebe4370092c6a3b..415eba86b3a2d54f7a141f50516062b88d398f83 100644 (file)
@@ -78,6 +78,8 @@ private:
 
        /// contents
        MathAtom par_;
+       /// x offset for drawing displayed formula
+       mutable int offset_;
 
        /// Use the Pimpl idiom to hide the internals of the previewer.
        class PreviewImpl;