From 12b8a3436404da01a6766e6dc917a9c978e0e8ed Mon Sep 17 00:00:00 2001 From: Dan Wood Date: Thu, 17 Apr 2025 14:05:35 +1000 Subject: [PATCH] Apply margin to Brush Fixes https://github.com/airbnb/visx/issues/1711 Applies margin to Brush so that it will shrink to fit inside the margins instead of ignoring them --- packages/visx-brush/src/Brush.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/visx-brush/src/Brush.tsx b/packages/visx-brush/src/Brush.tsx index 93aedb4bc2..7ca1004f64 100644 --- a/packages/visx-brush/src/Brush.tsx +++ b/packages/visx-brush/src/Brush.tsx @@ -207,8 +207,8 @@ class Brush extends Component { if (brushRegion === 'chart') { left = 0; top = 0; - brushRegionWidth = width; - brushRegionHeight = height; + brushRegionWidth = width - margin.left - margin.right; + brushRegionHeight = height - margin.top - margin.bottom; } else if (brushRegion === 'yAxis') { top = 0; brushRegionHeight = height;