Skip to content

Conversation

@ibgreen
Copy link
Collaborator

@ibgreen ibgreen commented Dec 16, 2025

Summary

deck.gl really needs the ability to exclude layers from being drawn based on bounds checks. And the existing getBounds function is not sufficient. As a first step, this PR adds a Layer.getWorldBounds() that returns a math.gl OrientedBoundingBox that applies modelMatrix coordinateSystem etc.

  • add a world-bounds utility that transforms layer bounds into oriented bounding boxes
  • introduce Layer.getWorldBounds with caching and configurable cache invalidation
  • add world-bounds unit tests and export the helper through the main deck.gl entry

Testing

  • npx eslint modules/core/src/lib/layer.ts modules/core/src/lib/world-bounds.ts
  • npx prettier --check modules/core/src/lib/layer.ts modules/core/src/lib/world-bounds.ts
  • node_modules/.bin/ts-node test/modules/core/lib/world-bounds.spec.ts (fails: ts-node ESM loader not configured)
  • git commit (runs lint/prettier/test-fast)

Codex Task

@ibgreen ibgreen changed the title Add world bounds transformation support feat(core) Add getWorldBounds() method Dec 16, 2025
...transformOptions
});

this._cachedWorldBounds = worldBounds;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core has a memoize utility function.

const attributeManager = this.getAttributeManager();
const {dataChanged} = params.changeFlags;
if (params.changeFlags.propsOrDataChanged || params.changeFlags.viewportChanged) {
this._worldBoundsDirty = true;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically incorrect.

There are multiple existing caching mechanism (e.g. in layer.getBounds()) you should not have to manage a dirty flag manually.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants