Re: [css-houdini-drafts] [css-typed-om] Provide a way to resolve a CSSUnitValue and CSSMath* to a pixel value (#798)

It's more complicated than that. Assume something like `transform:translate(10px,20px) translate(30%,200%) rotate(20deg) translate(-30%,-200%)` - this is from an attempt to make a card game where I show a hand of cards, then I want to drag one card away from it's position. Now I need the transformation matrix. I can to that with window.getComputedStyle(card), but there I get a string notation of the matrix and must parse it. With card.computedStyleMap().transform, I get a CSSTransformValue, but I cannot call toMatrix on it because of the % values. Converting percentages by myself means that I need to run throug all transform components, check for units that are incompatible with px, find their context, convert them according to context, et cetera. From window.getComputedStyle, I get this for free, just in string format. 
So, yes, it's convenience. A big, whopping, VERY useful convenience.

-- 
GitHub Notification of comment by Rolf-B
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/798#issuecomment-1366732212 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 28 December 2022 15:25:40 UTC