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

refactor(shapes): remove v-bind=$attrs on root element #526

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion playground/vue/src/pages/shapes/RoundedBoxDemo.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>
<script setup lang="ts">
import { OrbitControls, RoundedBox } from '@tresjs/cientos'
import { TresCanvas } from '@tresjs/core'
import { shallowRef, watch } from 'vue'
Expand All @@ -9,6 +9,19 @@ watch(boxRef, (box) => {
// eslint-disable-next-line no-console
console.log(box)
})

const rx = shallowRef(0)
const ry = shallowRef(0)
const rz = shallowRef(0)
let intervalId: ReturnType<typeof setInterval>

onMounted(() => intervalId = setInterval(() => {
rx.value += 0.01
ry.value += 0.03
rz.value += 0.02
}, 1000 / 30))

onUnmounted(() => clearInterval(intervalId))
</script>

<template>
Expand All @@ -26,6 +39,7 @@ watch(boxRef, (box) => {
<OrbitControls />
<RoundedBox
ref="boxRef"
:rotation="[rx, ry, rz]"
>
<TresMeshBasicMaterial
:color="0x00FF00"
Expand Down
5 changes: 1 addition & 4 deletions src/core/shapes/Box.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="boxRef"
v-bind="$attrs"
>
<TresMesh ref="boxRef">
<TresBoxGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
5 changes: 1 addition & 4 deletions src/core/shapes/Circle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="circleRef"
v-bind="$attrs"
>
<TresMesh ref="circleRef">
<TresCircleGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
5 changes: 1 addition & 4 deletions src/core/shapes/Cone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="coneRef"
v-bind="$attrs"
>
<TresMesh ref="coneRef">
<TresConeGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
2 changes: 1 addition & 1 deletion src/core/shapes/Cylinder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ defineExpose({
</script>

<template>
<TresMesh ref="cylinderRef" v-bind="$attrs">
<TresMesh ref="cylinderRef">
<TresCylinderGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
5 changes: 1 addition & 4 deletions src/core/shapes/Dodecahedron.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="dodecahedronRef"
v-bind="$attrs"
>
<TresMesh ref="dodecahedronRef">
<TresDodecahedronGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
5 changes: 1 addition & 4 deletions src/core/shapes/Icosahedron.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="icosahedronRef"
v-bind="$attrs"
>
<TresMesh ref="icosahedronRef">
<TresIcosahedronGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
5 changes: 1 addition & 4 deletions src/core/shapes/Octahedron.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="octahedronRef"
v-bind="$attrs"
>
<TresMesh ref="octahedronRef">
<TresOctahedronGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
1 change: 0 additions & 1 deletion src/core/shapes/Plane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ defineExpose({
<TresMesh
ref="planeRef"
:rotation="[-Math.PI / 2, 0, 0]"
v-bind="$attrs"
>
<TresPlaneGeometry :args="args" />
<slot>
Expand Down
5 changes: 1 addition & 4 deletions src/core/shapes/Ring.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="ringRef"
v-bind="$attrs"
>
<TresMesh ref="ringRef">
<TresRingGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
5 changes: 1 addition & 4 deletions src/core/shapes/Sphere.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="sphereRef"
v-bind="$attrs"
>
<TresMesh ref="sphereRef">
<TresSphereGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
6 changes: 1 addition & 5 deletions src/core/shapes/Superformula.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="superformulaRef"
v-bind="$attrs"
:geometry="geometry"
>
<TresMesh ref="superformulaRef" :geometry="geometry">
<slot>
<TresMeshBasicMaterial :color="color" />
</slot>
Expand Down
6 changes: 1 addition & 5 deletions src/core/shapes/Tetrahedron.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="tetrahedronRef"
:rotation="[-Math.PI / 2, 0, 0]"
v-bind="$attrs"
>
<TresMesh ref="tetrahedronRef" :rotation="[-Math.PI / 2, 0, 0]">
<TresTetrahedronGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
5 changes: 1 addition & 4 deletions src/core/shapes/Torus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="torusRef"
v-bind="$attrs"
>
<TresMesh ref="torusRef">
<TresTorusGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
5 changes: 1 addition & 4 deletions src/core/shapes/TorusKnot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="torusKnotRef"
v-bind="$attrs"
>
<TresMesh ref="torusKnotRef">
<TresTorusKnotGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
5 changes: 1 addition & 4 deletions src/core/shapes/Tube.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ defineExpose({
</script>

<template>
<TresMesh
ref="tubeRef"
v-bind="$attrs"
>
<TresMesh ref="tubeRef">
<TresTubeGeometry :args="args" />
<slot>
<TresMeshBasicMaterial :color="color" />
Expand Down
Loading