@@ -92,14 +92,15 @@ const makeFeatureId = (
9292 }
9393 const featureId = getBuiltinFeatureId ( tileFeature ) ;
9494 return generateIDWithMD5 (
95- `${ coordinates . x } -${ coordinates . y } -${ coordinates . z } -${ featureId } -${ ! ( tileFeature instanceof Model )
96- ? JSON . stringify (
97- // Read only root properties.
98- Object . entries ( convertCesium3DTileFeatureProperties ( tileFeature ) )
99- . filter ( ( _k , v ) => typeof v === "string" || typeof v === "number" )
100- . map ( ( [ k , v ] ) => `${ k } ${ v } ` ) ,
101- )
102- : ""
95+ `${ coordinates . x } -${ coordinates . y } -${ coordinates . z } -${ featureId } -${
96+ ! ( tileFeature instanceof Model )
97+ ? JSON . stringify (
98+ // Read only root properties.
99+ Object . entries ( convertCesium3DTileFeatureProperties ( tileFeature ) )
100+ . filter ( ( _k , v ) => typeof v === "string" || typeof v === "number" )
101+ . map ( ( [ k , v ] ) => `${ k } ${ v } ` ) ,
102+ )
103+ : ""
103104 } `,
104105 ) ;
105106} ;
@@ -222,20 +223,25 @@ const useFeature = ({
222223 const style = computedFeature ?. [ "3dtiles" ] ;
223224
224225 COMMON_STYLE_PROPERTIES . forEach ( ( { name, convert } ) => {
226+ const val = convertStyle ( style ?. [ name ] , convert ) ;
227+
225228 if ( name === "color" ) {
226- if ( isFeatureSelected ) {
227- raw . color =
228- typeof layer [ "3dtiles" ] ?. selectedFeatureColor === "string"
229- ? toColor ( layer [ "3dtiles" ] ?. selectedFeatureColor ) ?? raw . color
230- : raw . color ;
231- return ;
229+ // Reset color to default so that new style could update all.
230+ raw . color = DEFAULT_FEATURE_COLOR ;
231+
232+ // Apply color from style.
233+ if ( val !== undefined ) {
234+ raw . color = val ;
232235 }
233236
234- raw . color = DEFAULT_FEATURE_COLOR ;
235- }
236- const val = convertStyle ( style ?. [ name ] , convert ) ;
237- if ( val !== undefined ) {
238- raw [ name ] = val ;
237+ // Apply color for selected feature.
238+ if ( isFeatureSelected && typeof layer [ "3dtiles" ] ?. selectedFeatureColor === "string" ) {
239+ raw . color = toColor ( layer [ "3dtiles" ] ?. selectedFeatureColor ) ?? val ;
240+ }
241+ } else {
242+ if ( val !== undefined ) {
243+ raw [ name ] = val ;
244+ }
239245 }
240246 } ) ;
241247
@@ -752,8 +758,8 @@ export const useHooks = ({
752758 const tilesetUrl = useMemo ( ( ) => {
753759 return type === "osm-buildings" && isVisible
754760 ? IonResource . fromAssetId ( 96188 , {
755- accessToken : meta ?. cesiumIonAccessToken as string | undefined ,
756- } ) // https://github.com/CesiumGS/cesium/blob/main/packages/engine/Source/Scene/createOsmBuildings.js#L53
761+ accessToken : meta ?. cesiumIonAccessToken as string | undefined ,
762+ } ) // https://github.com/CesiumGS/cesium/blob/main/packages/engine/Source/Scene/createOsmBuildings.js#L53
757763 : googleMapPhotorealisticResource && isVisible
758764 ? googleMapPhotorealisticResource
759765 : type === "3dtiles" && isVisible
@@ -778,7 +784,7 @@ export const useHooks = ({
778784 property ?. imageBasedLightIntensity ?? viewerProperty ?. scene ?. imageBasedLighting ?. intensity ;
779785 const sphericalHarmonicCoefficients = arrayToCartecian3 (
780786 property ?. sphericalHarmonicCoefficients ??
781- viewerProperty ?. scene ?. imageBasedLighting ?. sphericalHarmonicCoefficients ,
787+ viewerProperty ?. scene ?. imageBasedLighting ?. sphericalHarmonicCoefficients ,
782788 imageBasedLightIntensity ,
783789 ) ;
784790
0 commit comments