Doodle 0.4.2 released
Tags: kotlin, webdev, javascript, opensource
Published: 2021-02-16 00:23:46

[Doodle](https://github.com/nacular/doodle) is a pure Kotlin UI framework for the Web, that lets you create rich applications without relying on Javascript, HTML or CSS. Check out the [documentation](https://nacular.github.io/doodle) and [tutorials](https://nacular.github.io/doodle-tutorials) to learn more.

# Features
- New helpers for creating paths for [circles](https://github.com/nacular/doodle/blob/master/Core/src/commonMain/kotlin/io/nacular/doodle/geometry/Path.kt#L123), [rings](https://github.com/nacular/doodle/blob/master/Core/src/commonMain/kotlin/io/nacular/doodle/geometry/Path.kt#L142), and [ring-sections](https://github.com/nacular/doodle/blob/master/Core/src/commonMain/kotlin/io/nacular/doodle/geometry/Path.kt#L157)

```kotlin
val ring   : Path = ring       (center, innerRadius, outerRadius)
val section: Path = ringSection(center, innerRadius, outerRadius, startAngle, endAngle)
```
- New [PathProgressIndicatorBehavior](https://github.com/nacular/doodle/blob/master/Themes/src/commonMain/kotlin/io/nacular/doodle/theme/PathProgressIndicatorBehavior.kt#L21) that lets you create progress indicators by [outlining a path](https://nacular.github.io/doodle/#/controls)

```kotlin
object: ProgressIndicator() {
    init {
        size     = Size(200, 100)
        progress = 0.25
        behavior = PathProgressIndicatorBehavior(
            pathMetrics,          // injected
            path                = path("M10 80 C 40 10, 65 10, 95 80 S 150 150, 180 80")!!,
            foreground          = LinearGradientPaint(Black, Blue, Origin, Point(width, 0.0)),
            foregroundThickness = 5.0,
            background          = Lightgray.paint,
            backgroundThickness = 5.0
        )
    }
}
```

- New [BasicCircularProgressBehavior](https://github.com/nacular/doodle/blob/master/Themes/src/commonMain/kotlin/io/nacular/doodle/theme/basic/BasicCircularProgressIndicatorBehavior.kt#L22) to replace the old with more flexibility/configurability
- Updated [BasicCircularSliderBehavior](https://github.com/nacular/doodle/blob/master/Themes/src/commonMain/kotlin/io/nacular/doodle/theme/basic/BasicCircularSliderBehavior.kt#L18) so it can have Fills instead of just Colors and exposed thickness
- [BasicProgressBarBehavior](https://github.com/nacular/doodle/blob/master/Themes/src/commonMain/kotlin/io/nacular/doodle/theme/basic/BasicProgressBarBehavior.kt#L16) now takes an optional background Fill, configurable outline thickness, foreground and background corner radii
- [Stroke](https://github.com/nacular/doodle/blob/master/Core/src/commonMain/kotlin/io/nacular/doodle/drawing/Stroke.kt#L6) can now be filled with any supported [Paint](https://github.com/nacular/doodle/blob/master/Core/src/commonMain/kotlin/io/nacular/doodle/drawing/Paint.kt), instead of just `Color`, and now support dash offset

```kotlin
canvas.rect(rectangle = bounds.atOrigin.inset(10.0),
            radius = 10.0,
            stroke = Stroke(fill = LinearGradientPaint(Red, Green, Origin, Point(width, height)), thickness = 20.0))
```

# APIs
- Deprecated CircularProgressBehavior (replaced by BasicCircularProgressBehavior)
- Stroke dashes changed to DoubleArray
- PathMetrics can now measure the bounds of a Path (in addition to size)
- Fill renamed to Paint and old usages deprecated

# Bug Fixes / Improvements
- [ProgressIndicator](https://github.com/nacular/doodle/blob/master/Controls/src/commonMain/kotlin/io/nacular/doodle/controls/ProgressIndicator.kt#L13) now delegates render/hit-detection to its behavior

# Docs
- Added examples of Circular and Path ProgressIndicator behaviors to [docs](https://nacular.github.io/doodle/#/controls)

See the full [release notes](https://github.com/nacular/doodle/releases/tag/v0.4.2) for more details.