(element, origin, parentMatrix)
| 88 | }, |
| 89 | _numExp = /[-+\.]*\d+\.?(?:e-|e\+)?\d*/g, |
| 90 | _originToPoint = function _originToPoint(element, origin, parentMatrix) { |
| 91 | // origin is an array of normalized values (0-1) in relation to the width/height, so [0.5, 0.5] would be the center. It can also be "auto" in which case it will be the top left unless it's a <path>, when it will start at the beginning of the path itself. |
| 92 | var m = getGlobalMatrix(element), |
| 93 | x = 0, |
| 94 | y = 0, |
| 95 | svg; |
| 96 | |
| 97 | if ((element.tagName + "").toLowerCase() === "svg") { |
| 98 | svg = element.viewBox.baseVal; |
| 99 | svg.width || (svg = { |
| 100 | width: +element.getAttribute("width"), |
| 101 | height: +element.getAttribute("height") |
| 102 | }); |
| 103 | } else { |
| 104 | svg = origin && element.getBBox && element.getBBox(); |
| 105 | } |
| 106 | |
| 107 | if (origin && origin !== "auto") { |
| 108 | x = origin.push ? origin[0] * (svg ? svg.width : element.offsetWidth || 0) : origin.x; |
| 109 | y = origin.push ? origin[1] * (svg ? svg.height : element.offsetHeight || 0) : origin.y; |
| 110 | } |
| 111 | |
| 112 | return parentMatrix.apply(x || y ? m.apply({ |
| 113 | x: x, |
| 114 | y: y |
| 115 | }) : { |
| 116 | x: m.e, |
| 117 | y: m.f |
| 118 | }); |
| 119 | }, |
| 120 | _getAlignMatrix = function _getAlignMatrix(fromElement, toElement, fromOrigin, toOrigin) { |
| 121 | var parentMatrix = getGlobalMatrix(fromElement.parentNode, true, true), |
| 122 | m = parentMatrix.clone().multiply(getGlobalMatrix(toElement)), |
no test coverage detected
searching dependent graphs…