Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: 577 tres docs cookbook orbit controls code throws error #580

Merged

Conversation

alvarosabu
Copy link
Member

Closes #577

@alvarosabu alvarosabu added bug Something isn't working docs Improvements or additions to documentation labels Mar 7, 2024
Copy link

netlify bot commented Mar 7, 2024

Deploy Preview for tresjs-docs ready!

Name Link
🔨 Latest commit 51aa354
🔍 Latest deploy log https://app.netlify.com/sites/tresjs-docs/deploys/65e9f7c1cf5af70008d64821
😎 Deploy Preview https://deploy-preview-580--tresjs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@alvarosabu
Copy link
Member Author

Hi, @Tinoooo or @DennisSmuda could you please help me out by applying the changes to the German de/cookbook/orbit-controls.md recipe?

Thanks 🙏🏻

@alvarosabu alvarosabu merged commit 2bb64cb into main Mar 7, 2024
7 checks passed
@alvarosabu alvarosabu deleted the docs/577-tres-docs-cookbookorbit-controls-code-throws-error branch March 7, 2024 17:25
@andretchen0
Copy link
Contributor

@alvarosabu

Dude, you're fast like the wind these days!

Problem

Error on StackBlitz:

Uncaught SyntaxError: import not found: OrbitControls

That's thrown if I run the updated example code from the OrbitControls page of the deployment preview, here:

Screenshot 2024-03-07 at 23 49 15

Solution

  • TresCanvas needs to be imported
  • OrbitControls needs to be default imported (no curly braces)

This works on StackBlitz for App.vue:

<script setup lang="ts">
import { TresCanvas } from '@tresjs/core';
import OrbitControls from './OrbitControls.vue';
</script>

<template>
  <TresCanvas shadows alpha>
    <TresPerspectiveCamera :args="[45, 1, 0.1, 1000]" />
    <OrbitControls />
  </TresCanvas>
</template>

StackBlitz (with a TresMesh to show it's working.)

@alvarosabu
Copy link
Member Author

@andretchen0 😂 and I'm sick, it must be the medicines haha

I guess I was putting the bare minimum of code to exemplify, but I see that in real life, most users would expect to copy the code directly and have it work right?. Great feedback, I will create another PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docs Improvements or additions to documentation
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Tres docs' cookbook/orbit-controls code throws error
3 participants