Skip to content

Commit

Permalink
Disable opacity for points
Browse files Browse the repository at this point in the history
  • Loading branch information
forman committed Jul 19, 2024
1 parent 7699fcc commit aec6ecd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
21 changes: 11 additions & 10 deletions src/components/PlaceSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ export default function PlaceSelect({
selectedPlaceId = selectedPlaceId || "";
selectedPlaceGroupIds = selectedPlaceGroupIds || [];

console.log("selectedPlaceInfo:", selectedPlaceInfo);

const selectedPlaceGroupId =
selectedPlaceGroupIds!.length === 1 ? selectedPlaceGroupIds![0] : null;

Expand Down Expand Up @@ -146,7 +144,15 @@ export default function PlaceSelect({
selectedPlaceGroupId.startsWith(USER_ID_PREFIX) &&
selectedPlaceId !== "";

let actions;
let actions = [
<ToolButton
key="locatePlace"
onClick={locateSelectedPlace}
tooltipText={i18n.get("Locate place in map")}
icon={<TravelExploreIcon />}
/>,
];

if (!editMode && isEditableUserPlace) {
const handleEditButtonClick = () => {
setEditMode(true);
Expand Down Expand Up @@ -179,13 +185,7 @@ export default function PlaceSelect({
tooltipText={i18n.get("Remove place")}
icon={<RemoveCircleOutlineIcon />}
/>,
<ToolButton
key="locatePlace"
onClick={locateSelectedPlace}
tooltipText={i18n.get("Locate place in map")}
icon={<TravelExploreIcon />}
/>,
];
].concat(actions);
}

return (
Expand All @@ -204,6 +204,7 @@ export default function PlaceSelect({
<PlaceStyleEditor
anchorEl={styleAnchorEl}
setAnchorEl={setStyleAnchorEl}
isPoint={selectedPlaceInfo.place.geometry.type === "Point"}
placeStyle={selectedPlaceInfo}
updatePlaceStyle={updatePlaceStyle}
/>
Expand Down
12 changes: 9 additions & 3 deletions src/components/PlaceStyleEditor/PlaceStyleEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,21 @@ const styles = makeStyles({
colorMenuItemBox: { width: "104px", height: "18px" },
});

interface FeatureStyleEditorProps extends WithLocale {
interface PlaceStyleEditorProps extends WithLocale {
anchorEl: HTMLElement | null;
setAnchorEl: (anchorEl: HTMLElement | null) => void;
isPoint: boolean;
placeStyle: PlaceStyle;
updatePlaceStyle: (placeStyle: PlaceStyle) => void;
}

const PlaceStyleEditor = ({
anchorEl,
setAnchorEl,
isPoint,
placeStyle,
updatePlaceStyle,
}: FeatureStyleEditorProps) => {
}: PlaceStyleEditorProps) => {
const [menuAnchorEl, setMenuAnchorEl] = useState<HTMLElement | null>(null);

function handleColorClick(event: MouseEvent<HTMLDivElement>) {
Expand All @@ -102,7 +104,10 @@ const PlaceStyleEditor = ({
>
<Box sx={styles.container}>
<Typography sx={styles.colorLabel}>{i18n.get("Color")}</Typography>
<Typography sx={styles.opacityLabel}>
<Typography
sx={styles.opacityLabel}
color={isPoint ? "text.secondary" : "text.primary"}
>
{i18n.get("Opacity")}
</Typography>
<Box
Expand All @@ -112,6 +117,7 @@ const PlaceStyleEditor = ({
/>
<Slider
sx={styles.opacityValue}
disabled={isPoint}
size="small"
min={0}
max={1}
Expand Down

0 comments on commit aec6ecd

Please sign in to comment.