ElementGeometryUpdateEvent
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Want more browser support for this feature? Tell us why.
The ElementGeometryUpdateEvent interface is the event object for the elementgeometryupdate event, which fires when drawable element geometry has been updated via an OffscreenCanvas.
This includes when geometry has been updated automatically during a OffscreenCanvasRenderingContext2D.drawElementImage() call, or manually using an OffscreenCanvas.updateElementGeometry() call.
Constructor
ElementGeometryUpdateEvent()-
Returns a new
ElementGeometryUpdateEventevent object instance.
Instance properties
Also inherits properties from its parent Event.
ElementGeometryUpdateEvent.elementsRead only-
An array of references to the elements whose geometry was changed.
Instance methods
Inherits methods from its parent, Event.
Examples
>Reporting geometry updates from an offscreen canvas
Our Canvas 2D context offscreen canvas example (source code) shows how to render an element on an offscreen canvas using drawElementImage().
In this example, our main thread includes an elementgeometryupdate event handler on the <canvas> that logs the drawable elements whose geometry has been changed via the worker (the resulting array will only contain a reference to the <form> element), and the transform DOMMatrix applied to it (retrieved using getElementTransform()):
canvas.addEventListener("elementgeometryupdate", (e) => {
console.log("Geometry update:", e.elements);
console.log(canvas.getElementTransform(e.elements[0]));
});