From e9469ed55751cca6fe6b2918701e919f8bca08e0 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Sun, 11 Nov 2018 06:23:37 +0000 Subject: [PATCH] Fix zipcode autozoom (cherry picked from commit 03860f8680e9340f4965bc0ec2909419a29b8e30) (cherry picked from commit a2b285260a854ea106273f299eccdf079abc1a9a) (cherry picked from commit 27e27094c202205778eb59575a85bc311f3c73b1) --- .../src/visualizations/deckgl/layers/Polygon/Polygon.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/superset/assets/src/visualizations/deckgl/layers/Polygon/Polygon.jsx b/superset/assets/src/visualizations/deckgl/layers/Polygon/Polygon.jsx index cffae2f1482bc..f15f4d16a3614 100644 --- a/superset/assets/src/visualizations/deckgl/layers/Polygon/Polygon.jsx +++ b/superset/assets/src/visualizations/deckgl/layers/Polygon/Polygon.jsx @@ -33,7 +33,10 @@ import sandboxedEval from '../../../../modules/sandbox'; const DOUBLE_CLICK_TRESHOLD = 250; // milliseconds -function getPoints(features) { +function getPoints(features, lineType) { + if (lineType === 'zipcode' || lineType === 'fsa') { + return features.map(d => d.polygon).flat().flat(); + } return features.map(d => d.polygon).flat(); } @@ -151,7 +154,7 @@ class DeckGLPolygon extends React.Component { } = getPlaySliderParams(timestamps, granularity); const viewport = props.formData.autozoom - ? fitViewport(props.viewport, getPoints(features)) + ? fitViewport(props.viewport, getPoints(features, props.payload.form_data.line_type)) : props.viewport; return {