diff --git a/contrib/mobile/drawContext.cpp b/contrib/mobile/drawContext.cpp index b25e6004a3db743ae464bd467e33195180b81e49..3968441e6d2c64f2bbfe40906553e353e9f76ac3 100644 --- a/contrib/mobile/drawContext.cpp +++ b/contrib/mobile/drawContext.cpp @@ -707,13 +707,13 @@ int drawContext::drawTics(drawContext *ctx, int comp, double n, std::string &for char tmp[256]; - // reduce number of vertical tics if not zoomed enough - double ww = _width/(_right-_left)*_scale[0]; - double hh = _height/(_top-_bottom)*_scale[0]; - if(hh < 10 && comp == 1){ - n = 2; - } - + // reduce number of vertical tics if not zoomed enough + double ww = _width/(_right-_left)*_scale[0]; + double hh = _height/(_top-_bottom)*_scale[0]; + if(hh < 10 && comp == 1){ + n = 2; + } + // draw n tics double step = l / (double)(n - 1); double value_step = value_l / (double)(n - 1); @@ -729,6 +729,17 @@ int drawContext::drawTics(drawContext *ctx, int comp, double n, std::string &for value_p1[1] + value_t[1] * value_d, value_p1[2] + value_t[2] * value_d}; + // draw tic labels + if(comp < 0) // display the length value (ruler-mode, starting at 0) + sprintf(tmp, format.c_str(), value_d); + else // display the coordinate value + sprintf(tmp, format.c_str(), value_p[comp]); + + if(strlen(tmp)){ + drawString lbl(tmp, 15 * _fontFactor); + lbl.draw(r[0], r[1], r[2], ww, hh); + } + GLfloat lines[] = { (float)p[0], (float)p[1], (float)p[2], (float)q[0], (float)q[1], (float)q[2] @@ -744,17 +755,6 @@ int drawContext::drawTics(drawContext *ctx, int comp, double n, std::string &for glDrawArrays(GL_LINES, 0, 2); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_COLOR_ARRAY); - - // draw tic labels - if(comp < 0) // display the length value (ruler-mode, starting at 0) - sprintf(tmp, format.c_str(), value_d); - else // display the coordinate value - sprintf(tmp, format.c_str(), value_p[comp]); - - if(strlen(tmp)){ - drawString lbl(tmp, 15 * _fontFactor); - lbl.draw(r[0], r[1], r[2], ww, hh); - } } return n; }