diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index ce8a91e3..d1b1fad0 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -137,6 +137,7 @@ export default defineConfig({ { text: 'Precipitation', link: '/guide/staging/precipitation' }, { text: 'Sparkles', link: '/guide/staging/sparkles' }, { text: 'Ocean', link: '/guide/staging/ocean' }, + { text: 'Fit', link: '/guide/staging/fit' }, ], }, { diff --git a/docs/.vitepress/theme/components/FitDemo.vue b/docs/.vitepress/theme/components/FitDemo.vue new file mode 100644 index 00000000..a2b44a8b --- /dev/null +++ b/docs/.vitepress/theme/components/FitDemo.vue @@ -0,0 +1,30 @@ + + + diff --git a/docs/guide/staging/fit.md b/docs/guide/staging/fit.md new file mode 100644 index 00000000..08c79450 --- /dev/null +++ b/docs/guide/staging/fit.md @@ -0,0 +1,23 @@ +# Fit + + + + + +`` uniformly scales and positions its children as a group. By default, it fits its children into a 1 × 1 × 1 box at the world origin. + +Alternatively, the children can be fit into a `Box3` or an `Object3D`. + +Or the children can simply be resized. With `` the children are scaled relative to the center of their calculated bounding box. + +## Usage + +<<< @/.vitepress/theme/components/FitDemo.vue{3,20-27} + +## Props + + \ No newline at end of file diff --git a/playground/src/pages/staging/FitDemo.vue b/playground/src/pages/staging/FitDemo.vue new file mode 100644 index 00000000..815ed9e0 --- /dev/null +++ b/playground/src/pages/staging/FitDemo.vue @@ -0,0 +1,204 @@ + + + + + \ No newline at end of file diff --git a/playground/src/router/routes/staging.ts b/playground/src/router/routes/staging.ts index 36308760..c7a3a8ee 100644 --- a/playground/src/router/routes/staging.ts +++ b/playground/src/router/routes/staging.ts @@ -44,4 +44,9 @@ export const stagingRoutes = [ name: 'Ocean', component: () => import('../../pages/staging/OceanDemo.vue'), }, + { + path: '/staging/fit', + name: 'Fit', + component: () => import('../../pages/staging/FitDemo.vue'), + }, ] \ No newline at end of file diff --git a/src/core/staging/Fit.vue b/src/core/staging/Fit.vue new file mode 100644 index 00000000..23ff89f7 --- /dev/null +++ b/src/core/staging/Fit.vue @@ -0,0 +1,128 @@ + + + \ No newline at end of file diff --git a/src/core/staging/index.ts b/src/core/staging/index.ts index 4f7338e0..bcf215d1 100644 --- a/src/core/staging/index.ts +++ b/src/core/staging/index.ts @@ -2,6 +2,7 @@ import Environment from './useEnvironment/component.vue' import Lightformer from './useEnvironment/lightformer/index.vue' import Backdrop from './Backdrop.vue' import ContactShadows from './ContactShadows.vue' +import Fit from './Fit.vue' import Precipitation from './Precipitation.vue' import Sky from './Sky.vue' import Smoke from './Smoke.vue' @@ -13,6 +14,7 @@ export { Backdrop, ContactShadows, Environment, + Fit, Precipitation, Sky, Smoke,