Icon offset and anchor expressions
Shared point-symbol icon-offset accepts a constant x,y or an expression returning two numbers. Icon-anchor accepts a constant or expression returning one of the nine standard anchors.
map.setLayoutProperty('icons','icon-offset',
['semiliteral', [['get','offsetX'],['get','offsetY']]]);
map.setLayoutProperty('icons','icon-anchor', ['get','anchor']);
map.setGlobalStateProperty('offset', [20,0]);
map.setLayoutProperty('icons','icon-offset',
['array','number',2,['global-state','offset']]);
await map.sqs.flush({render:true});
Offsets use logical pixels, multiply by actual icon-size, then rotate with icon-rotate. Image pixelRatio determines logical image dimensions; scripts must not multiply map DPR again. Each component is bounded to ±4096. Invalid array length, type, range or anchor rejects the candidate. Null restores offset 0,0 or anchor center.
Attribute/global-state updates refresh drawing, collision and query geometry together while preserving source/layer identity. Layout still rejects feature-state. Line placement, complex layouts, independent URL-domain and other unsupported layouts and independent URL basemaps remain separate work. The portable script passes eight identical native QuickJS and browser main-thread/Worker checks, including actual red icon pixels. Mobile devices, other machines and formal release remain separate acceptance.
08.39 aligns shared symbol integer layout zoom and fractional paint zoom; see the layout zoom rule.