From 58c22541a34fd97b172d574217fa20bc4bcb0b04 Mon Sep 17 00:00:00 2001 From: Molly Lloyd Date: Fri, 4 Aug 2017 21:15:49 -0500 Subject: [PATCH] go w the flow :ocean: --- src/render/tile_mask.js | 12 ++++++++---- src/source/tile.js | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/render/tile_mask.js b/src/render/tile_mask.js index 6c9ce613aec..932cd5399a1 100644 --- a/src/render/tile_mask.js +++ b/src/render/tile_mask.js @@ -1,7 +1,11 @@ +// @flow const util = require('../util/util'); const TileCoord = require('../source/tile_coord'); +import type Tile from './../source/tile'; + + // Updates the TileMasks for all renderable tiles. A TileMask describes all regions // within that tile that are *not* covered by other renderable tiles. // Example: renderableTiles in our list are 2/1/3, 3/3/6, and 4/5/13. The schematic for creating the @@ -53,8 +57,8 @@ const TileCoord = require('../source/tile_coord'); // 2/1/3, since it is not a descendant of it. -module.exports = function(renderableTiles) { - const sortedRenderables = util.objectValues(renderableTiles).sort((a, b) => { return a.coord.isLessThan(b.coord) ? -1 : b.coord.isLessThan(a.coord) ? 1 : 0; }); +module.exports = function(renderableTiles: Array) { + const sortedRenderables = renderableTiles.sort((a, b) => { return a.coord.isLessThan(b.coord) ? -1 : b.coord.isLessThan(a.coord) ? 1 : 0; }); for (let i = 0; i < sortedRenderables.length; i++) { const mask = []; @@ -70,7 +74,7 @@ module.exports = function(renderableTiles) { } }; -function computeTileMasks(rootTile, ref, childArray, lowerBound, mask) { +function computeTileMasks(rootTile: TileCoord, ref: TileCoord, childArray: Array, lowerBound: TileCoord, mask: Array) { // If the reference or any of its children is found in the list, we need to recurse. for (let i = 0; i < childArray.length; i++) { const childTile = childArray[i]; @@ -79,7 +83,7 @@ function computeTileMasks(rootTile, ref, childArray, lowerBound, mask) { return; } else if (childTile.coord.isChildOf(ref)) { // There's at least one child tile that is masked out, so recursively descend - const children = ref.children(); + const children = ref.children(Infinity); for (let j = 0; j < children.length; j++) { const child = children[j]; computeTileMasks(rootTile, child, childArray.slice(i), lowerBound, mask); diff --git a/src/source/tile.js b/src/source/tile.js index 2680bd6b512..25663c8260c 100644 --- a/src/source/tile.js +++ b/src/source/tile.js @@ -64,10 +64,13 @@ class Tile { placementSource: any; workerID: number; vtLayers: {[string]: VectorTileLayer}; + mask: Array; aborted: ?boolean; boundsBuffer: any; boundsVAO: any; + maskedRasterBoundsBuffer: any; + maskedRasterBoundsVAO: any; request: any; texture: any; sourceCache: any;