ui: sit the tag's point on the visible edge, not a pixel inside it

`right: 100%` positions against the containing block's *padding* box, and
the tag body carries a 1px border, so a square centred there sits a pixel
inside the visible left edge.  The point read as set into the tag rather
than growing out of it.  Nudged left by exactly that pixel, with the
margin that reserves room for it following.

Two pixels was too far: the point's edges then meet the body's left edge
short of its corners, and the difference shows as a gap on the inner side.

The geometry test that was supposed to cover this could not tell the
difference.  It asserted the tip lands far to the left of the body, which
is true either way -- the un-nudged tip is only 2px further right and
still well clear.  The claim is about where the point is *centred*, so it
measures that now, and was checked against the un-nudged version.

Its neighbour, which checks the left margin covers the protrusion, is
deliberately still geometry-agnostic: the margin-to-protrusion
relationship is the invariant, and the exact offset is a matter of eye.
It also now derives the protrusion from half the square's diagonal rather
than half its side, which had made it loose enough to pass against a
margin 5px short.
This commit is contained in:
Roland 2026-07-31 14:19:40 -06:00
parent ab560e6e88
commit d117d92a85
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 64 additions and 10 deletions

View file

@ -599,8 +599,11 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
.wrolpi-tag {
position: relative;
/* Room for the point, which is drawn outside the body. */
margin-left: 15px;
/*
* Room for the point, which is drawn outside the body: half its diagonal (14.1px) plus
* the 1px it is nudged left, rounded up.
*/
margin-left: 16px;
/* Tags wrap, and a wrapped row was sitting on the row above it. */
margin-bottom: 5px;
/*
@ -619,7 +622,15 @@ html[data-theme="amber"] .wrolpi-path-input-control:focus-within {
right: 100%;
width: 20px;
height: 20px;
transform: translate(50%, -50%) rotate(45deg);
/*
* Nudged 1px left of where `right: 100%` puts it. That property positions against the
* containing block's *padding* box, and the body carries a 1px border, so a square centred
* there sits a pixel inside the visible left edge -- and the point read as set slightly
* into the tag rather than growing out of it. This is exactly that border: 2px opened a
* visible gap on the inner side, because the point's edges then meet the body's left edge
* short of its corners and leave the difference showing.
*/
transform: translate(calc(50% - 1px), -50%) rotate(45deg);
background: var(--label-color);
}