Merge branch 'bx-696-startproject' of https://git.svs-tech.pro/ksenia_mikhailova/mns-mini-zabor into bx-696-startproject

This commit is contained in:
commit 9c04e88801
2 changed files with 47 additions and 36 deletions

View File

@ -17,6 +17,7 @@ const parametric = {
}, },
total_length: { total_length: {
min: 1, min: 1,
max: undefined,
step: 0.1, step: 0.1,
}, },
height: { height: {
@ -52,14 +53,17 @@ const changeParametres = () => {
fence_section.value = form_state.length * 0.001 fence_section.value = form_state.length * 0.001
for (const key in form_state) { for (const key in form_state) {
if (parametric.hasOwnProperty(key) && parametric[key].max) { if (parametric.hasOwnProperty(key)) {
if (form_state[key] > parametric[key].max) { const key_p = key as keyof typeof parametric
form_state[key] = parametric[key].max const key_s = key as keyof typeof form_state
if (parametric[key_p].max) {
if (form_state[key_s] > parametric[key_p].max) {
form_state[key_s] = parametric[key_p].max
} }
} }
if (parametric.hasOwnProperty(key) && parametric[key].min) { if (parametric[key_p].min) {
if (form_state[key] < parametric[key].min) { if (form_state[key_s] < parametric[key_p].min) {
form_state[key] = parametric[key].min form_state[key_s] = parametric[key_p].min
} }
} }
} }
@ -90,6 +94,7 @@ const changeParametres = () => {
if (form_state.extra_section && form_state.extra_section < parametric.length.min) { if (form_state.extra_section && form_state.extra_section < parametric.length.min) {
form_refs.total_length.value.setCustomValidity('Расчет невозможен') form_refs.total_length.value.setCustomValidity('Расчет невозможен')
} }
}
} }
const setLamelleColor = (color: ralTypes) => { const setLamelleColor = (color: ralTypes) => {
@ -100,13 +105,18 @@ const setPillarColor = (color: ralTypes) => {
} }
const increment = (field: keyof typeof form_state, value: number) => { const increment = (field: keyof typeof form_state, value: number) => {
if (form_state.hasOwnProperty(field)) { if (form_state.hasOwnProperty(field)) {
let v = (form_state[field] + value * parametric[field].step ?? 1) const key_p = field as keyof typeof parametric
let v = (form_state[field] + value * parametric[key_p].step ?? 1)
if (parametric.hasOwnProperty(field)) { if (parametric.hasOwnProperty(field)) {
if (v > parametric[field].max) { if (parametric[key_p].max) {
v = parametric[field].max if (v > parametric[key_p].max) {
v = parametric[key_p].max
}
}
if (parametric[key_p].min) {
if (v < parametric[key_p].min) {
v = parametric[key_p].min
} }
if (v < parametric[field].min) {
v = parametric[field].min
} }
} }
form_state[field] = parseFloat(v.toFixed(2)) form_state[field] = parseFloat(v.toFixed(2))

View File

@ -23,7 +23,8 @@ const pbrTexture = await useTexture({
const repeat = 5 const repeat = 5
for (const key in pbrTexture) { for (const key in pbrTexture) {
if (Object.prototype.hasOwnProperty.call(pbrTexture, key)) { if (Object.prototype.hasOwnProperty.call(pbrTexture, key)) {
const element = pbrTexture[key]; const key_p = key as keyof typeof pbrTexture
const element = pbrTexture[key_p]
if (element && element.wrapS) { if (element && element.wrapS) {
element.wrapS = RepeatWrapping element.wrapS = RepeatWrapping
element.wrapT = RepeatWrapping element.wrapT = RepeatWrapping