Skip to content

The embed at most 80% of the course's visible height (P53b) - #36

Merged
cedricvogel-leo merged 1 commit into
mainfrom
feature/embed-visible-height
Nov 13, 2026
Merged

cedricvogel-leo merged 1 commit into
mainfrom
feature/embed-visible-height

Conversation

@cedricvogel-leo

Copy link
Copy Markdown
Collaborator

P53b, the macro half. Merge after glpython-edu/glpython-editor#61, which deploys the embed that fills its iframe and reports its natural height. With today's embed, this macro would cut off a tall visualizer instead of scrolling it.

Change

  • fitHeight sets the iframe to min(the content's height from glpython:resize, 80 % of the visible height − the block's own rows).
  • The visible height is the clientHeight of the element that scrolls the course: the nearest ancestor with overflow-y: auto|scroll, which is .lia-slide__container in LiaScript; otherwise the window.
  • The block's own rows are the buttons, libraries and notes above the iframe. If an opened row (a library's file, the IDE link) would leave the iframe less than 50 % of the visible height, the iframe keeps 50 %.
  • It is recalculated on every glpython:resize, on window resize, and through a ResizeObserver on the scrolling element and the block. That covers fullscreen, rotation, presentation mode, and LiaScript's top bar shown or hidden.
  • The fixed 1200 px is gone, and so are windowHeight / visualizerHeight in the URL.
  • large: while visualizing, the embed gets the full 80 %; otherwise it keeps its natural height. The embed now says whether it visualizes (visualizing in glpython:resize); with an older embed, only visual blocks count as visualizing.
  • A visual block still starts at its minimum (190 px; large: the maximum), and no minimum exceeds the maximum.
  • README: the author-facing text on heights and large.

Checks

  • check-macro and check:ready pass. New cases in check:ready, with a stand-in scrolling container:
    • the block is 80 % of 600 px;
    • a short content keeps its own height;
    • when the container grows to 900 px, the block becomes 80 % of that;
    • large gets its own height until it visualizes, then 80 %.
  • Real LiaScript player with the local embed of #61: the details are in that PR. In short, the block is 80 % of the visible height in textbook and presentation mode, with the top bar hidden and shown, at window heights 600/900/1100 and at 768×1024 with touch. Short programs keep the old heights.

🤖 Generated with Claude Code

The iframe gets the height the embed's content needs, at most 80% of the
visible height of the element that scrolls the course (LiaScript's
.lia-slide__container, else the window) minus the block's own rows, measured
anew whenever that element or the block changes size (window, fullscreen,
rotation, presentation mode, LiaScript's top bar). The fixed 1200px and the
window height measured once at load are gone. "large": while visualizing,
the embed is as tall as it may be.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cedricvogel-leo
cedricvogel-leo merged commit 81413ab into main Nov 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant