feat: plugin APIs to get camera viewport and layers in the viewport #165
Conversation
✔️ Deploy Preview for reearth-web ready! 🔨 Explore the source changes: aaaeb70 🔍 Inspect the deploy log: https://app.netlify.com/sites/reearth-web/deploys/6203943c1ce8160008a1a699 😎 Browse the preview: https://deploy-preview-165--reearth-web.netlify.app |
Codecov Report
@@ Coverage Diff @@
## main #165 +/- ##
==========================================
- Coverage 45.21% 45.14% -0.07%
==========================================
Files 60 60
Lines 1307 1309 +2
Branches 212 212
==========================================
Hits 591 591
- Misses 657 659 +2
Partials 59 59
|
@rot1024 , I need your advice on the following: (I'll remind you on Monday)
After answering these, I'll write a development outline and continue with this task. |
src/components/molecules/Visualizer/Engine/Cesium/useEngineRef.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested on Netlify preview and roughly ok, but I found that rect fields are radians, and also the plugin APIs often uses getters, so fix them and make sure to return the value directly instead of returning a function.
Overview
Extend public API to include layers filtering by
viewport
What I've done
camera.computeViewRectangle()
to retrieve the viewport's rectangle.Rectangle.contains
to check if layer is inside this rectangle or not.How I tested
reearth.layers.getLayersInViewport()
in console.