Created
May 16, 2021 11:58
-
-
Save pencelab/1c30d08e51ab6a0b808c8a5b4c5c336d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline fun panel(init: Panel.() -> Unit): Panel { | |
return Panel().apply { init() } | |
} | |
inline fun Panel.square(init: SquareBuilder.() -> Unit): Square { | |
return SquareBuilder().apply { init() }.build().also { this.addShape(it) } | |
} | |
inline fun Panel.triangle(init: TriangleBuilder.() -> Unit): Triangle { | |
return TriangleBuilder().apply { init() }.build().also { this.addShape(it) } | |
} | |
inline fun Panel.rhombus(init: RhombusBuilder.() -> Unit): Rhombus { | |
return RhombusBuilder().apply { init() }.build().also { this.addShape(it) } | |
} | |
inline fun Panel.composed(init: Panel.() -> ComposedShape): ComposedShape { | |
return init().also { this.addShape(it) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment