]> git.lyx.org Git - features.git/commitdiff
InsetMathXArrow.cpp: the cells of \xleftarrow must be centered
authorUwe Stöhr <uwestoehr@lyx.org>
Mon, 17 Feb 2014 00:23:16 +0000 (01:23 +0100)
committerUwe Stöhr <uwestoehr@lyx.org>
Mon, 17 Feb 2014 00:23:16 +0000 (01:23 +0100)
the cells are centered in the output so also center them in LyX

src/mathed/InsetMathXArrow.cpp

index eef5b4388c4546aff6f65ea5eb7d839801331760..06ef4a52403c691a8cc7766ed03382ef273f64f3 100644 (file)
@@ -51,9 +51,12 @@ void InsetMathXArrow::metrics(MetricsInfo & mi, Dimension & dim) const
 void InsetMathXArrow::draw(PainterInfo & pi, int x, int y) const
 {
        ScriptChanger dummy(pi.base);
-       cell(0).draw(pi, x + 5, y - 10);
+       Dimension const dim00 = dimension(*pi.base.bv);
+       Dimension const & dim01 = cell(0).dimension(*pi.base.bv);
+       // center the cells with the decoration
+       cell(0).draw(pi, x + dim00.width()/2 - dim01.width()/2, y - 10);
        Dimension const & dim1 = cell(1).dimension(*pi.base.bv);
-       cell(1).draw(pi, x + 5, y + dim1.height());
+       cell(1).draw(pi, x + dim00.width()/2 - dim1.width()/2, y + dim1.height());
        Dimension const dim = dimension(*pi.base.bv);
        mathed_draw_deco(pi, x + 1, y - 7, dim.wid - 2, 5, name_);
        drawMarkers(pi, x, y);