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

Improve border line type experience #1106

Merged
merged 8 commits into from
May 24, 2024
Prev Previous commit
Next Next commit
LPK-220: Refactor code.
  • Loading branch information
ASmirnov-HORIS committed May 24, 2024
commit 788b5281c1cbbf1a74422f9b9350ba7f89ee94a0
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class BoxplotGeom : GeomBase() {
sizeAes = Aes.WIDTH,
ctx,
geomHelper,
linesRotation = { it },
fatten = fattenMidline
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class CrossBarGeom(
sizeAes = Aes.WIDTH, // do not flip as height is not defined for CrossBarGeom
ctx,
geomHelper,
linesRotation = flipHelper::flip,
fatten = fattenMidline
fatten = fattenMidline,
flip = !isVertical
)
// tooltip
flipHelper.buildHints(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ object BoxHelper {
sizeAes: Aes<Double>,
ctx: GeomContext,
geomHelper: GeomHelper,
linesRotation: (DoubleVector) -> DoubleVector,
fatten: Double
fatten: Double,
flip: Boolean = false
) {
val elementHelper = geomHelper.createSvgElementHelper()
for (p in aesthetics.dataPoints()) {
Expand All @@ -51,8 +51,8 @@ object BoxHelper {
val width = w * ctx.getResolution(xAes)

val (line) = elementHelper.createLine(
linesRotation(DoubleVector(x - width / 2, middle)),
linesRotation(DoubleVector(x + width / 2, middle)),
DoubleVector(x - width / 2, middle).flipIf(flip),
DoubleVector(x + width / 2, middle).flipIf(flip),
p
) { AesScaling.strokeWidth(it) * fatten } ?: continue

Expand Down