mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
fix(styling): change transform parameters parsing (#9481)
Fixed the incorrectly applied short form of "transform: translate" style property. closes #5202
This commit is contained in:

committed by
Nathan Walker

parent
37c0731a8a
commit
2a4563716a
@ -212,7 +212,7 @@ export function test_ReadTranslateSingle() {
|
||||
|
||||
TKUnit.assertEqual(translate.property, 'translate');
|
||||
TKUnit.assertAreClose(translate.value.x, 30, DELTA);
|
||||
TKUnit.assertAreClose(translate.value.y, 30, DELTA);
|
||||
TKUnit.assertAreClose(translate.value.y, 0, DELTA);
|
||||
}
|
||||
|
||||
export function test_ReadTranslateXY() {
|
||||
|
@ -736,7 +736,13 @@ function normalizeTransformation({ property, value }: Transformation): Transform
|
||||
}
|
||||
|
||||
function convertTransformValue(property: string, stringValue: string): TransformationValue {
|
||||
const [x, y = x, z = y] = stringValue.split(',').map(parseFloat);
|
||||
let [x, y, z] = stringValue.split(',').map(parseFloat);
|
||||
if (property === 'translate') {
|
||||
y ??= IDENTITY_TRANSFORMATION.translate.y;
|
||||
} else {
|
||||
y ??= x;
|
||||
z ??= y;
|
||||
}
|
||||
|
||||
if (property === 'rotate' || property === 'rotateX' || property === 'rotateY') {
|
||||
return stringValue.slice(-3) === 'rad' ? radiansToDegrees(x) : x;
|
||||
|
Reference in New Issue
Block a user