Skip to content

Commit

Permalink
fix loading texture on VectorTile when node.pendingSubdivision
Browse files Browse the repository at this point in the history
  • Loading branch information
ftoromanoff committed Jul 21, 2023
1 parent f76b2fa commit 1c3f7cc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/Layer/LayerUpdateStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ 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
if (node.pendingSubdivision && !source.isVectorTileSource) {
return currentLevel;
}
return nodeLevel;
Expand Down Expand Up @@ -72,7 +73,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: 0 additions & 1 deletion src/Process/LayeredMaterialNodeProcessing.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export function updateLayeredMaterialNodeImagery(context, layer, node, parent) {
const failureParams = node.layerUpdateState[layer.id].failureParams;
const destinationLevel = extentsDestination[0].zoom || node.level;
const targetLevel = chooseNextLevelToFetch(layer.updateStrategy.type, node, destinationLevel, nodeLayer.level, layer, failureParams);

if ((!layer.source.isVectorSource && targetLevel <= nodeLayer.level) || targetLevel > destinationLevel) {
if (failureParams.lowestLevelError != Infinity) {
// this is the highest level found in case of error.
Expand Down
1 change: 1 addition & 0 deletions src/Source/VectorTilesSource.js
Original file line number Diff line number Diff line change
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 1c3f7cc

Please sign in to comment.