From 74193b176341f428776e093001e282e10a8bc8b5 Mon Sep 17 00:00:00 2001 From: Brien Dieterle Date: Sun, 30 Jul 2017 23:06:10 -0700 Subject: [PATCH] xtilt ytilt view rotation moved to brush engine Simplifies code and allows raw xtilt/ytilt values for inputs --- gui/freehand.py | 9 --------- gui/inktool.py | 9 --------- 2 files changed, 18 deletions(-) diff --git a/gui/freehand.py b/gui/freehand.py index b3159cc49..8899ea2a1 100644 --- a/gui/freehand.py +++ b/gui/freehand.py @@ -426,17 +426,8 @@ def motion_notify_cb(self, tdw, event, fakepressure=None): else: drawstate.last_good_raw_ytilt = ytilt - # Tilt inputs are assumed to be relative to the viewport, - # but the canvas may be rotated or mirrored, or both. - # Compensate before passing them to the brush engine. - # https://gna.org/bugs/?19988 if tdw.mirrored: xtilt *= -1.0 - if tdw.rotation != 0: - tilt_angle = math.atan2(ytilt, xtilt) - tdw.rotation - tilt_magnitude = math.sqrt((xtilt**2) + (ytilt**2)) - xtilt = tilt_magnitude * math.cos(tilt_angle) - ytilt = tilt_magnitude * math.sin(tilt_angle) # Apply pressure mapping if we're running as part of a full # MyPaint application (and if there's one defined). diff --git a/gui/inktool.py b/gui/inktool.py index 9f46b3536..130d11a07 100644 --- a/gui/inktool.py +++ b/gui/inktool.py @@ -704,17 +704,8 @@ def _get_event_tilt(self, tdw, event): else: self._last_good_raw_ytilt = ytilt - # Tilt inputs are assumed to be relative to the viewport, - # but the canvas may be rotated or mirrored, or both. - # Compensate before passing them to the brush engine. - # https://gna.org/bugs/?19988 if tdw.mirrored: xtilt *= -1.0 - if tdw.rotation != 0: - tilt_angle = math.atan2(ytilt, xtilt) - tdw.rotation - tilt_magnitude = math.sqrt((xtilt**2) + (ytilt**2)) - xtilt = tilt_magnitude * math.cos(tilt_angle) - ytilt = tilt_magnitude * math.sin(tilt_angle) return (xtilt, ytilt)