From 3128ae4e2d9759fdcb5754e33c6fccf4c4fe8c3d Mon Sep 17 00:00:00 2001 From: erjemin Date: Sun, 23 Aug 2026 22:56:58 +0300 Subject: [PATCH] =?UTF-8?q?mod:=20=D1=8F=D0=B4=D1=80=D0=BE=20(03)=20=D1=83?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=8C=D1=88=D0=B5=D0=BD=D1=8B=20=D0=BC=D0=B0?= =?UTF-8?q?=D0=BA=D1=81=D0=B8=D0=BC=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20?= =?UTF-8?q?=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20"=D0=BF?= =?UTF-8?q?=D0=BB=D0=BE=D1=82=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20=D0=B3=D0=B0?= =?UTF-8?q?=D0=BB=D0=BB=D1=8E=D1=86=D0=B8=D0=BD=D0=B0=D1=86=D0=B8=D0=B8"?= =?UTF-8?q?=20=D1=82.=D0=BA.=20=D0=B1=D1=80=D0=B0=D1=83=D0=B7=D0=B5=D1=80?= =?UTF-8?q?=20=D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D1=83=D1=8E=20=D1=81=D0=B5?= =?UTF-8?q?=D1=82=D0=BA=D1=83=20=D0=BC=D0=BE=D0=B6=D0=B5=D1=82=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D1=82=D1=8F=D0=BD=D1=83=D1=82=D1=8C...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hypn0/hypn0_site/forms.py | 6 +++--- hypn0/hypn0_site/tests.py | 13 +++++++++++++ hypn0/templates/index.html | 8 ++++---- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/hypn0/hypn0_site/forms.py b/hypn0/hypn0_site/forms.py index 3d89817..f040c3f 100644 --- a/hypn0/hypn0_site/forms.py +++ b/hypn0/hypn0_site/forms.py @@ -32,9 +32,9 @@ class HalftoneGenerateForm(forms.Form): required=False, ) cols = forms.IntegerField( - min_value=20, - max_value=200, - initial=80, + min_value=10, + max_value=80, + initial=35, required=False, ) max_radius = forms.IntegerField( diff --git a/hypn0/hypn0_site/tests.py b/hypn0/hypn0_site/tests.py index 7f59b4c..cf9a1b3 100644 --- a/hypn0/hypn0_site/tests.py +++ b/hypn0/hypn0_site/tests.py @@ -66,6 +66,19 @@ class HalftoneServiceTests(TestCase): svg = generate_halftone_svg(buf.getvalue(), cols=20) self.assertIn(" width = 10 * 12 = 120, height = 30 * 12 = 360 + self.assertIn('viewBox="0 0 120 360"', svg_tall) + + # Для горизонтального изображения (300x100) + wide_img = Image.new("RGB", (300, 100), color="black") + svg_wide = generate_halftone_svg(wide_img, cols=30, max_radius=5) + self.assertIn('viewBox="0 0 360 120"', svg_wide) + class HalftoneFormTests(TestCase): """Тестирование формы валидации HalftoneGenerateForm.""" diff --git a/hypn0/templates/index.html b/hypn0/templates/index.html index 6dc1841..77ef8c1 100644 --- a/hypn0/templates/index.html +++ b/hypn0/templates/index.html @@ -11,7 +11,7 @@ colors: ['#a855ff'], /* Параметры сетки и трансформаций */ - cols: 80, /* Плотность галлюцинации (число колонок сетки, 20-200) */ + cols: 35, /* Плотность галлюцинации (число ячеек сетки по длинной стороне, 10-80) */ radius: 8, /* Размер гипно-точки (максимальный радиус элементов, 3-20) */ blink: 6, /* Интенсивность мерцания CSS-анимации (0-10) */ rotation: 0, /* Укачивание (угол поворота элементов, от -15° до +15°) */ @@ -292,12 +292,12 @@
- {# РАЗМЕР ЭЛЕМЕНТА #}