BloomBerry's picture
Add files using upload-large-folder tool
723f01e verified
Raw
History Blame Contribute Delete
10.9 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BulletsNormalizeLevels_GroundTruth</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&display=swap">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #1a1a2e;
color: #e0e0e0;
padding: 40px 20px;
}
h1 {
text-align: center;
margin-bottom: 8px;
font-size: 28px;
color: #fff;
}
.meta {
text-align: center;
margin-bottom: 40px;
color: #888;
font-size: 14px;
}
.slide-container {
margin: 0 auto 60px auto;
max-width: 100%;
}
.slide-label {
text-align: center;
margin-bottom: 12px;
font-size: 16px;
font-weight: 600;
color: #aaa;
}
.slide-wrapper {
display: flex;
justify-content: center;
overflow-x: auto;
}
.slide {
flex-shrink: 0;
transform-origin: top left;
box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.images-section {
max-width: 1400px;
margin: 60px auto;
}
.images-section h2 {
text-align: center;
margin-bottom: 24px;
color: #fff;
}
.images-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
}
.image-card {
background: #16213e;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.image-card img {
width: 100%;
height: 200px;
object-fit: contain;
background: #0f0f23;
padding: 8px;
}
.image-label {
padding: 8px 12px;
font-size: 11px;
color: #888;
word-break: break-all;
}
@media (max-width: 1920px) {
.slide {
transform: scale(0.5);
margin-bottom: -25%;
}
.slide-wrapper {
max-height: 600px;
}
}
@media (min-width: 1921px) {
.slide {
transform: scale(0.75);
margin-bottom: -12%;
}
}
</style>
</head>
<body>
<h1>BulletsNormalizeLevels_GroundTruth</h1>
<div class="meta">1 slide(s)</div>
<div class="slide-container">
<div class="slide-label">Slide 0 &mdash; Frame</div>
<div class="slide-wrapper">
<div class="slide" data-slide-id="1:36" style="width: 1920.0px; height: 1080.0px; background-color: rgba(255,255,255,1.0); background-image: linear-gradient(rgba(255,255,255,1.0), rgba(255,255,255,1.0)); background-size: auto; background-position: 0 0; background-repeat: repeat; position: relative; overflow: hidden;">
<div class="ft" data-id="1:37" style="position: absolute; left: 128.0px; top: 432.0px; width: 660.0px; height: 216.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center"><div style="font-size: 60.0px; font-family: 'Inter', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 700; letter-spacing: -1.3200000286102296px; line-height: 72.0px; text-align: left; color: rgba(0,0,0,1.0)">Mixed bullet levels (Normalize levels to 0/1)</div></div>
<div class="ft" data-id="1:38" style="position: absolute; left: 968.0px; top: 240.0px; width: 680.0px; height: 600.0px; opacity: 1.0; overflow: visible; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center"><div style="font-size: 36.0px; font-family: 'Inter', 'Oswald', 'Inter', 'Noto Sans', 'Helvetica Neue', 'Hiragino Sans', 'Yu Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei', Helvetica, Arial, sans-serif; font-weight: 400; letter-spacing: -0.36px; line-height: 50.39999771118164px; text-align: left; color: rgba(0,0,0,1.0)">Project Alpha<br><ul style="margin: 0; padding-left: 3em"><li>requirements drafted</li><li>design in progress</li></ul>Project Beta<br><ul style="margin: 0; padding-left: 3em"><li>needs owner</li><li>blocked by procurement</li></ul>Project Theta<br><ul style="margin: 0; padding-left: 3em"><li>4 steps to unblocking path state</li><li>First: Copy</li><li>Second: Untangle</li><li>Third: Reroute</li><li>Fourth: Toggle</li></ul></div></div>
</div>
</div>
</div>
<script>
// Shrink-to-fit: when a custom font fails to load and the fallback is wider/taller, the rendered text overflows the Figma bbox. The shrink is SLACK-AWARE — each text is allowed to overflow into the empty space between it and its nearest neighbor in the overflow direction. Figma sizes text containers tightly around the original font's glyph extent, but the surrounding layout often leaves visual breathing room (e.g. 56px gaps between nav labels). Squeezing every label into its tight bbox makes them look weak; letting them grow into the gap keeps the design closer to the source while still preventing actual overlap.
(function() {
// Per-element "how far can I overflow before hitting a neighbor" computed once. Position-fixed: depends only on bbox layout, not on font shrink state.
var slackCache = new WeakMap();
function computeSlack(container) {
if (slackCache.has(container)) return slackCache.get(container);
var slide = container.closest('.slide');
var er = container.getBoundingClientRect();
var sliderc = slide ? slide.getBoundingClientRect() : null;
var leftS = Infinity, rightS = Infinity, topS = Infinity, botS = Infinity;
if (slide) {
// Collide against other text labels only — overlapping decorative shapes/backgrounds is usually fine and often intentional. Text-on-text is what creates unreadable layouts.
slide.querySelectorAll('.ft').forEach(function(other) {
if (other === container || container.contains(other) || other.contains(container)) return;
var or = other.getBoundingClientRect();
var vertOverlap = or.top < er.bottom - 0.5 && or.bottom > er.top + 0.5;
var horzOverlap = or.left < er.right - 0.5 && or.right > er.left + 0.5;
if (vertOverlap) {
if (or.left >= er.right - 0.5) rightS = Math.min(rightS, or.left - er.right);
if (or.right <= er.left + 0.5) leftS = Math.min(leftS, er.left - or.right);
}
if (horzOverlap) {
if (or.top >= er.bottom - 0.5) botS = Math.min(botS, or.top - er.bottom);
if (or.bottom <= er.top + 0.5) topS = Math.min(topS, er.top - or.bottom);
}
});
}
if (sliderc) {
leftS = Math.min(leftS, Math.max(0, er.left - sliderc.left));
rightS = Math.min(rightS, Math.max(0, sliderc.right - er.right));
topS = Math.min(topS, Math.max(0, er.top - sliderc.top));
botS = Math.min(botS, Math.max(0, sliderc.bottom - er.bottom));
}
var scale = er.width / (container.clientWidth || 1); // rendered-px → layout-px
var toLayout = function(v) { return v === Infinity ? 99999 : Math.max(0, v / (scale || 1)); };
var s = { left: toLayout(leftS), right: toLayout(rightS), top: toLayout(topS), bottom: toLayout(botS) };
slackCache.set(container, s);
return s;
}
function fitOne(container) {
var inner = container.firstElementChild;
if (!inner) return;
var cw = container.clientWidth, ch = container.clientHeight;
if (!cw || !ch) return;
if (inner.dataset.origFs) {
inner.style.fontSize = inner.dataset.origFs;
if (inner.dataset.origLs) inner.style.letterSpacing = inner.dataset.origLs;
if (inner.dataset.origLh) inner.style.lineHeight = inner.dataset.origLh;
} else {
inner.dataset.origFs = getComputedStyle(inner).fontSize;
inner.dataset.origLs = getComputedStyle(inner).letterSpacing;
inner.dataset.origLh = getComputedStyle(inner).lineHeight;
}
var origFs = parseFloat(inner.dataset.origFs);
var origLs = parseFloat(inner.dataset.origLs) || 0;
var origLh = parseFloat(inner.dataset.origLh) || 0;
// Single-line text (white-space: nowrap, or no <br> in the source) only needs to fit its WIDTH — the fallback font's natural line-box (ascender + descender) is usually a few px taller than the Figma bbox even at the correct font, and that's expected, not an overflow to fix.
var isSingleLine = getComputedStyle(inner).whiteSpace === 'nowrap' || !/<br/i.test(inner.innerHTML);
var slack = computeSlack(container);
var align = getComputedStyle(inner).textAlign;
// Effective allowed width: bbox + slack on the side(s) the text actually overflows toward, per text-align.
var allowedW;
if (align === 'right' || align === 'end') allowedW = cw + slack.left;
else if (align === 'center') allowedW = cw + 2 * Math.min(slack.left, slack.right);
else allowedW = cw + slack.right; // left / start / justify
var allowedH = ch + slack.bottom; // text typically grows downward when wrapping
var fs = origFs;
for (var iter = 0; iter < 8; iter++) {
var iw = inner.scrollWidth, ih = inner.scrollHeight;
var rw = iw > allowedW + 0.5 ? allowedW / iw : 1;
var rh = (!isSingleLine && ih > allowedH + 0.5) ? allowedH / ih : 1;
var r = Math.min(rw, rh);
if (r > 0.998) break;
var newFs = Math.max(6, fs * r);
if (newFs >= fs - 0.05) break;
fs = newFs;
inner.style.fontSize = fs + 'px';
// Scale letter-spacing AND line-height proportionally so they shrink with font-size — otherwise the absolute-px values dominate at small sizes.
if (origLs) inner.style.letterSpacing = (origLs * fs / origFs) + 'px';
if (origLh) inner.style.lineHeight = (origLh * fs / origFs) + 'px';
}
}
function fitAll() { document.querySelectorAll('.ft').forEach(fitOne); }
if (document.fonts && document.fonts.ready) {
document.fonts.ready.then(fitAll);
} else {
window.addEventListener('load', fitAll);
}
var t;
window.addEventListener('resize', function() { clearTimeout(t); t = setTimeout(fitAll, 150); });
})();
</script>
</body>
</html>