From 90ca64b8e6f6568c4f920025721a0d5043956d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=9D=80=EC=8B=9D?= Date: Sun, 13 Dec 2020 22:37:12 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20setFeatureStyle=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EC=97=90=EC=84=9C=20isChanged=EA=B2=80=EC=82=AC=EA=B0=80=20?= =?UTF-8?q?=EB=B9=A0=EC=A0=B8=EC=9E=88=EC=96=B4=EC=84=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - setFeatureStyle파일에서 isChanged검사가 빠져있어서 변화 없음에도 실행되는 경우 발생 - isChanged를 추가하고 init일 때를 대비해서 검사 조건을 추가함 --- src/utils/setFeatureStyle.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils/setFeatureStyle.ts b/src/utils/setFeatureStyle.ts index 301e459..9386eea 100644 --- a/src/utils/setFeatureStyle.ts +++ b/src/utils/setFeatureStyle.ts @@ -28,6 +28,10 @@ function setFeatureStyle({ if (featureState[x].isChanged || !featureState[y].isChanged) return 1; return -1; }); + const isInit = + subFeatures.findIndex( + (subFeature) => featureState[subFeature].isChanged + ) === -1; for (const subFeature of sortedFeatures) { const elements = Object.keys(featureState[subFeature]) as ElementNameType[]; @@ -42,6 +46,7 @@ function setFeatureStyle({ subFeature, element, style: elementStyle as StyleType, + isInit, }); break; case ElementNameType.labelText: @@ -58,6 +63,7 @@ function setFeatureStyle({ style: (elementStyle as SubElementType)[ subElement ] as StyleType, + isInit, }); }); break; @@ -71,6 +77,7 @@ function setFeatureStyle({ interface setElementStyleProps extends ActionPayload { map: mapboxgl.Map; + isInit: boolean; } function setElementStyle({ @@ -80,7 +87,9 @@ function setElementStyle({ element, subElement, style, + isInit, }: setElementStyleProps): void { + if (!style.isChanged && !isInit) return; const keys = Object.keys(style) as StyleKeyType[]; keys.forEach((key) => { mapStyling[feature]({