From e657562e22d9eaeff7f70474ab7ca44ea462140a Mon Sep 17 00:00:00 2001
From: Kseninia Mikhaylova
Date: Tue, 18 Jun 2024 15:11:50 +0300
Subject: [PATCH] remove ctx
---
components/calcModels.vue | 4 ++--
components/calcValues.vue | 2 +-
components/model/fence.vue | 26 +-------------------------
components/model/parametric.vue | 12 ++++++------
4 files changed, 10 insertions(+), 34 deletions(-)
diff --git a/components/calcModels.vue b/components/calcModels.vue
index 48d6fa6..6e2a7a3 100644
--- a/components/calcModels.vue
+++ b/components/calcModels.vue
@@ -83,13 +83,13 @@ watch(section_count, () => {
-
+
-
+
diff --git a/components/calcValues.vue b/components/calcValues.vue
index 6b4bc8b..6d0021c 100644
--- a/components/calcValues.vue
+++ b/components/calcValues.vue
@@ -196,7 +196,7 @@ const plurals = {
Забор общей длиной {{ form_state.total_length }}{{ '\xa0' }}м,
{{ section_count }}
по
- {{ form_state.length.toFixed(2) }}{{ '\xa0' }}мм
+ {{ (form_state.length || 0).toFixed(2) }}{{ '\xa0' }}мм
и 1 дополнительная секция длиной {{ form_state.extra_section.toFixed(2) }}{{ '\xa0'
}}мм.
diff --git a/components/model/fence.vue b/components/model/fence.vue
index fc13d57..f2492b3 100644
--- a/components/model/fence.vue
+++ b/components/model/fence.vue
@@ -35,29 +35,6 @@ watch(fence_section, () => {
translate_to_section.value = make_translate_to_section()
})
-const s = 512
-const canvas = document.createElement('canvas')
-canvas.width = s
-canvas.height = s
-const ctx = canvas.getContext('2d') as CanvasRenderingContext2D
-ctx.fillStyle = "red"
-ctx.font = "512px serif"
-ctx.textAlign = "center"
-ctx.textBaseline = 'middle'
-ctx.fillText(props.index, s * 0.5, s * 0.5)
-
-const textures: any[] = []
-for (let index = 0; index < lamelles_count.value; index++) {
- const element = document.createElement('canvas')
- element.width = s
- element.height = s / lamelles_count.value
- const e_ctx = element.getContext('2d') as CanvasRenderingContext2D
- e_ctx.drawImage(canvas,
- 0, (s / lamelles_count.value) * index, s, s / lamelles_count.value,
- 0, 0, s, s / lamelles_count.value
- );
- textures.push(new CanvasTexture(element))
-}
const extra = ref((extra_section && props.index == (section_count.value + 1)) ? extra_section.value * 0.001 : false)
if (extra.value) {
pillar_one_pos.value = (extra.value as number) * -0.5 - 0.015
@@ -112,8 +89,7 @@ watch([section_count, fence_section, extra_section], () => {
-
+
diff --git a/components/model/parametric.vue b/components/model/parametric.vue
index 0ea6e8b..f690b6e 100644
--- a/components/model/parametric.vue
+++ b/components/model/parametric.vue
@@ -15,13 +15,13 @@ renderer.value.toneMapping = ReinhardToneMapping
renderer.value.shadowMap.enabled = true
renderer.value.shadowMap.type = PCFSoftShadowMap
-const { scene: top } = await useGLTF('/models_one/verh_100.glb')
-const { scene: fence } = await useGLTF('/models_one/fence.glb')
-const { scene: fastening } = await useGLTF('/models_one/krepleniye_planok (1).glb')
-const { scene: lamelle } = await useGLTF('/models_one/lamel_100.glb')
+const { scene: top } = await useGLTF('/models_one/verh_100.glb', { draco: true })
+const { scene: fence } = await useGLTF('/models_one/fence.glb', { draco: true })
+const { scene: fastening } = await useGLTF('/models_one/krepleniye_planok (1).glb', { draco: true })
+const { scene: lamelle } = await useGLTF('/models_one/lamel_100.glb', { draco: true })
const { seek } = useSeek()
-watch([section_count,extra_section], () => {
+watch([section_count, extra_section], () => {
const base = seek(scene.value, 'name', 'base')
const n = (section_count.value as number) + ~~(!!extra_section.value)
if (base?.children && n < base?.children.length) {
@@ -49,7 +49,7 @@ onMounted(() => {
-
+