commonMain.jetbrains.datalore.vis.svg.SvgGraphicsElement.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vis-svg-portable Show documentation
Show all versions of vis-svg-portable Show documentation
The Let-Plot Kotlin API depends on this artifact.
/*
* Copyright (c) 2019. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
package jetbrains.datalore.vis.svg
import jetbrains.datalore.base.geometry.DoubleRectangle
import jetbrains.datalore.base.observable.property.Property
abstract class SvgGraphicsElement : SvgStylableElement() {
companion object {
private val POINTER_EVENTS: SvgAttributeSpec =
SvgAttributeSpec.createSpec("pointer-events")
val OPACITY: SvgAttributeSpec =
SvgAttributeSpec.createSpec("opacity")
val VISIBILITY: SvgAttributeSpec =
SvgAttributeSpec.createSpec("visibility")
val CLIP_PATH: SvgAttributeSpec =
SvgAttributeSpec.createSpec("clip-path")
// Only for JFX. Workaround for implementation complexity of CLIP_PATH.
val CLIP_BOUNDS_JFX: SvgAttributeSpec =
SvgAttributeSpec.createSpec("clip-bounds-jfx")
}
fun pointerEvents(): Property {
return getAttribute(POINTER_EVENTS)
}
fun opacity(): Property {
return getAttribute(OPACITY)
}
fun visibility(): Property {
return getAttribute(VISIBILITY)
}
fun clipPath(): Property {
return getAttribute(CLIP_PATH)
}
enum class PointerEvents(private val myAttributeString: String) {
VISIBLE_PAINTED("visiblePainted"),
VISIBLE_FILL("visibleFill"),
VISIBLE_STROKE("visibleStroke"),
VISIBLE("visible"),
PAINTED("painted"),
FILL("fill"),
STROKE("stroke"),
ALL("all"),
NONE("none"),
INHERIT("inherit");
override fun toString(): String {
return myAttributeString
}
}
enum class Visibility(private val myAttrString: String) {
VISIBLE("visible"),
HIDDEN("hidden"),
COLLAPSE("collapse"),
INHERIT("inherit");
override fun toString(): String {
return myAttrString
}
}
}