From 27a616d43f56deb2748c66237636a6acd6c52287 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 23 Sep 2020 12:28:10 +0200 Subject: [PATCH] Improves plotly mesh3d visualization by removing unnecessary margin. --- .../plotly-visualizer/PlotlyViewer.tsx | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/visualization-bundle/src/visualizers/plotly-visualizer/PlotlyViewer.tsx b/visualization-bundle/src/visualizers/plotly-visualizer/PlotlyViewer.tsx index 0aad785..cb216bd 100644 --- a/visualization-bundle/src/visualizers/plotly-visualizer/PlotlyViewer.tsx +++ b/visualization-bundle/src/visualizers/plotly-visualizer/PlotlyViewer.tsx @@ -10,15 +10,34 @@ export class PlotlyViewer extends React.Component<{ }> { render() { const { theme, data, layout } = this.props; + const computedLayout = Object.assign( + {}, + theme === "dark" ? darkLayout : {}, + layout || {} + ); + + if ( + data.length === 1 && + data[0].type === "mesh3d" && + (layout || {}).margin === undefined + ) { + // Fixes https://github.com/JetBrains/rider-debug-visualizer-web-view/issues/6 + Object.assign(computedLayout, { + margin: { + l: 0, + r: 0, + b: 0, + t: 0, + pad: 0, + }, + }); + } + return ( );