From 038fe522f82c26437e7cc0441a106682aac17859 Mon Sep 17 00:00:00 2001 From: JannisX11 Date: Sun, 11 Apr 2021 19:59:06 +0200 Subject: [PATCH] Clamp pen pressure value, fixes #631 --- js/texturing/painter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/texturing/painter.js b/js/texturing/painter.js index 3d33788..72b1619 100644 --- a/js/texturing/painter.js +++ b/js/texturing/painter.js @@ -299,10 +299,10 @@ const Painter = { Painter.current.force = touch.force; if (settings.brush_opacity_modifier.value == 'pressure' && touch.force) { - b_opacity = Math.clamp(b_opacity * touch.force*1.25, 0, 100); + b_opacity = Math.clamp(b_opacity * Math.clamp(touch.force*1.25, 0, 1), 0, 100); } else if (settings.brush_opacity_modifier.value == 'tilt' && touch.altitudeAngle !== undefined) { - var modifier = Math.clamp(1.5 / (touch.altitudeAngle + 0.3), 1, 4)/2; + var modifier = Math.clamp(0.5 / (touch.altitudeAngle + 0.3), 0, 1); b_opacity = Math.clamp(b_opacity * modifier, 0, 100); } if (settings.brush_size_modifier.value == 'pressure' && touch.force) {