Skip to main content

Source-less background layers

Standard addLayer supports type:background without source. It creates no fake source,count,reference or credit. Supports background-color/background-opacity and shared visibility,order,zoom ranges,name/metadata. Other layer types still require real sources.

import {map} from 'sqsmap';
map.addLayer({id:'background',type:'background',paint:{
 'background-color':'#00ff00','background-opacity':0.8
}});
await map.sqs.flush({render:true});
console.log(await map.getLayer('background')); // No source member
console.log(await map.sqs.getLayers()); // This layer has source:null
map.moveLayer('background'); // Move above earlier layers
await map.sqs.flush({render:true});

A bounded fullscreen GPU pass follows logical layer order and applies opacity once. Backgrounds return no fabricated query features. source/source-layer/filter,feature attributes and feature-state reject before mutation without leaving a source. Constants/shared zoom expressions retain existing color/opacity rules.

LayerInfo.source may now be null; getLayer/getStyle omit background source. Caller-owned panels should handle layer.source?.id. Existing sourced layers keep their identities/references; cleanup never removes an empty source. Currently planar; pitch/globe/shared-raster combinations reject explicitly and continue in3D tasks.

The complete HTML includes color,opacity,visibility,ordering,query and disposal handlers. The portable script verifies identical native and real WASM main-thread/strict Worker behavior. Example data are locally generated.