Skip to main content

Home > @jsplumbtoolkit/browser-ui > SurfaceRenderOptions

SurfaceRenderOptions interface

This interface defines the allowed parameters on a render call that will create a new Surface.

Signature:

export interface SurfaceRenderOptions 

Properties

PropertyModifiersTypeDescription
addToDragSelectionOnSelect?boolean(Optional) When true, vertices that are added to the underlying Toolkit's selection will be added to the current drag selection. Prior to 5.10.2 this flag's true state was the default behaviour, but the flag now defaults to false, and the Surface uses the concept of "drag groups" to manage dragging the set of selected elements together. For more information check out the Toolkit docs, specifically the section on element dragging.
autoExitSelectMode?boolean(Optional) Whether or not to automatically exit from 'select' mode after a lasso operation. A future version of the Toolkit will move this flag into the lasso plugin.
clamp?boolean(Optional) Whether or not to limit the canvas movement when dragging or zooming so that some part of the dataset is always visible. Defaults to true.
clampToBackground?boolean(Optional) When a background is in use, whether or not to clamp movement of the canvas so that some portion of the background is always visible.
clampToBackgroundExtents?boolean(Optional) When a background is in use, whether or not to clamp movement of the canvas so that the entire background is always visible.
consumeRightClick?boolean(Optional) Whether or not to consume right clicks, which ordinarily will cause a browser to show a context menu with some native browser functions. This defaults to true.
debug?boolean(Optional) Defaults to false. When true, the Surface will console log a few specific pieces of activity in the lifecycle of rendering a vertex.
decorators?Array<DecoratorSpec>(Optional) Optional list of decorators to attach to the Surface.
defaults?JsPlumbDefaults<{ E: Element; }>(Optional) Optional defaults to use for the underlying renderer.
directRender?boolean(Optional) Direct rendering is a mode in which the Surface disables pan/zoom, and adjusts its content so that the origin of the content is [0,0]. This mode can be used to embed the Surface into a read only UI (while still maintaining its dynamic connection to the underlying dataset)
dragOptions?SurfaceDragOptions(Optional) Options for dragging vertices.
elementsDraggable?boolean(Optional) Whether or not the elements in the Surface should be draggable. Defaults to true.
enableAnimation?boolean(Optional) Whether or not to support animation of pan/zoom operations.
enablePan?boolean(Optional) Whether or not to enable panning of the canvas. Defaults to true.
enhancedView?boolean(Optional) Defaults to true, meaning node/group/edge definitions support parameters in their declarations, where the final values at render time are extracted from the data for the object being rendered.
events?Record<string, (value: any, event?: any) => any>(Optional) Optional map of handlers for various events generated by the Surface.
grid?SurfaceGridOptions(Optional) Options for imposing a grid onto the elements in the Surface.
id?string(Optional) Optional ID for the Surface. Allows you to retrieve this Surface from a toolkit instance's getRenderer(id) method.
layout?{ type: string; options?: LayoutParameters; }(Optional) Defines the layout to use.
logicalPorts?boolean(Optional) Defaults to false. When true, if a port is added to a vertex programmatically, the surface treats the vertex's DOM element as the DOM element for the port if it cannot find a specific element for the port.
magnetize?SurfaceMagnetizeOptions(Optional)
mode?SurfaceMode(Optional) Mode to start in. Defaults to 'pan'.
modelLeftAttribute?string(Optional) Defines the name of the attribute in a given vertex's backing data that provides its location in the X axis. Defaults to "left". If you have a UI with multiple renderers you can use this parameter to store multiple sets of locations for a given vertex inside its data.
modelTopAttribute?string(Optional) Defines the name of the attribute in a given vertex's backing data that provides its location in the Y axis. Defaults to "top". If you have a UI with multiple renderers you can use this parameter to store multiple sets of locations for a given vertex inside its data.
objectFilter?(b: Base) => boolean(Optional) Optional filter that can decide whether or not the Surface renders a specific node or group. By default all nodes and groups in the underlying dataset are rendered.
plugins?Array<SurfacePluginSpec>(Optional) Optional list of plugins to attach to the Surface.
propertyMappings?PropertyMappings(Optional) Optional set of mappings from property values to edge definitions.
refreshAutomatically?boolean(Optional) Whether or not the automatically refresh the layout when model data changes. Defaults to true.
refreshLayoutOnEdgeConnect?boolean(Optional) When true, the Surface will run a refresh of the underlying layout whenever a new edge is established. This defaults to false, but you might want to set this to true if you're using the Hierarchical or Hierarchy layouts, because it has a bearing on the way they paint. However, if your users are able to drag vertices around, you may not wish for the layout to move things that they have placed, which is why this defaults to false.
relayoutOnGroupUpdate?boolean(Optional) Defaults to false. When true, changes to a group cause the entire surface to perform a relayout.
selection?Selection | Function(Optional) Optional Selection - or generator - to use as the dataset to render. If you supply this the Surface will render the contents of the selection, or the list of vertices that the given function returns. This is useful for such things as inspector windows for parts of your UI.
simpleEdgeStyles?boolean(Optional) Defaults to false. This flag instructs the Surface to automatically extract color, lineWidth, outlineWidth and outlineColor values from the backing data for edges, and to use these to set the appearance of a connection for that edge. In version 6 of the Toolkit this flag will likely default to true.
storePositionsInModel?boolean(Optional) Whether or not to store vertex positions in the middle after running a layout. Defaults to false. A future release of the Toolkit will set this flag to true by default.
templates?Record<string, string>(Optional) When using 'vanilla' Toolkit, you can provide a map of templates here rather than including them somewhere in the HTML of the page.
view?SurfaceViewOptions(Optional) Mappings of vertex/edge types to their rendering and behaviour.
wheel?SurfaceWheelOptions(Optional) Options for the behaviour of the mousewheel (which also covers two finger scrolling on a mac trackpad)
zoom?number(Optional) Starting zoom for the Surface. Defaults to 1.
zoomRange?ZoomRange(Optional) The zoom range for the Surface - minimum and maximum values, expressed as decimals. Defaults to [0.05, 3].
zoomToFit?boolean(Optional) If true, zoom the display so that the dataset is entirely visible after initialisation.
zoomToFitIfNecessary?boolean(Optional) If true, zoom the display so that the dataset is entirely visible after initialisation, but only adjust the zoom level if the dataset is not already visible at the default zoom level.