(element, inverse, adjustGOffset, includeScrollInFixed)
| 396 | // ty = m.b * x + m.d * y + m.f |
| 397 | |
| 398 | export function getGlobalMatrix(element, inverse, adjustGOffset, includeScrollInFixed) { |
| 399 | // adjustGOffset is typically used only when grabbing an element's PARENT's global matrix, and it ignores the x/y offset of any SVG <g> elements because they behave in a special way. |
| 400 | if (!element || !element.parentNode || (_doc || _setDoc(element)).documentElement === element) { |
| 401 | return new Matrix2D(); |
| 402 | } |
| 403 | |
| 404 | var zeroScales = _forceNonZeroScale(element), |
| 405 | svg = _svgOwner(element), |
| 406 | temps = svg ? _svgTemps : _divTemps, |
| 407 | container = _placeSiblings(element, adjustGOffset), |
| 408 | b1 = temps[0].getBoundingClientRect(), |
| 409 | b2 = temps[1].getBoundingClientRect(), |
| 410 | b3 = temps[2].getBoundingClientRect(), |
| 411 | parent = container.parentNode, |
| 412 | isFixed = !includeScrollInFixed && _isFixed(element), |
| 413 | m = new Matrix2D((b2.left - b1.left) / 100, (b2.top - b1.top) / 100, (b3.left - b1.left) / 100, (b3.top - b1.top) / 100, b1.left + (isFixed ? 0 : _getDocScrollLeft()), b1.top + (isFixed ? 0 : _getDocScrollTop())); |
| 414 | |
| 415 | parent.removeChild(container); |
| 416 | |
| 417 | if (zeroScales) { |
| 418 | b1 = zeroScales.length; |
| 419 | |
| 420 | while (b1--) { |
| 421 | b2 = zeroScales[b1]; |
| 422 | b2.scaleX = b2.scaleY = 0; |
| 423 | b2.renderTransform(1, b2); |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | return inverse ? m.inverse() : m; |
| 428 | } |
| 429 | export { _getDocScrollTop, _getDocScrollLeft, _setDoc, _isFixed, _getCTM }; // export function getMatrix(element) { |
| 430 | // _doc || _setDoc(element); |
| 431 | // let m = (_win.getComputedStyle(element)[_transformProp] + "").substr(7).match(/[-.]*\d+[.e\-+]*\d*[e\-\+]*\d*/g), |
no test coverage detected
searching dependent graphs…