Still working on the cluster proxy

This commit is contained in:
Eric van der Vlist 2023-01-19 21:39:52 +01:00
parent 6f359b2e80
commit c70e7baa4b
3 changed files with 25 additions and 21 deletions

View File

@ -309,7 +309,7 @@ const styles = {
}; };
}, },
getStyle: memoize((params: any) => { getStyle: memoize((params: any) => {
console.log({ caller: 'getStyle', params }); // console.log({ caller: 'getStyle', params });
const { isSelected, name, network } = params; const { isSelected, name, network } = params;
return new Style({ return new Style({
stroke: styles.way.strokes[network], stroke: styles.way.strokes[network],
@ -335,11 +335,12 @@ const styles = {
klass, klass,
isHighlighted, isHighlighted,
isTextHidden: zoom() < 19, isTextHidden: zoom() < 19,
isHidden: !isHighlighted && zoom() < 16, // isHidden: !isHighlighted && zoom() < 16,
isHidden: true,
}; };
}, },
getStyle: memoize((params: any) => { getStyle: memoize((params: any) => {
console.log({ caller: 'getStyle', params }); // console.log({ caller: 'getStyle', params });
const { isSelected, name, klass, isHidden, isTextHidden, isHighlighted } = const { isSelected, name, klass, isHidden, isTextHidden, isHighlighted } =
params; params;
if (isHidden) { if (isHidden) {
@ -385,9 +386,12 @@ export const style = (feature: Feature, resolution: number) => {
return createDefaultStyle(feature, resolution)[0]; return createDefaultStyle(feature, resolution)[0];
} }
const params = styles[type].getParameters(feature); const params = styles[type].getParameters(feature);
if (params?.isHidden) {
return null;
}
const getStyle = styles[type].getStyle; const getStyle = styles[type].getStyle;
const style = getStyle(params); const style = getStyle(params);
console.log({ caller: 'style', feature, type, params, style }); // console.log({ caller: 'style', feature, type, params, style });
if (style === undefined) { if (style === undefined) {
return createDefaultStyle(feature, resolution)[0]; return createDefaultStyle(feature, resolution)[0];
} }

View File

@ -374,7 +374,7 @@ const Map: Component = () => {
const vectorTileLayer = new VectorTileLayer({ const vectorTileLayer = new VectorTileLayer({
source: vectorTileSource, source: vectorTileSource,
style: [], style,
declutter: false, declutter: false,
}); });

View File

@ -67,15 +67,15 @@ const overloads = {
} }
props.featuresSent = false; props.featuresSent = false;
setProps(target, props); setProps(target, props);
console.log({ // console.log({
caller: 'clusterableVectorTileSourceProxy', // caller: 'clusterableVectorTileSourceProxy',
overload: 'loadFeatures', // overload: 'loadFeatures',
extent, // extent,
resolution, // resolution,
projection, // projection,
target: target, // target: target,
props, // props,
}); // });
}; };
}, },
@ -90,13 +90,13 @@ const overloads = {
//console.trace(); //console.trace();
props.featuresSent = true; props.featuresSent = true;
setProps(target, props); setProps(target, props);
console.log({ // console.log({
caller: 'clusterableVectorTileSourceProxy', // caller: 'clusterableVectorTileSourceProxy',
overload: 'getFeatures', // overload: 'getFeatures',
result, // result,
props, // props,
target, // target,
}); // });
return result; return result;
}; };
}, },