to fixed fix

This commit is contained in:
Kseninia Mikhaylova 2024-06-18 15:22:17 +03:00
parent e657562e22
commit 6f45cbc0b3
3 changed files with 7 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import { OrbitControls, Environment, useGLTF } from '@tresjs/cientos'
const section_count = useState<number>('section_count') const section_count = useState<number>('section_count')
const fence_section = useState<number>('fence_section') const fence_section = useState<number>('fence_section')
const extra_section = useState<number>('extra_section') const extra_section = useState<number>('extra_section')
const max_size = useState<number>('max_size')
const controlsState = reactive({ const controlsState = reactive({
distance: section_count.value, distance: section_count.value,
@ -83,7 +84,7 @@ watch(section_count, () => {
<TresCanvas shadows> <TresCanvas shadows>
<TresPerspectiveCamera v-bind="cameraStat" ref="camera" /> <TresPerspectiveCamera v-bind="cameraStat" ref="camera" />
<OrbitControls v-bind="controlsState" make-default /> <OrbitControls v-bind="controlsState" make-default />
<TresGroup :position-x="Math.min(section_count, 12) * fence_section * -1" :position-y="-3"> <TresGroup :position-x="Math.min(section_count, max_size) * fence_section * -1" :position-y="-3">
<Suspense> <Suspense>
<ModelParametric /> <ModelParametric />
</Suspense> </Suspense>

View File

@ -196,7 +196,7 @@ const plurals = {
Забор общей длиной {{ form_state.total_length }}{{ '\xa0' }}м, Забор общей длиной {{ form_state.total_length }}{{ '\xa0' }}м,
{{ section_count }} {{ section_count }}
<Plural :n="section_count" :forms="plurals.section" /> по <Plural :n="section_count" :forms="plurals.section" /> по
{{ (form_state.length || 0).toFixed(2) }}{{ '\xa0' }}мм<template v-if="form_state.extra_section"> {{ parseInt(form_state.length).toFixed(2) }}{{ '\xa0' }}мм<template v-if="form_state.extra_section">
и 1 дополнительная секция длиной {{ form_state.extra_section.toFixed(2) }}{{ '\xa0' и 1 дополнительная секция длиной {{ form_state.extra_section.toFixed(2) }}{{ '\xa0'
}}мм</template>. }}мм</template>.
</p> </p>
@ -207,7 +207,7 @@ const plurals = {
</template> </template>
{{ section_count * lamelles_count }} {{ section_count * lamelles_count }}
<Plural :n="section_count * lamelles_count" :forms="plurals.lamelle" /> <Plural :n="section_count * lamelles_count" :forms="plurals.lamelle" />
{{ `длиной ${form_state.length.toFixed(2)}\xa0мм` }}<template v-if="form_state.extra_section">и {{ `длиной ${parseInt(form_state.length).toFixed(2)}\xa0мм` }}<template v-if="form_state.extra_section">и
{{ ~~(!!form_state.extra_section.toFixed(2)) * lamelles_count }} {{ ~~(!!form_state.extra_section.toFixed(2)) * lamelles_count }}
<Plural :n="~~(!!form_state.extra_section) * lamelles_count" :forms="plurals.lamelle" /> <Plural :n="~~(!!form_state.extra_section) * lamelles_count" :forms="plurals.lamelle" />
{{ `длиной ${form_state.extra_section}\xa0мм` }} {{ `длиной ${form_state.extra_section}\xa0мм` }}

View File

@ -9,6 +9,8 @@ import { useGLTF, } from '@tresjs/cientos'
const section_count = useState<number>('section_count') const section_count = useState<number>('section_count')
const extra_section = useState<number>('extra_section') const extra_section = useState<number>('extra_section')
const max_size = useState<number>('max_size', () => 13)
const { scene, renderer, camera } = useTresContext() const { scene, renderer, camera } = useTresContext()
renderer.value.toneMapping = ReinhardToneMapping renderer.value.toneMapping = ReinhardToneMapping
@ -49,7 +51,7 @@ onMounted(() => {
<template> <template>
<TresGroup name="base"> <TresGroup name="base">
<template v-for="i in (section_count + ~~(!!extra_section))"> <template v-for="i in (section_count + ~~(!!extra_section))">
<template v-if="i <= 12"> <template v-if="i <= max_size">
<ModelFence :index="i" :models="{ top, fence, fastening, lamelle }" /> <ModelFence :index="i" :models="{ top, fence, fastening, lamelle }" />
</template> </template>
</template> </template>