UNPKG

jointjs

Version:

JavaScript diagramming library

4 lines (2 loc) 921 B
<pre class="docs-method-signature"><code>V.transformRect(r, matrix)</code></pre> <p>Transform a rectangle specified by <code>r</code> (an object with <code>x</code>, <code>y</code>, <code>width</code> and <code>height</code> properties) by an SVG transformation represented by <code>matrix</code>. This function is used internally in the <a href="#V.prototype.bbox">V.prototype.bbox</a> method to return a bounding box of an SVG element relative to another SVG parent element. However, this can be used elsewhere too, that's why it is publicly exposed. Whenever you need to transform a bounding box to a coordinate system of another element, use this function. To get the transformation <code>matrix</code> of the target element relative to which you want to tranform your rectangle, use e.g. the native SVG method: <code>var matrix = svgSourceElement.getTransformToElement(svgTargetElement)</code>.</p>