Skip to content

ProjectedLineRenderable ​

A polyline drawn with a constant screen-space width.

The line is extruded in the vertex shader so its width stays fixed in pixels at any zoom level. Custom layers can construct it directly for paths and outlines.

Extends RenderableObject and inherits all public properties and methods.

Constructor ​

Creates a projected line renderable for the given path geometry.

ts
new ProjectedLineRenderable(props): ProjectedLineRenderable;
ParameterDescription
props: ProjectedLineRenderablePropsInitialization properties.

Types ​

ProjectedLineRenderableProps ​

Initialization properties for constructing a projected line renderable.

PropertyDescription
geometry: ProjectedLineGeometryThe line path geometry to draw.
color: ColorLikeThe line color.
width: numberLine width in pixels.

Accessors ​

type string overrides ​

Identifies the renderable type as ProjectedLineRenderable.

ts
get type(): string;

color Color ​

The line color. Assignable from any ColorLike value.

ts
get color(): Color;
ts
set color(value): void;
ParameterDescription
value: ColorLikeThe new line color.

width number ​

The line width in pixels.

ts
get width(): number;
ts
set width(value): void;
ParameterDescription
value: numberThe new width in pixels.

Methods ​

getUniforms() overrides ​

Returns the color and width uniforms for the line shader.

ts
getUniforms(): {
  u_lineColor: [number, number, number];
  u_lineWidth: number;
};

Released under the MIT License