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

View File

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

View File

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