diff options
Diffstat (limited to 'src/display')
| -rw-r--r-- | src/display/drawing-text.cpp | 34 | ||||
| -rw-r--r-- | src/display/snap-indicator.cpp | 48 |
2 files changed, 41 insertions, 41 deletions
diff --git a/src/display/drawing-text.cpp b/src/display/drawing-text.cpp index f37f4d3c4..f652a2970 100644 --- a/src/display/drawing-text.cpp +++ b/src/display/drawing-text.cpp @@ -67,13 +67,11 @@ unsigned DrawingGlyphs::_updateItem(Geom::IntRect const &/*area*/, UpdateContext _pick_bbox = Geom::IntRect(); _bbox = Geom::IntRect(); - Geom::OptRect b; - /* orignally it did the one line below, but it did not handle ws characters at all, and it had problems with scaling for overline/underline. Replaced with the section below, which seems to be much more stable. - b = bounds_exact_transformed(*_font->PathVector(_glyph), ctx.ctm); + Geom::OptRect b = bounds_exact_transformed(*_font->PathVector(_glyph), ctx.ctm); */ /* Make a bounding box that is a little taller and lower (currently 10% extra) than the font's drawing box. Extra space is to hold overline or underline, if present. All characters in a font use the same ascent and descent, @@ -81,37 +79,37 @@ unsigned DrawingGlyphs::_updateItem(Geom::IntRect const &/*area*/, UpdateContext the bounding box is limited to the box surrounding the drawn parts of visible glyphs only, and draws outside are ignored. */ - float scale = 1.0; - if(_transform){ scale /= _transform->descrim(); } - - Geom::Rect bigbox(Geom::Point(0.0, _asc*scale*1.1),Geom::Point(_width*scale, -_dsc*scale*1.1)); - b = bigbox * ctx.ctm; + float scale_bigbox = 1.0; + if (_transform) { + scale_bigbox /= _transform->descrim(); + } - if (b && (ggroup->_nrstyle.stroke.type != NRStyle::PAINT_NONE)) { - float width, scale; + Geom::Rect bigbox(Geom::Point(0.0, _asc*scale_bigbox*1.1),Geom::Point(_width*scale_bigbox, -_dsc*scale_bigbox*1.1)); + Geom::Rect b = bigbox * ctx.ctm; + if (ggroup->_nrstyle.stroke.type != NRStyle::PAINT_NONE) { // this expands the selection box for cases where the stroke is "thick" - scale = ctx.ctm.descrim(); + float scale = ctx.ctm.descrim(); if (_transform) { scale /= _transform->descrim(); // FIXME temporary hack } - width = MAX(0.125, ggroup->_nrstyle.stroke_width * scale); + float width = MAX(0.125, ggroup->_nrstyle.stroke_width * scale); if ( fabs(ggroup->_nrstyle.stroke_width * scale) > 0.01 ) { // FIXME: this is always true - b->expandBy(0.5 * width); + b.expandBy(0.5 * width); } // save bbox without miters for picking - _pick_bbox = b->roundOutwards(); + _pick_bbox = b.roundOutwards(); float miterMax = width * ggroup->_nrstyle.miter_limit; if ( miterMax > 0.01 ) { // grunt mode. we should compute the various miters instead // (one for each point on the curve) - b->expandBy(miterMax); + b.expandBy(miterMax); } - _bbox = b->roundOutwards(); - } else if (b) { - _bbox = b->roundOutwards(); + _bbox = b.roundOutwards(); + } else { + _bbox = b.roundOutwards(); _pick_bbox = *_bbox; } /* diff --git a/src/display/snap-indicator.cpp b/src/display/snap-indicator.cpp index 1dd3022c7..627bfb2ab 100644 --- a/src/display/snap-indicator.cpp +++ b/src/display/snap-indicator.cpp @@ -262,36 +262,38 @@ SnapIndicator::set_new_snaptarget(Inkscape::SnappedPoint const &p, bool pre_snap // Display the tooltip, which reveals the type of snap source and the type of snap target gchar *tooltip_str = NULL; - if (p.getSource() != SNAPSOURCE_GRID_PITCH) { + if ( (p.getSource() != SNAPSOURCE_GRID_PITCH) && (p.getTarget() != SNAPTARGET_UNDEFINED) ) { tooltip_str = g_strconcat(source_name, _(" to "), target_name, NULL); - } else { + } else if (p.getSource() != SNAPSOURCE_UNDEFINED) { tooltip_str = g_strdup(source_name); } double fontsize = prefs->getInt("/tools/measure/fontsize"); - Geom::Point tooltip_pos = p.getPoint(); - if (tools_isactive(_desktop, TOOLS_MEASURE)) { - // Make sure that the snap tooltips do not overlap the ones from the measure tool - tooltip_pos += _desktop->w2d(Geom::Point(0, -3*fontsize)); - } else { - tooltip_pos += _desktop->w2d(Geom::Point(0, -2*fontsize)); + if (tooltip_str) { + Geom::Point tooltip_pos = p.getPoint(); + if (tools_isactive(_desktop, TOOLS_MEASURE)) { + // Make sure that the snap tooltips do not overlap the ones from the measure tool + tooltip_pos += _desktop->w2d(Geom::Point(0, -3*fontsize)); + } else { + tooltip_pos += _desktop->w2d(Geom::Point(0, -2*fontsize)); + } + + SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(_desktop), _desktop, tooltip_pos, tooltip_str); + sp_canvastext_set_fontsize(SP_CANVASTEXT(canvas_tooltip), fontsize); + SP_CANVASTEXT(canvas_tooltip)->rgba = 0xffffffff; + SP_CANVASTEXT(canvas_tooltip)->outline = false; + SP_CANVASTEXT(canvas_tooltip)->background = true; + if (pre_snap) { + SP_CANVASTEXT(canvas_tooltip)->rgba_background = 0x33337f40; + } else { + SP_CANVASTEXT(canvas_tooltip)->rgba_background = 0x33337f7f; + } + SP_CANVASTEXT(canvas_tooltip)->anchor_position = TEXT_ANCHOR_CENTER; + g_free(tooltip_str); + + _snaptarget_tooltip = _desktop->add_temporary_canvasitem(canvas_tooltip, timeout_val); } - SPCanvasItem *canvas_tooltip = sp_canvastext_new(sp_desktop_tempgroup(_desktop), _desktop, tooltip_pos, tooltip_str); - sp_canvastext_set_fontsize(SP_CANVASTEXT(canvas_tooltip), fontsize); - SP_CANVASTEXT(canvas_tooltip)->rgba = 0xffffffff; - SP_CANVASTEXT(canvas_tooltip)->outline = false; - SP_CANVASTEXT(canvas_tooltip)->background = true; - if (pre_snap) { - SP_CANVASTEXT(canvas_tooltip)->rgba_background = 0x33337f40; - } else { - SP_CANVASTEXT(canvas_tooltip)->rgba_background = 0x33337f7f; - } - SP_CANVASTEXT(canvas_tooltip)->anchor_position = TEXT_ANCHOR_CENTER; - g_free(tooltip_str); - - _snaptarget_tooltip = _desktop->add_temporary_canvasitem(canvas_tooltip, timeout_val); - // Display the bounding box, if we snapped to one Geom::OptRect const bbox = p.getTargetBBox(); if (bbox) { |
