From db646269aa3169824e579d3eab94bc8a6a976305 Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Wed, 18 Aug 2021 19:35:33 +0200 Subject: [PATCH] Introduce CSS transformation function rotate --- .../jetbrains/compose/web/css/properties/transform.kt | 1 + web/core/src/jsTest/kotlin/css/TransformTests.kt | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/transform.kt b/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/transform.kt index 41c7abf3e9..de1e6f117c 100644 --- a/web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/transform.kt +++ b/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)" } fun perspectiveTransform(d: CSSLengthValue) = TransformFunction { "perspective($d)" } +fun rotateTransform(a: CSSAngleValue) = TransformFunction { "rotate($a)" } fun StyleBuilder.transform(transformFunction: TransformFunction) { property("transform", transformFunction.apply()) diff --git a/web/core/src/jsTest/kotlin/css/TransformTests.kt b/web/core/src/jsTest/kotlin/css/TransformTests.kt index f4a3ff429e..4f3ef5fcd9 100644 --- a/web/core/src/jsTest/kotlin/css/TransformTests.kt +++ b/web/core/src/jsTest/kotlin/css/TransformTests.kt @@ -38,4 +38,14 @@ class TransformTests { assertEquals("perspective(3cm)", nextChild().style.transform) } + + @Test + fun rotate() = runTest { + composition { + Div({ style { transform(rotateTransform(3.deg)) } }) + } + + assertEquals("rotate(3deg)", nextChild().style.transform) + } + } \ No newline at end of file