mirror of https://gitee.com/antv-l7/antv-l7
24 lines
586 B
JavaScript
24 lines
586 B
JavaScript
export default function ImageBuffer(layerData, opt) {
|
|
const attributes = {
|
|
vertices: [],
|
|
colors: [],
|
|
sizes: [],
|
|
shapes: [],
|
|
pickingIds: [],
|
|
uv: []
|
|
};
|
|
layerData.forEach(item => {
|
|
const { color, size, id, shape, coordinates } = item;
|
|
const { x, y } = opt.imagePos[shape];
|
|
attributes.vertices.push(...coordinates);
|
|
attributes.colors.push(...color);
|
|
attributes.pickingIds.push(id);
|
|
attributes.sizes.push(size * window.devicePixelRatio); //
|
|
attributes.uv.push(x, y);
|
|
attributes.shapes.push(shape);
|
|
});
|
|
|
|
|
|
return attributes;
|
|
}
|