Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'linetype' for theme elements #1072

Merged
merged 14 commits into from
Apr 3, 2024
Merged
Prev Previous commit
Next Next commit
Cleanup code.
  • Loading branch information
OLarionova-HORIS committed Apr 2, 2024
commit a63c36c49b7e46d1a949ea0dca4c52d683dd5c17
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,8 @@ class PlotSvgComponent constructor(
backgroundBorder.apply {
fillColor().set(Color.TRANSPARENT)
strokeColor().set(plotTheme.backgroundColor())
val width = plotTheme.backgroundStrokeWidth()
strokeWidth().set(width)
StrokeDashArraySupport.apply(this, width, plotTheme.backgroundLineType())
strokeWidth().set(plotTheme.backgroundStrokeWidth())
StrokeDashArraySupport.apply(this, plotTheme.backgroundStrokeWidth(), plotTheme.backgroundLineType())
d().set(SvgPathDataBuilder().rect(backgroundRect).build())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,10 @@ internal class PlotTile(
private fun addFacetLabBackground(labelBounds: DoubleRectangle, facetTheme: FacetsTheme) {
if (facetTheme.showStripBackground()) {
val rect = SvgRectElement(labelBounds).apply {
val width = facetTheme.stripStrokeWidth()
strokeWidth().set(width)
strokeWidth().set(facetTheme.stripStrokeWidth())
fillColor().set(facetTheme.stripFill())
strokeColor().set(facetTheme.stripColor())
StrokeDashArraySupport.apply(this, width, facetTheme.stripLineType())
StrokeDashArraySupport.apply(this, facetTheme.stripStrokeWidth(), facetTheme.stripLineType())
}
add(rect)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,8 @@ internal class PolarFrameOfReference(
override fun doStrokeBkgr(parent: SvgComponent) {
val strokeBkgr = createPanelElement() {
it.strokeColor().set(theme.panel().rectColor())
val width = theme.panel().rectStrokeWidth()
it.strokeWidth().set(width)
StrokeDashArraySupport.apply(it, width, theme.panel().rectLineType())
it.strokeWidth().set(theme.panel().rectStrokeWidth())
StrokeDashArraySupport.apply(it, theme.panel().rectStrokeWidth(), theme.panel().rectLineType())
it.fillOpacity().set(0.0)
}

Expand All @@ -146,9 +145,8 @@ internal class PolarFrameOfReference(
override fun doDrawPanelBorder(parent: SvgComponent) {
val border = createPanelElement() {
it.strokeColor().set(theme.panel().borderColor())
val width = theme.panel().borderWidth()
it.strokeWidth().set(width)
StrokeDashArraySupport.apply(it, width, theme.panel().borderLineType())
it.strokeWidth().set(theme.panel().borderWidth())
StrokeDashArraySupport.apply(it, theme.panel().borderWidth(), theme.panel().borderLineType())
it.fillOpacity().set(0.0)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,8 @@ internal open class SquareFrameOfReference(
protected open fun doDrawPanelBorder(parent: SvgComponent) {
val panelBorder = SvgRectElement(layoutInfo.geomContentBounds).apply {
strokeColor().set(theme.panel().borderColor())
val width = theme.panel().borderWidth()
strokeWidth().set(width)
StrokeDashArraySupport.apply(this, width, theme.panel().borderLineType())
strokeWidth().set(theme.panel().borderWidth())
StrokeDashArraySupport.apply(this, theme.panel().borderWidth(), theme.panel().borderLineType())
fillOpacity().set(0.0)
}
parent.add(panelBorder)
Expand Down Expand Up @@ -198,9 +197,8 @@ internal open class SquareFrameOfReference(
protected open fun doStrokeBkgr(parent: SvgComponent) {
val panelRectStroke = SvgRectElement(layoutInfo.geomContentBounds).apply {
strokeColor().set(theme.panel().rectColor())
val width = theme.panel().rectStrokeWidth()
strokeWidth().set(width)
StrokeDashArraySupport.apply(this, width, theme.panel().rectLineType())
strokeWidth().set(theme.panel().rectStrokeWidth())
StrokeDashArraySupport.apply(this, theme.panel().rectStrokeWidth(), theme.panel().rectLineType())
fillOpacity().set(0.0)
}
parent.add(panelRectStroke)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ class AxisComponent(
// Axis line
if (!hideAxisBreaks && axisTheme.showLine()) {
val axisLine = SvgLineElement(x1, y1, x2, y2).apply {
val width = axisTheme.lineWidth()
strokeWidth().set(width)
strokeWidth().set(axisTheme.lineWidth())
strokeColor().set(axisTheme.lineColor())
StrokeDashArraySupport.apply(this, width, axisTheme.lineType())
StrokeDashArraySupport.apply(this, axisTheme.lineWidth(), axisTheme.lineType())
}
rootElement.children().add(axisLine)
}
Expand All @@ -88,10 +87,9 @@ class AxisComponent(
var tickMark: SvgLineElement? = null
if (axisTheme.showTickMarks()) {
tickMark = SvgLineElement()
val width = axisTheme.tickMarkWidth()
tickMark.strokeWidth().set(width)
tickMark.strokeWidth().set(axisTheme.tickMarkWidth())
tickMark.strokeColor().set(axisTheme.tickMarkColor())
StrokeDashArraySupport.apply(tickMark, width, axisTheme.tickMarkLineType())
StrokeDashArraySupport.apply(tickMark, axisTheme.tickMarkWidth(), axisTheme.tickMarkLineType())
}

var tickLabel: TextLabel? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ abstract class LegendBox : SvgComponent() {
if (theme.showBackground()) {
add(SvgRectElement(spec.innerBounds).apply {
strokeColor().set(theme.backgroundColor())
val width = theme.backgroundStrokeWidth()
strokeWidth().set(width)
StrokeDashArraySupport.apply(this, width, theme.backgroundLineType())
strokeWidth().set(theme.backgroundStrokeWidth())
StrokeDashArraySupport.apply(this, theme.backgroundStrokeWidth(), theme.backgroundLineType())
fillColor().set(theme.backgroundFill())
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,19 @@ class PolarAxisComponent(
.lineString(breaksData.axisLine)
.build()
)
val width = axisTheme.lineWidth()
strokeWidth().set(width)
strokeWidth().set(axisTheme.lineWidth())
strokeColor().set(axisTheme.lineColor())
StrokeDashArraySupport.apply(this, width, axisTheme.lineType())
StrokeDashArraySupport.apply(this, axisTheme.lineWidth(), axisTheme.lineType())
fillColor().set(Color.TRANSPARENT)
}
rootElement.children().add(axisLine)
} else {
val axisLine = SvgLineElement().apply {
y1().set(breaksData.center.y)
y2().set(breaksData.center.y - length / 2.0)
val width = axisTheme.lineWidth()
strokeWidth().set(width)
strokeWidth().set(axisTheme.lineWidth())
strokeColor().set(axisTheme.lineColor())
StrokeDashArraySupport.apply(this, width, axisTheme.lineType())
StrokeDashArraySupport.apply(this, axisTheme.lineWidth(), axisTheme.lineType())
}
rootElement.children().add(axisLine)
}
Expand All @@ -96,10 +94,9 @@ class PolarAxisComponent(

val tickMark: SvgLineElement? = if (axisTheme.showTickMarks()) {
val tickMark = SvgLineElement()
val width = axisTheme.tickMarkWidth()
tickMark.strokeWidth().set(width)
tickMark.strokeWidth().set(axisTheme.tickMarkWidth())
tickMark.strokeColor().set(axisTheme.tickMarkColor())
StrokeDashArraySupport.apply(tickMark, width, axisTheme.tickMarkLineType())
StrokeDashArraySupport.apply(tickMark, axisTheme.tickMarkWidth(), axisTheme.tickMarkLineType())
val markLength = axisTheme.tickMarkLength()

when (orientation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ class CompositeFigureSvgComponent constructor(
add(SvgRectElement(r).apply {
fillColor().set(plotTheme.backgroundFill())
strokeColor().set(plotTheme.backgroundColor())
val width = plotTheme.backgroundStrokeWidth()
strokeWidth().set(width)
StrokeDashArraySupport.apply(this, width, plotTheme.backgroundLineType())
strokeWidth().set(plotTheme.backgroundStrokeWidth())
StrokeDashArraySupport.apply(this, plotTheme.backgroundStrokeWidth(), plotTheme.backgroundLineType())
})
}
}
Expand Down