Skip to content

Commit 2a45637

Browse files
SergeyMellNathanWalker
authored andcommitted
fix(styling): change transform parameters parsing (#9481)
Fixed the incorrectly applied short form of "transform: translate" style property. closes #5202
1 parent 37c0731 commit 2a45637

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

apps/automated/src/ui/animation/css-animation-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export function test_ReadTranslateSingle() {
212212

213213
TKUnit.assertEqual(translate.property, 'translate');
214214
TKUnit.assertAreClose(translate.value.x, 30, DELTA);
215-
TKUnit.assertAreClose(translate.value.y, 30, DELTA);
215+
TKUnit.assertAreClose(translate.value.y, 0, DELTA);
216216
}
217217

218218
export function test_ReadTranslateXY() {

packages/core/ui/styling/style-properties.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,13 @@ function normalizeTransformation({ property, value }: Transformation): Transform
736736
}
737737

738738
function convertTransformValue(property: string, stringValue: string): TransformationValue {
739-
const [x, y = x, z = y] = stringValue.split(',').map(parseFloat);
739+
let [x, y, z] = stringValue.split(',').map(parseFloat);
740+
if (property === 'translate') {
741+
y ??= IDENTITY_TRANSFORMATION.translate.y;
742+
} else {
743+
y ??= x;
744+
z ??= y;
745+
}
740746

741747
if (property === 'rotate' || property === 'rotateX' || property === 'rotateY') {
742748
return stringValue.slice(-3) === 'rad' ? radiansToDegrees(x) : x;

0 commit comments

Comments
 (0)