All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.data2viz.viz.DslExtensions.kt Maven / Gradle / Ivy

There is a newer version: 0.8.0-RC5
Show newest version
package io.data2viz.viz


/**
 * Handle both horizontal and vertical alignments.
 */
data class TextAlign internal constructor(val horizontal: TextHAlign, val vertical: TextVAlign)


/**
 * Extension property to get and set all text alignments properties in one expression.
 */
var TextNode.textAlign:TextAlign
    get() = textAlign(hAlign, vAlign)
    set(value) {
        hAlign = value.horizontal
        vAlign = value.vertical
    }


/**
 * Extension function to facilitate the alignment setting in a TextNode
 */
fun TextNode.textAlign(horizontal: TextHAlign = TextHAlign.LEFT, vertical: TextVAlign = TextVAlign.BASELINE) =
    TextAlign(horizontal, vertical)





© 2015 - 2025 Weber Informatics LLC | Privacy Policy