From bf5e7f8929b3572bac1b6a6ebd1210f2634a3610 Mon Sep 17 00:00:00 2001 From: Beatrice Mkumbo Date: Tue, 22 Oct 2024 01:17:52 -0700 Subject: [PATCH] chore(web): support default built-in layer style (#1183) --- .../PresetLayerStyle/presetLayerStyles.ts | 3 ++- .../beta/features/Editor/Visualizer/convert.ts | 8 +++----- .../features/Published/convert-new-property.ts | 4 ++-- web/src/beta/utils/value.ts | 18 ------------------ 4 files changed, 7 insertions(+), 26 deletions(-) diff --git a/web/src/beta/features/Editor/Map/LayerStylePanel/PresetLayerStyle/presetLayerStyles.ts b/web/src/beta/features/Editor/Map/LayerStylePanel/PresetLayerStyle/presetLayerStyles.ts index e9a0ea00bf..87d1b72556 100644 --- a/web/src/beta/features/Editor/Map/LayerStylePanel/PresetLayerStyle/presetLayerStyles.ts +++ b/web/src/beta/features/Editor/Map/LayerStylePanel/PresetLayerStyle/presetLayerStyles.ts @@ -1,6 +1,7 @@ +import { LayerAppearanceTypes } from "@reearth/core"; import { LayerStyle } from "@reearth/services/api/layerStyleApi/utils"; -export const defaultStyle = { +export const defaultStyle: Partial = { marker: { heightReference: "clamp" }, diff --git a/web/src/beta/features/Editor/Visualizer/convert.ts b/web/src/beta/features/Editor/Visualizer/convert.ts index cf3c861c82..f3fcab5274 100644 --- a/web/src/beta/features/Editor/Visualizer/convert.ts +++ b/web/src/beta/features/Editor/Visualizer/convert.ts @@ -1,3 +1,4 @@ +import { defaultStyle } from "@reearth/beta/features/Editor/Map/LayerStylePanel/PresetLayerStyle/presetLayerStyles"; import { type WidgetZone, type WidgetSection, @@ -12,10 +13,7 @@ import { isBuiltinWidget } from "@reearth/beta/features/Visualizer/Crust/Widgets"; import { WidgetAreaPadding } from "@reearth/beta/features/Visualizer/Crust/Widgets/WidgetAlignSystem/types"; -import { - DEFAULT_LAYER_STYLE, - valueTypeFromGQL -} from "@reearth/beta/utils/value"; +import { valueTypeFromGQL } from "@reearth/beta/utils/value"; import { LayerAppearanceTypes } from "@reearth/core"; import type { Layer } from "@reearth/core"; import { NLSLayer } from "@reearth/services/api/layersApi/utils"; @@ -402,7 +400,7 @@ export function processLayers( } } - return DEFAULT_LAYER_STYLE; + return defaultStyle; }; return newLayers?.map((nlsLayer) => { diff --git a/web/src/beta/features/Published/convert-new-property.ts b/web/src/beta/features/Published/convert-new-property.ts index 367981eafb..d39f5383df 100644 --- a/web/src/beta/features/Published/convert-new-property.ts +++ b/web/src/beta/features/Published/convert-new-property.ts @@ -1,5 +1,5 @@ +import { defaultStyle } from "@reearth/beta/features/Editor/Map/LayerStylePanel/PresetLayerStyle/presetLayerStyles"; import { InfoboxBlock } from "@reearth/beta/features/Visualizer/Crust/Infobox/types"; -import { DEFAULT_LAYER_STYLE } from "@reearth/beta/utils/value"; import { Layer, LayerAppearanceTypes } from "@reearth/core"; import { NLSInfobox, @@ -70,7 +70,7 @@ export function processLayers( } } - return DEFAULT_LAYER_STYLE; + return defaultStyle; }; return newLayers?.map((nlsLayer) => { diff --git a/web/src/beta/utils/value.ts b/web/src/beta/utils/value.ts index 34761ac868..f9dae207c0 100644 --- a/web/src/beta/utils/value.ts +++ b/web/src/beta/utils/value.ts @@ -1,4 +1,3 @@ -import { LayerAppearanceTypes } from "@reearth/core"; import { ValueType as GQLValueType } from "@reearth/services/gql"; import { css } from "@reearth/services/theme"; import { Color } from "cesium"; @@ -253,20 +252,3 @@ export const zeroValues: { [key in ValueType]?: ValueTypes[ValueType] } = { string: "" }; -export const DEFAULT_LAYER_STYLE: Partial = { - "3dtiles": { - show: true - }, - resource: { - clampToGround: true - }, - marker: { - heightReference: "clamp" - }, - polygon: { - heightReference: "clamp" - }, - polyline: { - clampToGround: true - } -};