collinhover/impactplusplus

Map layer merging fix for distances does not optimally merge layers

Closed this issue · 1 comments

6c80228 fixed the issue with wrongly merged layers but now it does not optimally merge all possible layers.

In layer.js the fix was as such:

if ( item.preRender && !item.repeat && ( typeof lastDistance === 'undefined' || item.distance === lastDistance ) ) {

This however means if you have these layers:

sky(background, distance=2), bg(background, distance=1), main(background, distance=1), fg(foreground)

It would only start merging starting from the main layer and effectively create 4 maps instead of just 3 (sky, bg+main, fg).

I'll create a pull request with a fix.

Oops, my fault on this one. Thanks for finding and providing a fix!