Skip to content

Commit bc444a0

Browse files
committed
gui: dont draw guide outlines when guides are less than 10 pixels wide
Signed-off-by: Peter Gadfort <peter.gadfort@gmail.com>
1 parent 1695880 commit bc444a0

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

src/gui/src/dbDescriptors.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,18 +1642,22 @@ void DbNetDescriptor::highlight(std::any object, Painter& painter) const
16421642
if (!guides.empty()) {
16431643
draw_flywires = false;
16441644

1645-
// draw outlines of guides
1646-
std::vector<odb::Rect> guide_rects;
1647-
guide_rects.reserve(guides.size());
1648-
for (const auto* guide : guides) {
1649-
guide_rects.push_back(guide->getBox());
1650-
}
1651-
painter.saveState();
1652-
painter.setBrush(painter.getPenColor(), gui::Painter::Brush::kNone);
1653-
for (const odb::Polygon& outline : odb::Polygon::merge(guide_rects)) {
1654-
painter.drawPolygon(outline);
1645+
if (guides.begin()->getBox().minDXDY() * painter.getPixelsPerDBU()
1646+
>= kMinGuidePixelWidth) {
1647+
// draw outlines of guides, dont draw if less that kMinGuidePixelWidth
1648+
// pixels
1649+
std::vector<odb::Rect> guide_rects;
1650+
guide_rects.reserve(guides.size());
1651+
for (const auto* guide : guides) {
1652+
guide_rects.push_back(guide->getBox());
1653+
}
1654+
painter.saveState();
1655+
painter.setBrush(painter.getPenColor(), gui::Painter::Brush::kNone);
1656+
for (const odb::Polygon& outline : odb::Polygon::merge(guide_rects)) {
1657+
painter.drawPolygon(outline);
1658+
}
1659+
painter.restoreState();
16551660
}
1656-
painter.restoreState();
16571661

16581662
painter.saveState();
16591663
Painter::Color highlight_color = painter.getPenColor();

src/gui/src/dbDescriptors.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ class DbNetDescriptor : public BaseDbDescriptor<odb::dbNet>
222222
odb::dbObject* getSink(const std::any& object) const;
223223

224224
static const int kMaxIterms = 10000;
225+
static constexpr double kMinGuidePixelWidth = 10.0;
225226
};
226227

227228
class DbITermDescriptor : public BaseDbDescriptor<odb::dbITerm>

0 commit comments

Comments
 (0)