@@ -1898,8 +1898,32 @@ void LayoutViewer::paintEvent(QPaintEvent* event)
18981898 brush.a = 100 ;
18991899 }
19001900
1901- animate_selection_->selection .highlight (
1902- gui_painter, Painter::kHighlight , pen_width, brush);
1901+ odb::Rect bbox;
1902+ bool draw_hightlight = true ;
1903+ if (animate_selection_->selection .getBBox (bbox)) {
1904+ const int size = bbox.maxDXDY ();
1905+
1906+ const int min_size = highlightSizeLimit ();
1907+
1908+ if (size < min_size) {
1909+ draw_hightlight = false ;
1910+
1911+ const int half_size = min_size / 2.0 ;
1912+ const int bloat_by = half_size - size;
1913+
1914+ odb::Rect draw_rect;
1915+ bbox.bloat (bloat_by, draw_rect);
1916+ gui_painter.setPen (Painter::kHighlight , true , pen_width);
1917+ gui_painter.setBrush (brush, Painter::Brush::kSolid );
1918+
1919+ gui_painter.drawRect (draw_rect, 0 , 0 );
1920+ }
1921+ }
1922+
1923+ if (draw_hightlight) {
1924+ animate_selection_->selection .highlight (
1925+ gui_painter, Painter::kHighlight , pen_width, brush);
1926+ }
19031927 }
19041928
19051929 // draw partial ruler if present
@@ -2474,6 +2498,11 @@ int LayoutViewer::shapeSizeLimit() const
24742498 return nominalViewableResolution ();
24752499}
24762500
2501+ int LayoutViewer::highlightSizeLimit () const
2502+ {
2503+ return coarseViewableResolution ();
2504+ }
2505+
24772506int LayoutViewer::fineViewableResolution () const
24782507{
24792508 return 1.0 / pixels_per_dbu_;
0 commit comments