Browse Source

Introduce CSS transformation function scale3d

CSS_TRANSFORMATION
Shagen Ogandzhanian 3 years ago
parent
commit
233a5ccef8
  1. 1
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/transform.kt
  2. 10
      web/core/src/jsTest/kotlin/css/TransformTests.kt

1
web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/transform.kt

@ -30,6 +30,7 @@ fun rotateZ(a: CSSAngleValue) = TransformFunction { "rotateZ($a)" }
fun scaleTransform(sx: Number) = TransformFunction { "scale($sx)" } fun scaleTransform(sx: Number) = TransformFunction { "scale($sx)" }
fun scaleTransform(sx: Number, sy: Number) = TransformFunction { "scale($sx, $sy)" } fun scaleTransform(sx: Number, sy: Number) = TransformFunction { "scale($sx, $sy)" }
fun scale3dTransform(sx: Number, sy: Number, sz: Number) = TransformFunction { "scale3d($sx, $sy, $sz)" }
fun StyleBuilder.transform(transformFunction: TransformFunction) { fun StyleBuilder.transform(transformFunction: TransformFunction) {
property("transform", transformFunction.apply()) property("transform", transformFunction.apply())

10
web/core/src/jsTest/kotlin/css/TransformTests.kt

@ -107,4 +107,14 @@ class TransformTests {
assertEquals("scale(0.2, 0.3)", nextChild().style.transform) assertEquals("scale(0.2, 0.3)", nextChild().style.transform)
} }
@Test
fun scale3d() = runTest {
composition {
Div({ style { transform(scale3dTransform(0.2, 0.3, 0.1)) } })
}
assertEquals("scale3d(0.2, 0.3, 0.1)", nextChild().style.transform)
}
} }
Loading…
Cancel
Save