Skip to content

feat(layers): add getPixelOffset prop to ScatterplotLayer#10178

Open
officialasishkumar wants to merge 2 commits intovisgl:masterfrom
officialasishkumar:feat/scatterplot-pixel-offset
Open

feat(layers): add getPixelOffset prop to ScatterplotLayer#10178
officialasishkumar wants to merge 2 commits intovisgl:masterfrom
officialasishkumar:feat/scatterplot-pixel-offset

Conversation

@officialasishkumar
Copy link
Copy Markdown
Contributor

Closes #10057

Change List

  • Add getPixelOffset accessor prop to ScatterplotLayer that shifts the rendered circle by a fixed number of screen pixels, independently of zoom level
  • New instance attribute instancePixelOffset (vec2, transition-enabled) with a default value of [0, 0] for full backward compatibility
  • In billboard mode, the pixel offset is added to the screen-space offset before clip-space projection
  • In non-billboard mode, the pixel offset is converted to common space via project_pixel_size and added to the common-space offset
  • Both GLSL and WGSL shader variants are updated
  • Follows the same implementation pattern as IconLayer and TextLayer

Usage

new ScatterplotLayer({
  data,
  getPosition: d => d.position,
  getRadius: 100,
  getPixelOffset: [10, -5],  // shift 10px right, 5px up
})

@missx-oai
Copy link
Copy Markdown

@officialasishkumar Can you share your use case for this feature?

@officialasishkumar officialasishkumar force-pushed the feat/scatterplot-pixel-offset branch from 5b231ed to 352bddf Compare April 7, 2026 06:07
@officialasishkumar
Copy link
Copy Markdown
Contributor Author

@missx-oai The use case is screen-space nudging for circles that share the same geographic anchor without altering the underlying coordinates. That is useful for decluttering overlapping scatterplot markers and for aligning a circle with nearby text or icon layers that already support pixel offsets.

@Pessimistress Pessimistress requested a review from ibgreen April 7, 2026 21:48
@officialasishkumar
Copy link
Copy Markdown
Contributor Author

Will resolve the merge conflicts

@Pessimistress
Copy link
Copy Markdown
Collaborator

Please update the documentation for ScatterplotLayer.

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 7, 2026

Coverage Status

coverage: 81.456%. remained the same — officialasishkumar:feat/scatterplot-pixel-offset into visgl:master

Add a getPixelOffset accessor to ScatterplotLayer that allows shifting
the rendered circle by a fixed number of screen pixels, independently
of zoom level. This is useful for preventing overlap between circles
and other layers (e.g. icons, text) without modifying the underlying
data positions.

The implementation follows the same pattern used by IconLayer and
TextLayer:
- New instance attribute `instancePixelOffset` (vec2, transition-enabled)
- In billboard mode, the pixel offset is added to the screen-space
  offset before clip-space projection
- In non-billboard mode, the pixel offset is converted to common space
  via project_pixel_size and added to the common-space offset
- Both GLSL and WGSL shader variants are updated
- Default value is [0, 0] for backward compatibility

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
Add documentation for the new getPixelOffset accessor prop, following
the same format used by IconLayer and TextLayer documentation.

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
@officialasishkumar officialasishkumar force-pushed the feat/scatterplot-pixel-offset branch from 352bddf to b1f4e01 Compare April 8, 2026 06:09
@officialasishkumar
Copy link
Copy Markdown
Contributor Author

Updated the ScatterplotLayer documentation with the getPixelOffset accessor, following the same format used in IconLayer and TextLayer docs. Also rebased on latest master and resolved the merge conflict in the WGSL shader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] Could getPixelOffset be available on scatterplot Layer items?

4 participants