Skip to content

Commit

Permalink
fix(VectorTile): loading texture on VectorTile when node.pendingSubdi…
Browse files Browse the repository at this point in the history
…vision !need improvement!
  • Loading branch information
ftoromanoff committed Oct 25, 2023
1 parent 6329129 commit e464bdc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Layer/LayerUpdateStrategy.js
Expand Up @@ -11,8 +11,10 @@ export const STRATEGY_GROUP = 1;
export const STRATEGY_PROGRESSIVE = 2;
export const STRATEGY_DICHOTOMY = 3;

function _minimizeNetworkTraffic(node, nodeLevel, currentLevel) {
if (node.pendingSubdivision) {
function _minimizeNetworkTraffic(node, nodeLevel, currentLevel, source) {
// TO DO source.isVectorTileSource is a temp fix for pendingSubdivision.
// see issue https://github.com/iTowns/itowns/issues/2214
if (node.pendingSubdivision && !source.isVectorTileSource) {
return currentLevel;
}
return nodeLevel;
Expand Down Expand Up @@ -72,7 +74,7 @@ export function chooseNextLevelToFetch(strategy, node, nodeLevel = node.level, c
// default strategy
case STRATEGY_MIN_NETWORK_TRAFFIC:
default:
nextLevelToFetch = _minimizeNetworkTraffic(node, nodeLevel, currentLevel);
nextLevelToFetch = _minimizeNetworkTraffic(node, nodeLevel, currentLevel, layer.source);
}
nextLevelToFetch = Math.min(nextLevelToFetch, maxZoom);
}
Expand Down
1 change: 1 addition & 0 deletions src/Source/VectorTilesSource.js
Expand Up @@ -56,6 +56,7 @@ class VectorTilesSource extends TMSSource {
this.layers = {};
this.styles = {};
let promise;
this.isVectorTileSource = true;

this.accessToken = source.accessToken;

Expand Down

0 comments on commit e464bdc

Please sign in to comment.