Skip to content

Commit 812fb80

Browse files
committed
web: expand tile bounds to include outward pin labels
The tile grid was sized to cover the die plus pin marker size, but not the label text that extends outward from each die edge (matching the Qt GUI placement). Pin labels at the die boundary were clipped because no tiles existed beyond the marker margin. Expand getBounds() to account for the full label extent — marker size + text margin + longest BTerm name width — converted to DBU at the critical zoom where labels first appear. The same bounds feed both server tile mapping and the client bounds response, so the client automatically requests tiles for the expanded area. Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
1 parent 3f33ffb commit 812fb80

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

src/web/src/tile_generator.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,22 @@ odb::Rect TileGenerator::getBounds() const
395395
odb::Rect bounds;
396396
if (odb::dbBlock* block = getBlock()) {
397397
bounds = block->getBBox()->getBox();
398-
// Expand for pin markers that extend outside the die edge.
399-
const int margin = getPinMaxSize();
400-
if (margin > 0) {
398+
// Expand for pin markers AND labels that extend outside the die edge.
399+
// At the zoom where labels first appear, the label extends
400+
// marker_px + text_margin + text_width pixels
401+
// past the pin anchor. Convert to DBU by dividing by the critical
402+
// scale (= kMinPinNameSizePixels / pin_size).
403+
const int pin_size = getPinMaxSize();
404+
if (pin_size > 0) {
405+
int max_text_px = 0;
406+
for (odb::dbBTerm* term : block->getBTerms()) {
407+
const int w = fontAtlasTextWidth(term->getName(), kPinLabelFontHeight);
408+
if (w > max_text_px) {
409+
max_text_px = w;
410+
}
411+
}
412+
const int label_px = kMinPinNameSizePixels + 3 + max_text_px;
413+
const int margin = label_px * pin_size / kMinPinNameSizePixels;
401414
bounds.set_xlo(bounds.xMin() - margin);
402415
bounds.set_ylo(bounds.yMin() - margin);
403416
bounds.set_xhi(bounds.xMax() + margin);

0 commit comments

Comments
 (0)