nl_tokens: Get SVGRect that contains coordinates and dimension of the real bounding box i . e . after transformations are applied . If target is specified bounding box will be computed relatively to target element .
pl_tokens: function ( withoutTransformations , target ) { // If the element is not in the live DOM, it does not have a bounding box defined and // so fall back to 'zero' dimension element. if ( ! this . node . ownerSVGElement ) return { x : 0 , y : 0 , width : 0 , height : 0 } ; var box ; try { box = this . node . getBBox ( ) ; // Opera returns infinite values in some cases. // Note that Infinity | 0 produces 0 as opposed to Infinity || 0. // We also have to create new object as the standard says that you can't // modify the attributes of a bbox. box = { x : box . x | 0 , y : box . y | 0 , width : box . width | 0 , height : box . height | 0 } ; } catch ( e ) { // Fallback for IE. box = { x : this . node . clientLeft , y : this . node . clientTop , width : this . node . clientWidth , height : this . node . clientHeight } ; } if ( withoutTransformations ) { return box ; } var matrix = this . node . getTransformToElement ( target || this . node . ownerSVGElement ) ; var corners = [ ] ; var point = this . node . ownerSVGElement . createSVGPoint ( ) ; point . x = box . x ; point . y = box . y ; corners . push ( point . matrixTransform ( matrix ) ) ; point . x = box . x + box . width ; point . y = box . y ; corners . push ( point . matrixTransform ( matrix ) ) ; point . x = box . x + box . width ; point . y = box . y + box . height ; corners . push ( point . matrixTransform ( matrix ) ) ; point . x = box . x ; point . y = box . y + <mask> . height ; corners . push ( point . matrixTransform ( matrix ) ) ; var minX = corners [ 0 ] . x ; var maxX = minX ; var minY = corners [ 0 ] . y ; var maxY = minY ; for ( var i = 1 , len = corners . length ; i < len ; i ++ ) { var x = corners [ i ] . x ; var y = corners [ i ] . y ; if ( x < minX ) { minX = x ; } else if ( x > maxX ) { maxX = x ; } if ( y < minY ) { minY = y ; } else if ( y > maxY ) { maxY = y ; } } return { x : minX , y : minY , width : maxX - minX , height : maxY - minY } ; }