From 0f0d66f3df56b325c71f527307b73d62d54a12a6 Mon Sep 17 00:00:00 2001 From: Dave Leaver Date: Thu, 20 Mar 2014 12:42:40 +1300 Subject: [PATCH] Support matrix3d as used in IE11 --- src/dom/DomUtil.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/dom/DomUtil.js b/src/dom/DomUtil.js index fdc97050..71d29bc4 100644 --- a/src/dom/DomUtil.js +++ b/src/dom/DomUtil.js @@ -146,8 +146,6 @@ L.DomUtil = { // you can't easily get intermediate values of properties animated with CSS3 Transitions, // we need to parse computed style (in case of transform it returns matrix string) - _transformRe: /([-+]?(?:\d*\.)?\d+)\D*, ([-+]?(?:\d*\.)?\d+)\D*, ([-+]?(?:\d*\.)?\d+)\D*\)/, - //Gets the offset and scale of the given element as set by setTransform getTransform: function (el) { //Only handles scale and translate matrices. @@ -155,16 +153,25 @@ L.DomUtil = { //Extract offset and scale from the matrix var style = window.getComputedStyle(el), - matches = style[L.DomUtil.TRANSFORM].match(L.DomUtil._transformRe); + split = style[L.DomUtil.TRANSFORM].split(/[\(,\)]/); - if (!matches) { - return null; + //matrix + if (split.length === 8) { + return { + scale: parseFloat(split[1]), + offset: L.point(parseFloat(split[5]), parseFloat(split[6])) + }; } - return { - scale: parseFloat(matches[1]), - offset: L.point(parseFloat(matches[2]), parseFloat(matches[3])) - }; + //matrix3d + if (split.length === 18) { + return { + scale: parseFloat(split[1]), + offset: L.point(parseFloat(split[13]), parseFloat(split[14])) + }; + } + + return null; }, setPosition: function (el, point, no3d) { // (HTMLElement, Point[, Boolean])