fix(cms-base-layer): fit small 3D models to viewport in SwMedia3D#2346
fix(cms-base-layer): fit small 3D models to viewport in SwMedia3D#2346Johannes Berthel (joberthel) wants to merge 1 commit intoshopware:mainfrom
Conversation
|
Johannes Berthel (@joberthel) is attempting to deploy a commit to the Shopware Frontends Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
This PR updates SwMedia3D in @shopware/cms-base-layer to better frame very small GLB/GLTF models by introducing bounds-based viewport fitting, improving model visibility and inspection usability in CMS contexts.
Changes:
- Wrap the loaded 3D model in
@tresjs/cientosBoundsto auto-frame the model in the viewport. - Set
OrbitControlsas default controls to work with the bounds/framing behavior. - Add a changeset documenting the patch-level improvement.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/cms-base-layer/app/components/SwMedia3D.vue | Adds bounds-based framing (Bounds) around the rendered model and adjusts controls to improve viewport fit for small models. |
| .changeset/slimy-toys-vanish.md | Records a patch changeset describing the improved SwMedia3D model framing behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <primitive v-if="model" :object="model" /> | ||
| <OrbitControls make-default /> | ||
| <Bounds ref="boundsRef" clip use-mounted> | ||
| <primitive v-if="model" :object="model" @click="() => focusObject()" /> |
There was a problem hiding this comment.
The inline arrow function in the template (@click="() => focusObject()") creates a new function on every render. Bind the handler directly (e.g. @click="focusObject") to avoid unnecessary allocations and keep the template simpler.
| <primitive v-if="model" :object="model" @click="() => focusObject()" /> | |
| <primitive v-if="model" :object="model" @click="focusObject" /> |
Description
This PR fixes an issue in SwMedia3D where very small 3D models could appear tiny in the scene and be hard to inspect.
The component now auto-fits the loaded 3D model into the viewport by using bounds-based framing, which improves visibility and usability.
Type of change
Bug fix (non-breaking change that fixes an issue)
ToDo's
Additional context
Issue can be reproduced with this GLB-File.