<span class="mw-page-title-main">Pan</span>
Fabrice P. Laussπ•ͺ’s β„€ootechnic Web

pan

pan is the template {{pan}} of my web and the gadget that drives it. A picture much wider than tall is shown across the whole white area at a chosen height and browsed with the mouse: dragged sideways, zoomed with Ctrl+wheel, its frame made taller or shorter with a corner grip, a strip under it showing the whole picture with the part in view. A plot can also be given with its tiles, and is then drawn again from its own data at every zoom, so that it stays sharp however far one goes into it. Several pictures of the same proportions can share one box and be gone through with Alt+wheel, each showing the same spot or each keeping its own view.

Browsable

It was made for the figures of the one-atom lasing work, the skeletons of the eigenvalues: plots 9000 pixels wide and 630 high, whose detail is all in the width. As an ordinary thumbnail such a figure shrinks to a grey thread across the page, and in a box with a scrollbar it can only be read at the one scale it was drawn at. The photographs of Panorama had the same problem in a milder form, and all fourteen of them use it now.

Written with Claude on 24 October (2026), and taken up again on 30 October (2026) and 31 October (2026), then on 7 November (2026) and 8 November (2026) in a version tried out apart, which came here with the series on 18 November (2026). Version 1.25. The call is Template:Pan, which keeps only a short help; the box is written by Module:Pan (1.13) with the styles of Template:Pan/styles.css; what moves it is MediaWiki:Gadget-pan.js (1.25) with MediaWiki:Gadget-pan.css (1.15), switched on for everyone in MediaWiki:Gadgets-definition.

Usage

{{pan|Skeleton-lin-wide60-w0.12-0OG5J.png}}
{{pan|Skeleton-lin-wide60-w0.12-0OG5J.png|half}}
{{pan|Skeleton-lin-wide60-w0.12-0OG5J.png|h=250px|caption=The skeleton, linear scale}}
{{pan|Skeleton-lin-wide60-w0.12-0OG5J.png|half|zoom=-7|tip=Fig. (0OG5J)}}
{{pan|Skeleton-all-wide203-wfull-noblack-lines-0QFxd.jpg|630px|zoom=-7|at=0.275}}
{{pan|Skeleton-all-lines-dots-0RSRn-overview.png|630px|tiles=Skeleton-all-lines-dots-0RSRn-tiles.zip|zoom=fit}}
{{pan|A.png;B.png;C.png|400px|at=0.14|names=first;second;third}}
{{pan|Skeleton-all-lines-dots-0RSRn-overview.png|630px|view=x=0.4 y=0.5 zoom=0.3 frame=630}}
Parameter Meaning
1 the file name, with or without File:; or several, separated by ;, for a series gone through in the same box (see Series), all of the proportions of the first
h (or 2) the height: full (default, the file's own height, so one pixel of the picture per pixel of screen), half, third, quarter, a fraction such as 0.4, a size in pixels such as 300 or 300px, or fit to shrink the whole picture into the box with no scrolling (the same as [[File:x|full]])
caption (or 3) an optional caption under the box
zoom the zoom it opens at, in Ctrl+wheel notches from the height given: zoom=-7 opens it seven notches out; zoom=fit opens on the whole picture across the box. The frame keeps the height given, so zooming back in fills it again
at the point the opening view centres, as a share of the picture's width from its left edge: at=0.454 or at=45.4% (default: the middle); the key 0 returns there
tip a <wz> tooltip on the picture (a <wz> written around {{pan}} would hold nothing: MediaWiki moves the box out of it)
tiles a tile archive (a .zip uploaded as a file) made by pantiles from the data of the plot: the plot is then drawn from it at every zoom, see Tiles below; several, separated by ;, for plots of one layout gone through in the same box
names the names of the pictures of a series, separated by ;, shown on its buttons (default: the words of their file names they do not all share, an AF tag only when nothing else is left)
view the view the box opens on, as Ctrl+click on its pin copies it: x=… y=… zoom=… frame=…, and as the case may be stretch=, case=, show=, hide=1, lock=0; a reader's own pin wins over it

A notch of zoom= is Chrome's standard wheel step (100 in deltaY); a real wheel may step differently, so the opening view of zoom=-7 is not necessarily the one seven notches of one's own wheel give.

Moving about

  • Drag: press and drag, and the picture follows the pointer one pixel for one, as a map does; once zoomed in, it moves up and down too. There is no scrollbar.
  • Zoom: Ctrl+wheel over the picture, or a pinch on a trackpad (which the browser reports as the same thing), zooms about the point under the pointer, from the whole picture fitting the width of the box to four screen pixels per pixel of the file. Ctrl+wheel and not the bare wheel, as on an embedded map, so that a plain wheel still scrolls the page when it passes over the picture. The thumbnail made for the chosen height runs out of detail as soon as it is enlarged, so the first zoom past it fetches the file itself and swaps it in once loaded.
  • Keys: +, βˆ’ and 0 (back to the opening view), and the arrow keys, once the box has the focus. A drag gives it the focus, as does Tab; a click cannot, being the link to the file. A finger, Shift+wheel or a trackpad swipe move the picture natively.
  • Frame: the grip in the bottom right corner, drawn and behaving like the one on the edit box, resizes the frame, not the picture: drag it up to trim the view, down to open it, as far as the picture reaches at its present zoom or the window's heightβ€”so zoom in, then pull the corner down to see more of it. Zoom and frame are independent: the frame keeps the height given whatever the zoom, and a picture zoomed out below it sits in its middle, white above and below.
  • Panner: under the box, the whole picture in a strip as wide as the box, the part in view framed and the rest dimmed. Drag the frame, or press anywhere on the strip to go there and drag on; with the middle button the view goes along only, the height kept. At its right end, the magnification: screen pixels per pixel of the file (of the figure, for tiles).
  • Pin: the tick box at the left end of the strip keeps the view of the moment (where, how far in, the frame's height, and for a series or tiles what is shown) in the browser, and the box opens there on the next visit, 0 returning there; unticked, it forgets it. Ctrl+click on it copies that view as a line view=… for the page to open on.
  • Opening view: centred, on the middle of the picture or on the point at= gives, at the zoom zoom= asks for.
  • Click: a click that has not moved opens the file itself, which the browser displays and zooms by its own rulesβ€”no lightbox. Middle-, Ctrl- and Shift-clicks never start a drag; a press that moved more than a few pixels was a drag, and the click the browser fires on release is swallowed.
  • Tooltips: the grip, the strip, its buttons and the magnification say what they do in a wz tooltip, like every tooltip of my web.
  • Margin word: in the left-hand margin, reading upwards beside the foot of the picture, a small italic Browsable in EB Garamond says all this in its tooltip. It shows only where the window leaves the margin room for it (860px and wider).
  • Without JavaScript the box keeps a scrollbar instead, and the margin word does not appear.

The box runs the whole white area (778px), bleeding through the 20px page padding on both sides as full does; in a 𝕐/β„€ post it reaches past the indent of the post's <blockquote> to the same edges. A picture narrower than that at the chosen height is centred and does not scroll. The height is asked of MediaWiki as xNpx, so the thumbnail is made at that size (with 1.5Γ— and 2Γ— versions for sharp screens), never larger than the file. It also works in the previews of the 𝕐/β„€ composer, its edit box and its revise box.

{{fig}} knows it: {{fig|0OG5J}} lands on a picture shown by {{pan}}, whose tip= serves as its caption, and a Ctrl-click on the picture puts that reference in the clipboard (MediaWiki:Gadget-fig.js, since its version 1.2).

Series

The first argument may name several pictures, separated by ;. The first is drawn as ever, and is what a reader without JavaScript sees; the others come to the gadget with it, and one shows at a time in the same box. Alt+wheel over the picture goes to the next or the previous one, one picture a notch, however fast the wheel is turned; ← and β†’ do the same while the pointer is over the picture (or the box has the focus), and so do the buttons at the left end of the strip under the box, which name them. The pictures must have the proportions of the first (to 1 %), so that the same view of each is the same spot: Module:Pan refuses another.

The lock after the buttons says what a flip keeps. Locked, as the box opens, the zoom and the position go over to the next picture: the same spot of each, to see what changes from one to the next. Free, each picture keeps its own view: the view of one is put by when leaving it and found again when coming back to it (a picture not yet seen opens where the last one was). The pin and view= keep the lock with the rest.

Each picture is fetched when first asked for, the thumbnail at the height of the page, the file itself once zoomed past it, and is swapped in only once it is decoded, the one shown staying until then: a fast wheel never flashes white, and goes past those not yet in. After the first flip, the others are fetched one after the other, the nearest first, so that going through them is then immediate. A series of plots drawn from their data is given as several tile archives instead (tiles=A.zip;B.zip, below), with the same buttons, keys and lock.

The skeletons of the eleven campaigns of the one-atom laser, from uijin to teisatsu10, all on the axes of uijin (pumps 0.15–42.91g, Ο‰ Β±29.05g); all but uijin and nijin stop at 12.51g, hence the opening at at=0.14. Teisatsu10 looks nearly empty because almost all its certified lines lie on Ο‰ = 0.

Browsable

Tiles

A picture runs out of detail as soon as it is enlarged: zoom into a plot and its dots and lines swell into blurred blobs, and a figure big enough to hold the detail is past what MediaWiki will make thumbnails of (12.5 megapixels). With tiles=, {{pan}} draws a plot from its data instead. The tool ~/bin/pantiles runs the script that makes the figure, unchanged, keeps what it plots (dots, lines, line collections, scatters, the lines across the whole axes), and draws it again for every level of a zoom pyramid, each level twice the scale of the one below, with the dots and lines kept at the size in pixels they have in the figure: zooming in spreads the data out instead of magnifying the ink, so each level is as sharp at its own scale as the figure is at its. Above the figure's own scale it can also bring in what would only clutter the whole view, such as the dots of the computed points along interpolated lines. Text, images and patches of the figure are not tiled.

The levels are cut into tiles of 512 pixels and packed with their index into one zip, uploaded as a file like any other (the sync to the online wiki carries it as it carries any upload). The gadget fetches only the tiles in view, at the level the zoom asks for, out of that one file with HTTP Range requests, so a reader who never zooms never loads the deep levels; this was checked here and online, where the second request for a piece is already served from the cache in front of the site. Until a tile is in, what is at hand from the levels around stands in for it. The axes are drawn over the plot by the gadget, with ticks chosen for the zoom: the pump axis along the bottom of the view, the other along its left edge, both staying at their edge as the plot scrolls, the titles in the corners. Zoom runs from the whole plot across the box to a quarter past the deepest level. The file given first stays the picture of readers without JavaScript and the one a click opens; pantiles scene makes it, the same figure under the 12.5 megapixels. If the archive cannot be read, the box stays a plain {{pan}}.

pantiles scene skeleton-TAG.npz -- python3 code/panorama.py full 1.6 203.41 figs/skeleton-TAG 9.24
pantiles build skeleton-TAG.npz skeleton-TAG-tiles.zip --deep 4 --points-from +2
{{pan|Skeleton-TAG-overview.png|630px|tiles=Skeleton-TAG-tiles.zip|zoom=fit}}

--deep N levels are drawn above the figure's own scale (each doubles it; 4 = 16Γ—), --points-from +N shows the dots only from N levels above it, --grow lets dots and lines thicken a little with each level, --jobs N draws on N processes. The tiles are PNGs of 64 colours, which cannot be told from full colour and weigh about half of 256. The archive must keep under the wiki's upload limit of 100 MB.

For the skeleton 0RSRn (pumps from 0.15 to 42.91g, 1.27 million dots and 62,000 lines), the scene took 8.5 minutes, nearly all of it the figure's own script, and each tile 50 to 100 ms: --deep 3 made 6,255 tiles, 30.7 MB, in 65 s, and --deep 4 22,498 tiles, 74.2 MB, in 213 s on four processes. Each extra level multiplies the tiles by about 3.5 and the size by 2.4, so --deep 5 would pass the upload limit.

Past the levels drawn as pictures, an archive made with --vector N (pantiles 1.1 and after) also holds the plot's own coordinates, cut into the cells of the deepest drawn level; the gadget draws those levels itself on canvases, in the colours and pixel widths of the figure, some 500 times deeper than the figure. With them the vertical axis can be stretched alone, Ctrl+Shift+wheel (or * and /), for a structure a hair off the axis (a few thousandths of g in the skeleton), and squeezed down to a plot 16 pixels tall; 0 undoes it with the zoom. In the top right corner of the view, a square of the screen with how much of each axis its sides span, and the ratio of the two in the axes' own units.

An archive of pantiles 1.3 and after knows which of its groups are points and which are lines, and holds the pictures of the points alone: a switch at the left end of the strip then shows the points, the lines, or both, at every zoom. With --hideable '#202020=sign unknown' (1.4) it names a colour the reader may hide, and holds the pictures without it, which a toggle beside the switch uses. With --name (1.5) it names itself: several archives of one layout, tiles=A.zip;B.zip, are then gone through in the same box as a series of pictures is, with the switches carried over.

Big pictures

MediaWiki makes no thumbnail of a file over 12.5 megapixels, except a JPEG, which ImageMagick scales: a skeleton of 16382Γ—16382 pixels, 23.5 MB at quality 90, gave its 630, 945 and 1260 pixel thumbnails in 2.8 s (Fig. 0PQpi). WebP is accepted as an upload, but its thumbnails are made as PNG and the limit applies to them. A picture too big for a PNG therefore goes up as a JPEG; past what a JPEG holds, tiles.

Where it is used

  • Here, under Series: the eleven skeletons of the one-atom laser, the first series.

How it is made

  • Module:Pan writes the picture as [[File:x|xNpx|link={{filepath:x}}]] inside a div.lw-pan that scrolls sideways and takes the focus, and hands the gadget the file's width and what zoom=, at= and tiles= asked for as data- attributes. A height given as a share needs the file's own height, which only Lua can read (one "expensive" call per picture). The link= to the file itself is what keeps FancyBox from catching the click.
  • TemplateStyles refuses scrollbar-width, overscroll-behavior, ::-webkit-scrollbar and :focus-visible (the page will not save), so what hides the scrollbar is in the gadget's own CSS, which loads only with its scriptβ€”and that is also what leaves the scrollbar to a reader without JavaScript.
  • The margin word escapes the clip of the content area by being placed absolutely against .mw-body with top:auto, so no script needs to position it; the gadget only levels it with the foot of the picture.
  • The box's CSS bleed of 20px each side is right only at the top level of the text, so the gadget measures the gap to the white box (or, in a preview, to the pane) and widens the margins by exactly that, again whenever the window is resized.
  • The composer paints its previews without firing wikipage.content (that would rebuild MathJax at every keystroke), so a MutationObserver binds a box wherever one turns up.
  • A series goes to the gadget as data-series, a JSON list of each picture's name, the URL of its thumbnail at the page's height ({{filepath:x|W}}, made when the page is parsed) and that of the file. A flip swaps the picture element itself for one already decoded, so the scroll and the size, the same for all, need no change.
  • A wheel notch reaches the page as one event on most mice and as a burst of small ones on others: the first event of a gesture flips at once; past it a notch that comes whole flips once each, and small steps once they add up to 120 pixels, so that a burst still flips once.
  • The tooltips are those of the <wz> tag: the gadget calls its Tip() and UnTip() as the pointer comes and goes, never the browser's own title.
  • A tile archive starts with its manifest, padded to a fixed size so that one Range request from byte 0 reads it, then one index per level (column, row, offset, length of each tile), then the tiles row by row. The gadget fetches a level's index only when the zoom first reaches it, takes neighbouring tiles in one request, keeps six requests in flight at most, abandons those the view has left, and keeps the last 500 tiles at hand. The axes are drawn as blocks of zero size that stick to the edges of the box, so they follow a native scroll without any lag; their ticks go by 1, 2 and 5 and are made again only when the view leaves a window three times its width.

Version history

The gadget's numbers; the module's are in brackets where it changed.

  • 1.0 (24 October (2026)) β€” the template and its module: the picture at a chosen height, across the whole white area, scrolled sideways; a click opens the file. The gadget hides the scrollbar and lets the picture be dragged.
  • 1.1 β€” the zoom, Ctrl+wheel or a pinch, the file itself swapped in past the thumbnail; the drag in both directions. A mode where the pointer's position was the picture's (mouse=hover) was tried and dropped for the drag (module 1.2).
  • 1.2–1.4 β€” the margin word, Browsable with its tooltip: first centred in the right margin, then at the top, then in the left margin, at the foot of the picture, reading upwards (module 1.3–1.5).
  • 1.5 β€” the corner grip that resizes the frame. Version 1.4 had a bar in the middle of the bottom edge that scaled the picture instead.
  • 1.6 β€” the box reaches the edges of the white box wherever it stands, also inside the indented <blockquote> of a 𝕐/β„€ post.
  • 1.7 β€” the picture opens centred, and at the zoom zoom=N asks for (module 1.6).
  • 1.8 β€” the previews of the 𝕐/β„€ composer.
  • 1.9 β€” zoom=fit; tip= (module 1.7).
  • 1.10 (30 October (2026)) β€” at= (module 1.8).
  • 1.11 (31 October (2026)) β€” tiles= and the tool pantiles (module 1.9).
  • 1.12 β€” the zoom stops at 1.25 times the deepest level of the tiles (1.11 went to twice, where the deepest tiles are soft).
  • 1.13 (7 November (2026), tried out apart until 1.24) β€” the frame keeps its height whatever the zoom, a smaller picture centred in it; tiles go deeper, drawn from the plot's coordinates.
  • 1.14 β€” the panner under the box, in place of a zoom slider; the vertical axis stretched alone.
  • 1.15 (8 November (2026)) β€” the aspect ratio of the view in the axes' units.
  • 1.16 β€” the middle button in the panner moves along only.
  • 1.17 β€” the vertical axis squeezes too; the magnification at the right end of the panner.
  • 1.18 β€” points, lines or both; no tooltip and no click through on a tiled plot.
  • 1.19 β€” a colour of the plot that the reader may hide.
  • 1.20 β€” several archives of one layout in one box, gone through with Alt+wheel (module 1.10).
  • 1.21 β€” one flip a wheel gesture, ← and β†’ too; broad stretched views from the pictures; the tooltip of a tiled plot gone at once (module 1.11).
  • 1.22 β€” the pin.
  • 1.23 β€” Ctrl+click on the pin copies the view; view= (module 1.12).
  • 1.24 β€” points drawn from the coordinates in broad stretched views; points kept to their level when stretched.
  • 1.25 (18 November (2026)) β€” series of pictures, {{pan|A;B;C}} and names=; the lock; Alt+wheel one flip a notch; every tooltip a wz tooltip; 1.13 to 1.24 brought here (module 1.13, styles 1.15).

The help on Template:Pan, at its version 1.10, was moved here on 16 November (2026), the template keeping a short one (1.11).