Skip to main content

Home > @jsplumbtoolkit/browser-ui > Surface > positionElementAtEventLocation

Surface.positionElementAtEventLocation() method

Positions a DOM element at the apparent canvas location corresponding to the page location given by some event. This is not intended for use with elements the surface is managing: it is designed to be used with elements such as pop-ups that you may wish to position relative to the content in your canvas.

Signature:

positionElementAtEventLocation(el: Element, evt: Event, xShift?: number, yShift?: number): void;

Parameters

ParameterTypeDescription
elElementElement to position.
evtEventEvent to position element at.
xShiftnumberOptional absolute number of pixels to shift the element by in the x axis after calculating its position relative to the canvas. Typically you'd use this to place something other than the top left corner of your element at the desired location.
yShiftnumberOptional absolute number of pixels to shift the element by in the y axis after calculating its position relative to the canvas.

Returns:

void