Browse Source

Introduce CSS transformation function rotate

CSS_TRANSFORMATION
Shagen Ogandzhanian 3 years ago
parent
commit
db646269aa
  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

@ -21,6 +21,7 @@ fun matrix3dTransform(
) = TransformFunction { "matrix3d($a1, $b1, $c1, $d1, $a2, $b2, $c2, $d2, $a3, $b3, $c3, $d3, $a4, $b4, $c4, $d4)" } ) = TransformFunction { "matrix3d($a1, $b1, $c1, $d1, $a2, $b2, $c2, $d2, $a3, $b3, $c3, $d3, $a4, $b4, $c4, $d4)" }
fun perspectiveTransform(d: CSSLengthValue) = TransformFunction { "perspective($d)" } fun perspectiveTransform(d: CSSLengthValue) = TransformFunction { "perspective($d)" }
fun rotateTransform(a: CSSAngleValue) = TransformFunction { "rotate($a)" }
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

@ -38,4 +38,14 @@ class TransformTests {
assertEquals("perspective(3cm)", nextChild().style.transform) assertEquals("perspective(3cm)", nextChild().style.transform)
} }
@Test
fun rotate() = runTest {
composition {
Div({ style { transform(rotateTransform(3.deg)) } })
}
assertEquals("rotate(3deg)", nextChild().style.transform)
}
} }
Loading…
Cancel
Save