Simple viewer - common features
Canvas Panel is a component of a IIIF viewer, rather than a viewer in its own right.
However, there are several expected viewer features, that Canvas Panel helps implement.
Placing buttons on top of the Canvasโ
This is through CSS positioning, as in the example above.
Full screenโ
This makes Canvas Panel invoke the browser's full screen "F11" API and take up the entire screen (not browser). How you do this may be up to your application, but the example above uses the following:
<button onClick="(cp.requestFullscreen || cp.webkitRequestFullscreen).call(cp)" />
This is not a Canvas Panel feature but a browser feature. It may not work in the sandbox environment.
Zoom in/out buttonsโ
Simply wire up your buttons to Canvas Panel's zoomIn and zoomOut methods:
<button class="osd" onClick="cp.zoomIn()">๐+</button>
<button class="osd" onClick="cp.zoomOut()">๐โ</button>
Resetโ
The goHome()
function will return the viewport to the initial condition:
cp.goHome();