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 @@
- {# РАЗМЕР ЭЛЕМЕНТА #}