Do not click on road when toggling sidebar (fixes #274)

This commit is contained in:
Paul Bienkowski 2022-09-12 17:21:28 +02:00 committed by gluap
parent 5774a52773
commit 2f3a66f2ee
No known key found for this signature in database

View file

@ -7,10 +7,16 @@ import produce from "immer";
import classNames from "classnames"; import classNames from "classnames";
import type { Location } from "types"; import type { Location } from "types";
import {Page, Map} from 'components' import { Page, Map } from "components";
import {useConfig} from 'config' import { useConfig } from "config";
import {colorByDistance, colorByCount, borderByZone, reds, isValidAttribute} from 'mapstyles' import {
import {useMapConfig} from 'reducers/mapConfig' colorByDistance,
colorByCount,
borderByZone,
reds,
isValidAttribute,
} from "mapstyles";
import { useMapConfig } from "reducers/mapConfig";
import RoadInfo from "./RoadInfo"; import RoadInfo from "./RoadInfo";
import RegionInfo from "./RegionInfo"; import RegionInfo from "./RegionInfo";
@ -47,9 +53,8 @@ const untaggedRoadsLayer = {
const getUntaggedRoadsLayer = (colorAttribute, maxCount) => const getUntaggedRoadsLayer = (colorAttribute, maxCount) =>
produce(untaggedRoadsLayer, (draft) => { produce(untaggedRoadsLayer, (draft) => {
draft.filter = ['!', isValidAttribute(colorAttribute)] draft.filter = ["!", isValidAttribute(colorAttribute)];
}) });
const getRoadsLayer = (colorAttribute, maxCount) => const getRoadsLayer = (colorAttribute, maxCount) =>
produce(untaggedRoadsLayer, (draft) => { produce(untaggedRoadsLayer, (draft) => {
@ -61,7 +66,7 @@ const getRoadsLayer = (colorAttribute, maxCount) =>
? colorByDistance(colorAttribute) ? colorByDistance(colorAttribute)
: colorAttribute.endsWith("_count") : colorAttribute.endsWith("_count")
? colorByCount(colorAttribute, maxCount) ? colorByCount(colorAttribute, maxCount)
: colorAttribute.endsWith('zone') : colorAttribute.endsWith("zone")
? borderByZone() ? borderByZone()
: "#DDD"; : "#DDD";
draft.paint["line-opacity"][3] = 12; draft.paint["line-opacity"][3] = 12;