Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const SliderField: React.FC<Props> = ({
max={max}
step={calculatedStep}
marks={opacityMarkers}
disabled={disabled}
onAfterChange={onChange}
onChange={handleSliderChange}
dotStyle={{ display: "none" }}
Expand Down Expand Up @@ -208,14 +209,20 @@ const StyledInput = styled.input<InputProps>`
}
`;

const StyledSlider = styled(RCSlider)`
const StyledSlider = styled(RCSlider)<{ disabled?: boolean }>`
.rc-slider-mark-text {
color: ${({ theme }) => theme.classic.properties.text};
}

.rc-slider-mark-text-active {
color: ${({ theme }) => theme.classic.text.pale};
}

&.rc-slider-disabled {
background-color: transparent;
opacity: ${({ disabled }) => (disabled ? 0.6 : 1)};
cursor: ${({ disabled }) => (disabled ? "not-allowed" : "inherit")};
}
`;

export default SliderField;
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export type SchemaField<T extends ValueType = ValueType> = {
suffix?: string;
name?: string;
description?: string;
disabled?: boolean;
isLinkable?: boolean;
isTemplate?: boolean;
ui?:
Expand Down Expand Up @@ -92,6 +93,7 @@ export type Props<T extends ValueType = ValueType> = {
linkedDatasetSchemaId?: string;
linkedDatasetId?: string;
hidden?: boolean;
disabled?: boolean;
isLinkable?: boolean;
isTemplate?: boolean;
isCapturing?: boolean;
Expand All @@ -116,6 +118,7 @@ const PropertyField: React.FC<Props> = ({
onUploadFile,
onRemoveFile,
hidden,
disabled,
isCapturing,
onIsCapturingChange,
camera,
Expand Down Expand Up @@ -147,6 +150,7 @@ const PropertyField: React.FC<Props> = ({
!!field?.link || (isTemplate && !!field?.value) || (!!field?.mergedValue && !field?.value),
linkedFieldName: field?.id,
overridden: !!field?.overridden,
disabled,
value: field?.mergedValue ?? field?.value ?? schema?.defaultValue,
onChange: useCallback(
(value: ValueTypes[keyof ValueTypes] | undefined) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ const PropertyItem: React.FC<Props> = ({
.filter((g): g is PropertyListItem => !!g),
[groups, layerMode, item],
);

const schemaFields = useMemo(
() =>
selectedItem
Expand All @@ -226,11 +227,13 @@ const PropertyItem: React.FC<Props> = ({
condf?.mergedValue ??
condsf?.defaultValue ??
(condsf?.type ? zeroValues[condsf.type] : undefined);

return {
schemaField: f,
field,
events,
hidden: f.only && (!condv || condv !== f.only.value),
disabled: !!f.disabled,
};
})
: [],
Expand Down Expand Up @@ -315,6 +318,7 @@ const PropertyItem: React.FC<Props> = ({
field={f.field}
schema={f.schemaField}
hidden={f.hidden}
disabled={f.disabled}
isTemplate={isTemplate}
{...f.events}
{...props}
Expand Down
25 changes: 24 additions & 1 deletion web/src/classic/components/molecules/Visualizer/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,34 @@ export default ({
//
// Terrain:
// - terrainType "cesium" → "reearth_terrain"
const overriddenSceneProperty = useMemo(
const fallbackAppliedSceneProperty = useMemo(
() => applyFallbacks(backwardCompatibleSceneProperty),
[backwardCompatibleSceneProperty],
);

// Step 3b: Override tile opacity for Google Map tiles (google_satellite, google_roadmap)
// Google Maps API does not support opacity — force tile_opacity to 1 to avoid rendering issues.
const overriddenSceneProperty = useMemo(() => {
const tiles = fallbackAppliedSceneProperty?.tiles;
if (!tiles) return fallbackAppliedSceneProperty;

const hasGoogleMapTiles = tiles.some(
tile =>
["google_satellite", "google_roadmap"].includes(tile.tile_type ?? "") &&
tile.tile_opacity !== 1,
);

if (!hasGoogleMapTiles) return fallbackAppliedSceneProperty;

return {
...fallbackAppliedSceneProperty,
tiles: tiles.map(tile => ({
...tile,
tile_opacity: 1,
})),
};
}, [fallbackAppliedSceneProperty]);
Comment thread
mkumbobeaty marked this conversation as resolved.

// Step 4: Apply layer fallbacks when Cesium Ion token is not available
// Data flow: rootLayer → (backward compatibility - not needed) → fallbacks → consumers
// Fallback rules (only when no Cesium Ion token):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,32 @@ const toUi = (ui: PropertySchemaFieldUi | null | undefined): SchemaField["ui"] =
return undefined;
};

const GOOGLE_MAP_TILE_TYPES = ["google_satellite", "google_roadmap"];

export const withGoogleMapTileOpacityDisabled = (
items: Item[] | undefined,
disabledDescription: string,
): Item[] | undefined => {
if (!items) return items;
return items.map(item => {
if (!("items" in item)) return item;
const tileTypeSchemaField = item.schemaFields.find(f => f.id === "tile_type");
const hasGoogleMapTile = item.items.some(listItem => {
const tileTypeField = listItem.fields.find(f => f.id === "tile_type");
const value =
tileTypeField?.value ?? tileTypeField?.mergedValue ?? tileTypeSchemaField?.defaultValue;
return typeof value === "string" && GOOGLE_MAP_TILE_TYPES.includes(value);
});
if (!hasGoogleMapTile) return item;
return {
...item,
schemaFields: item.schemaFields.map(f =>
f.id === "tile_opacity" ? { ...f, disabled: true, description: disabledDescription } : f,
),
};
});
};

export const convertLinkableDatasets = (
data?: GetLinkableDatasetsQuery,
): DatasetSchema[] | undefined => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ import {
useGetLinkableDatasetsQuery,
useGetLayersFromLayerIdQuery,
} from "@reearth/classic/gql";
import { useT } from "@reearth/services/i18n";
import { Selected } from "@reearth/services/state";

import { convert, Pane, convertLinkableDatasets, convertLayers } from "./convert";
import {
convert,
Pane,
convertLinkableDatasets,
convertLayers,
withGoogleMapTileOpacityDisabled,
} from "./convert";

export type Mode = "infobox" | "scene" | "layer" | "block" | "widgets" | "widget" | "cluster";

Expand Down Expand Up @@ -94,7 +101,17 @@ export default ({
const propertyId = property?.id;
const mergedProperty = layerMergedProperty ?? infoboxMergedProperty ?? blockMergedProperty;

const items = useMemo(() => convert(property, mergedProperty), [property, mergedProperty]);
const t = useT();
const items = useMemo(
() =>
withGoogleMapTileOpacityDisabled(
convert(property, mergedProperty),
t(
"Disabled: Opacity adjustments are not available when Google Maps tiles are present, to comply with Google Maps Map Tiles API Policies.",
),
),
[property, mergedProperty, t],
);

const loading = scenePropertyLoading || layerPropertyLoading || layerLoading;
const error = scenePropertyError ?? layerPropertyError ?? layerError;
Expand Down
1 change: 1 addition & 0 deletions web/src/services/i18n/translations/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ No selectable items: No selectable items
Font family: Font family
Font size: Font size
Field set: Field set
'Disabled: Opacity adjustments are not available when Google Maps tiles are present, to comply with Google Maps Map Tiles API Policies.': 'Disabled: Opacity adjustments are not available when Google Maps tiles are present, to comply with Google Maps Map Tiles API Policies.'
Basic: Basic
Template: Template
template: template
Expand Down
1 change: 1 addition & 0 deletions web/src/services/i18n/translations/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ No selectable items: 選択可能なアイテムがありません
Font family: フォント
Font size: サイズ
Field set: 設定
'Disabled: Opacity adjustments are not available when Google Maps tiles are present, to comply with Google Maps Map Tiles API Policies.': '無効:Google マップのタイルが存在する場合、Google マップ タイル API ポリシーに準拠するため、不透明度の調整はご利用いただけません。'
Basic: インフォボックス
Template: テンプレート
template: テンプレート
Expand Down
Loading