Skip to main content

Home > @jsplumbtoolkit/browser-ui > BackgroundOptions

BackgroundOptions interface#


export interface BackgroundOptions 


height?number(Optional) Required for tiled backgrounds. Indicates the height of the full image.
img?any(Optional) Image to use. Optional; you can also supply a url
maxZoom?number(Optional) Required for tiled backgrounds. Indicates the maximum zoom level. Zoom starts at 0 - fully zoomed out - and increases in integer values from there. Eash successive zoom level is twice the zoom of the previous level, meaning two times as many tiles in each direction.
onBackgroundReady?Function(Optional) Optional function to call when the image has loaded (only relevant when type is "simple".
panDebounceTimeout?number(Optional) For tiled backgrounds, how long to wait after a pan before reloading tiles.
tileSize?Size(Optional) For tiled backgrounds, provides the width and height of tiles. Every tile is assumed to have these dimensions, even if the tile has whitespace in it. You must supply this if you set type to "tiled"
tiling?string(Optional) Default is "logarithmic": each layer is assumed to have a maximum of (2^level+1) tiles in each axis (for instance at level 0, 2 tiles in each axis. Alternatively you can set this to be "absolute", which means that at the maximum zoom level the number of tiles in each axis is computed as the size of the image in that axis divided by the tile size in that axis (rounded up of course).
typestring"tiled" or "simple": whether to use a single background image or to tile it. Defaults to "simple".
url?string(Optional) URL for the background. When type is set to "simple" you can supply either this, or an Image. When type is set to "tiled", you can supply this, or you can supply a urlGenerator function instead. If you supply url and no urlGenerator, the url you supply is treated as a template for the url for any given tile, and is expected to contain {z}, {x} and {y} placeholders. The form of the URL can be anything you like as long as it has the placeholders for z,x and y. For instance:{z}/{x}/{y}{z}&x={x}&y={y}etc
urlGenerator?(z: number, x: number, y: number) => string(Optional) For tiled backgrounds, an optional function you can supply to generate the URL for a given tile. See url for an explanation of the default syntax for urls when using a tiled background.
width?number(Optional) Required for tiled backgrounds. Indicates the width of the full image.
zoomDebounceTimeout?number(Optional) For tiled backgrounds, how long to wait after a zoom before reloading tiles.