View → Compose Migration
Module Dependencies
Section titled “Module Dependencies”Before:
implementation 'io.fabianterhorst:isometric:0.1.0'After:
implementation("io.github.jayteealao:isometric-compose:<version>")Layout
Section titled “Layout”Before (XML):
<io.fabianterhorst.isometric.IsometricView android:id="@+id/isometric_view" android:layout_width="match_parent" android:layout_height="match_parent" />After (Compose):
IsometricScene(modifier = Modifier.fillMaxSize()) { Shape(geometry = Prism(Point.ORIGIN), color = IsoColor.BLUE)}Adding Shapes
Section titled “Adding Shapes”Before:
isometricView.add(Prism(Point(0.0, 0.0, 0.0)), Color(33, 150, 243))After:
Shape( geometry = Prism(Point(0.0, 0.0, 0.0)), color = IsoColor(33, 150, 243))Color Class
Section titled “Color Class”Color was renamed to IsoColor to avoid collision with Compose’s Color class.
Click Handling
Section titled “Click Handling”Before:
isometricView.setClickListener { renderCommand -> // handle click}After:
IsometricScene( config = SceneConfig( gestures = GestureConfig( onTap = { event -> /* event.node is the tapped shape */ } ) )) { ... }Key Differences Summary
Section titled “Key Differences Summary”| Aspect | View API | Compose API |
|---|---|---|
| Entry point | IsometricView (XML) | IsometricScene (Composable) |
| Adding shapes | view.add(shape, color) | Shape(geometry, color) composable |
| Transforms | shape.translate/rotate/scale | Shape params + Group hierarchy |
| State updates | Imperative: view.clear() + re-add | Declarative: recomposition |
| Click handling | setClickListener | GestureConfig.onTap |
| Color type | Color | IsoColor |
| Animation | Manual invalidation | withFrameNanos + recomposition |
Backward Compatibility
Section titled “Backward Compatibility”The isometric-android-view module still provides the View API for projects that aren’t ready to migrate.