Skip to content

Commit 4f2d061

Browse files
githajaeclaude
andcommitted
Fix connector line x-alignment: anchor to Optimize chip via JS
Previously the .opt-connector used margin:0 auto, centering it in the card rather than under the Optimize chip (3rd of 4 pipeline chips, so right-of-center). alignConnector() now measures the chip's center X at runtime and sets marginLeft accordingly, so the line always drops straight from Optimize regardless of layout or viewport size. Also adds a window resize handler to re-align on viewport changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6e158f6 commit 4f2d061

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

_layouts/research-interests.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,27 @@ <h2 class="s-title">The AI<br>Database System.</h2>
214214
var semChip = document.getElementById('sem-chip');
215215
var planChip = document.getElementById('plan-chip');
216216
var dots = document.querySelectorAll('.ri-dot');
217+
var currentStep = 1;
218+
219+
/* Position the opt-connector so it is centred directly below the
220+
Optimize chip, no matter where the chip sits in the pipeline row. */
221+
function alignConnector() {
222+
if (!planChip || !semChip) return;
223+
var connector = semChip.querySelector('.opt-connector');
224+
if (!connector) return;
225+
226+
var chipRect = planChip.getBoundingClientRect();
227+
var expandRect = semChip.getBoundingClientRect();
228+
229+
/* horizontal distance from plan-expand's left edge to chip centre */
230+
var offset = (chipRect.left + chipRect.width / 2) - expandRect.left;
231+
232+
connector.style.marginLeft = (offset - 1) + 'px'; /* -1 = half of 2px width */
233+
connector.style.marginRight = '0';
234+
}
217235

218236
function update(activeStep) {
237+
currentStep = activeStep;
219238
elements.forEach(function (el) {
220239
var from = parseInt(el.dataset.from, 10);
221240
el.classList.toggle('lit', activeStep >= from);
@@ -225,6 +244,7 @@ <h2 class="s-title">The AI<br>Database System.</h2>
225244
dots.forEach(function (d, i) {
226245
d.classList.toggle('active', (i + 1) === activeStep);
227246
});
247+
if (activeStep >= 5) alignConnector();
228248
}
229249

230250
var observer = new IntersectionObserver(function (entries) {
@@ -237,5 +257,10 @@ <h2 class="s-title">The AI<br>Database System.</h2>
237257

238258
steps.forEach(function (s) { observer.observe(s); });
239259
update(1); // initialise diagram to step 1
260+
261+
/* Re-align on resize (e.g. font scaling, window resize) */
262+
window.addEventListener('resize', function () {
263+
if (currentStep >= 5) alignConnector();
264+
});
240265
}());
241266
</script>

_sass/custom/_research-interests.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ body.page--research-interests #main {
197197
}
198198

199199
// Vertical line from Optimize chip down to the ops box
200+
// (horizontal position set dynamically by JS — see alignConnector())
200201
.opt-connector {
201202
width: 2px;
202203
height: 14px;
203204
background: rgba(0, 113, 227, 0.45);
204-
margin: 0 auto;
205205
border-radius: 1px;
206206
}
207207

0 commit comments

Comments
 (0)