1
0
mirror of https://github.com/locomotivemtl/locomotive-boilerplate.git synced 2026-01-15 00:55:08 +08:00

Run precommit

This commit is contained in:
Deven Caron
2023-02-01 09:49:25 -05:00
parent 3fa1de473c
commit 8f3034d54a

View File

@@ -4,32 +4,32 @@
* @return {number|object} translate value
*/
const getTranslate = $el => {
if(!window.getComputedStyle) {
const getTranslate = ($el) => {
if (!window.getComputedStyle) {
return
}
let translate
const style = getComputedStyle($el)
const transform = style.msTransform || style.webkitTransform || style.MozTransform || style.OTransform || style.transform
const transform =
style.msTransform ||
style.webkitTransform ||
style.MozTransform ||
style.OTransform ||
style.transform
const matrix3D = transform.match(/^matrix3d\((.+)\)$/)
if(matrix3D) {
if (matrix3D) {
translate = parseFloat(matrix3D[1].split(', ')[13])
} else {
const matrix = transform.match(/^matrix\((.+)\)$/)
translate = {
x: matrix ? parseFloat(matrix[1].split(', ')[4]) : 0,
y: matrix ? parseFloat(matrix[1].split(', ')[5]) : 0
y: matrix ? parseFloat(matrix[1].split(', ')[5]) : 0,
}
}
return translate
}
export {
transform,
getTranslate
}
export { transform, getTranslate }