<span class="mw-page-title-namespace">Template</span><span class="mw-page-title-separator">:</span><span class="mw-page-title-main">Pan</span>
Fabrice P. Lauss𝕪’s ℤoisitic Web

A picture much wider than tall, shown across the white content area at a chosen height and moved with the mouse: press and drag, and the picture follows the pointer. There is no scrollbar. Ctrl+wheel over the picture zooms about the pointer, as does a pinch on a trackpad, from the whole picture fitting the width up to four screen pixels per pixel of the file; once zoomed in, the picture drags up and down too, and the original file replaces the thumbnail for the detail. A plain wheel still scrolls the page. Once the picture has been dragged, or reached with Tab, the keys +, − and 0 (back to the start) also work, as do the arrow keys; a finger, Shift+wheel or a trackpad swipe move it too. It opens centred on the middle of the picture, or sideways on the point at= gives. A click that does not move opens the file itself, which the browser displays and zooms by its own rules—no lightbox. The grip in the bottom right corner, as on the edit box, resizes the frame: drag it up to trim the view, down to open it, as far as the picture reaches at its present zoom—so zoom in, then pull the corner down to see more of it. In the left-hand margin, reading upwards beside the foot of the picture, a small italic Browsable says all this in its tooltip; it shows only where the window leaves the margin room for it (860px and wider). All this is done by MediaWiki:Gadget-pan.js; without JavaScript the box keeps a scrollbar instead, and the margin word does not appear. Version 1.10.

Parameter Meaning
1 the file name, with or without File:
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 below

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), 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. The levels are cut into tiles of 512 pixels and packed with their index into one zip. The gadget fetches only the tiles in view, at the level the zoom asks for, out of that one file (HTTP Range requests), so a reader who never zooms never loads the deep levels. 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, the titles in the corners. Zoom runs from the whole plot across the box to a little 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.

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×, the size of the zip growing about fourfold per level), --points-from +N shows the dots only from N levels above it, --grow lets dots and lines thicken a little with each level. The archive keeps under the wiki's upload limit of 100 MB.

{{pan|Skeleton-lin-wide-w0.3-0OdQd.png}}
{{pan|Skeleton-lin-wide-w0.3-0OdQd.png|half}}
{{pan|Skeleton-lin-wide-w0.3-0OdQd.png|h=250px|caption=The skeleton, linear scale}}

The box runs the whole white area (778px), bleeding through the 20px page padding on both sides as full does; 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. The work is done by Module:Pan; the styles are in Template:Pan/styles.css.

Example, the Alhambra at 250px:

Browsable
The Alhambra, 24 December 2017