Skip to content

Commit 0846abe

Browse files
chore(docs): update code docs
1 parent 2a74c3a commit 0846abe

3 files changed

Lines changed: 41 additions & 14 deletions

File tree

docs/components_ItemDetails.bs.html

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@
4646
' Date added label - positioned at bottom right
4747
m.dateCreatedLabel = m.top.findNode("dateCreatedLabel")
4848

49+
' Re-anchor date label (and logo, if loaded) after the button group layout settles.
50+
' setDateAdded() runs before setupButtons(), so its boundingRect() call would see an
51+
' empty group. This observer fires after the render thread computes the real height.
52+
m.buttonGrp.observeField("renderTracking", "onButtonGrpRendered")
53+
4954
' Gradient overlay - dynamically sized to span from itemDetails to extrasSlider
5055
m.itemTextGradient = m.top.findNode("itemTextGradient")
5156
m.itemDetails = m.top.findNode("itemDetails")
@@ -1762,11 +1767,41 @@
17621767
dateAdded.toLocalTime()
17631768
m.dateCreatedLabel.text = tr("Added") + " " + dateAdded.AsDateString("short-month-no-weekday") + " " + formatTime(dateAdded)
17641769

1765-
' Position at bottom right: screen is 1920x1080, with 96px padding
1770+
' Set X position only — Y is deferred to anchorDateLabel() which runs after the
1771+
' button group layout settles (via renderTracking observer).
1772+
m.dateCreatedLabel.translation = [1920 - 96 - 450, 0]
1773+
m.dateCreatedLabel.visible = true
1774+
end sub
1775+
1776+
' anchorDateLabel: Derive the date label's Y position from the button group's rendered rect.
1777+
' Returns dateLabelY so callers (e.g. logo positioning) can use it without duplicating the math.
1778+
' Safe to call multiple times — idempotent.
1779+
' @return {float} dateLabelY — the Y coordinate used for the date label
1780+
function anchorDateLabel() as float
17661781
buttonRect = m.buttonGrp.boundingRect()
17671782
buttonBottom = buttonRect.y + buttonRect.height
1768-
m.dateCreatedLabel.translation = [1920 - 96 - 450, buttonBottom - 30]
1769-
m.dateCreatedLabel.visible = true
1783+
dateLabelY = buttonBottom - 30
1784+
1785+
if isValid(m.dateCreatedLabel) and m.dateCreatedLabel.visible
1786+
m.dateCreatedLabel.translation = [m.dateCreatedLabel.translation[0], dateLabelY]
1787+
end if
1788+
1789+
return dateLabelY
1790+
end function
1791+
1792+
' onButtonGrpRendered: Fires after the render thread settles the button group layout.
1793+
' Re-anchors the date label and repositions the logo (if already loaded) so both
1794+
' elements reflect the true button group height.
1795+
sub onButtonGrpRendered()
1796+
if m.buttonGrp.renderTracking = "none" then return
1797+
1798+
dateLabelY = anchorDateLabel()
1799+
1800+
' If the logo is already loaded and visible, reposition it relative to the new dateLabelY.
1801+
if isValid(m.itemLogo) and m.itemLogo.visible
1802+
logoY = dateLabelY - m.itemLogo.height - 18
1803+
m.itemLogo.translation = [m.itemLogo.translation[0], logoY]
1804+
end if
17701805
end sub
17711806

17721807
' onLogoLoadStatusChanged: Position logo to the right, with its bottom just above the date label.
@@ -1817,15 +1852,7 @@
18171852
rightEdge = 1920 * 0.95
18181853
logoX = rightEdge - displayWidth
18191854

1820-
if isValid(m.dateCreatedLabel) and m.dateCreatedLabel.visible
1821-
' Anchor logo bottom 18px above the date label
1822-
dateLabelY = m.dateCreatedLabel.translation[1]
1823-
else
1824-
' Date label hidden — use the same position it would occupy
1825-
buttonRect = m.buttonGrp.boundingRect()
1826-
buttonBottom = buttonRect.y + buttonRect.height
1827-
dateLabelY = buttonBottom - 30
1828-
end if
1855+
dateLabelY = anchorDateLabel()
18291856
logoY = dateLabelY - displayHeight - 18
18301857

18311858
m.itemLogo.translation = [logoX, logoY]

docs/data/search.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/module-ItemDetails.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)