commonMain.TransformElement.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of element Show documentation
Show all versions of element Show documentation
A collection of drawing/charting utilities
package com.juul.krayon.element
import com.juul.krayon.kanvas.Kanvas
import com.juul.krayon.kanvas.Transform
import com.juul.krayon.kanvas.withTransform
public class TransformElement : Element() {
override val tag: String get() = "transform"
public var transform: Transform by attributes.withDefault { Transform.Translate() }
override fun draw(kanvas: Kanvas) {
kanvas.withTransform(transform) {
children.forEach { it.draw(kanvas) }
}
}
public companion object : ElementBuilder, ElementSelector {
override fun build(): TransformElement = TransformElement()
override fun trySelect(element: Element): TransformElement? = element as? TransformElement
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy