Skip to content

Commit aa5b830

Browse files
committed
wo #14: 🐛 add default clustering option to the FeatureCollectionDisplay in the DefaultSettingsPanel
1 parent f8c63fe commit aa5b830

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

src/lib/FeatureCollection.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,18 @@ export const getDefaultFeatureStyler = (size = 24, colorizer = () => "#2664D8")
3434
};
3535
};
3636
};
37-
37+
export const defaultClusteringOptions = {
38+
spiderfyOnMaxZoom: false,
39+
showCoverageOnHover: false,
40+
zoomToBoundsOnClick: false,
41+
maxClusterRadius: 40,
42+
disableClusteringAtZoom: 19,
43+
animate: false,
44+
cismapZoomTillSpiderfy: 12,
45+
selectionSpiderfyMinZoom: 12,
46+
colorizer: (props) => props.color,
47+
clusterIconSize: 30,
48+
};
3849
// Since this component is simple and static, there's no parent container for it.
3950
const FeatureCollection = (props) => {
4051
const {
@@ -91,16 +102,7 @@ const FeatureCollection = (props) => {
91102
}
92103

93104
const _clusterOptions = {
94-
spiderfyOnMaxZoom: false,
95-
showCoverageOnHover: false,
96-
zoomToBoundsOnClick: false,
97-
maxClusterRadius: 40,
98-
disableClusteringAtZoom: 19,
99-
animate: false,
100-
cismapZoomTillSpiderfy: 12,
101-
selectionSpiderfyMinZoom: 12,
102-
colorizer: (props) => props.color,
103-
clusterIconSize: 30,
105+
...defaultClusteringOptions,
104106
...clusteringOptionsFromContext,
105107
...clusteringOptions,
106108
};

src/lib/topicmaps/menu/DefaultSettingsPanel.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
TopicMapStylingDispatchContext,
2424
} from "../../contexts/TopicMapStylingContextProvider";
2525
import { getSymbolSVGGetter } from "../../tools/uiHelper";
26-
import { getDefaultFeatureStyler } from "../../FeatureCollection";
26+
import { defaultClusteringOptions, getDefaultFeatureStyler } from "../../FeatureCollection";
2727

2828
const SettingsPanel = (props) => {
2929
const { setAppMenuActiveMenuSection, setAppMenuVisible } = useContext(UIDispatchContext);
@@ -184,7 +184,10 @@ const SettingsPanel = (props) => {
184184
key={"FeatureCollectionDisplayPreview." + _markerSymbolSize + clusteringEnabled}
185185
featureCollection={previewFeatures}
186186
clusteringEnabled={previewMapClusteringEnabled || clusteringEnabled}
187-
clusterOptions={previewMapClusteringOptions || clusteringOptions}
187+
clusterOptions={{
188+
...defaultClusteringOptions,
189+
...(previewMapClusteringOptions || clusteringOptions),
190+
}}
188191
style={style}
189192
featureStylerScalableImageSize={currentMarkerSize}
190193
//mapRef={previewMapRef} // commented out because there cannot be a ref in a functional comp and it is bnot needed

0 commit comments

Comments
 (0)