Skip to content

Commit

Permalink
Merge pull request #862 from briend/xytilt
Browse files Browse the repository at this point in the history
xtilt ytilt compensation moved to brush engine
  • Loading branch information
briend committed Jul 23, 2018
2 parents af306e4 + 74193b1 commit e474dd2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 18 deletions.
9 changes: 0 additions & 9 deletions gui/freehand.py
Expand Up @@ -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).
Expand Down
9 changes: 0 additions & 9 deletions gui/inktool.py
Expand Up @@ -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)

Expand Down

0 comments on commit e474dd2

Please sign in to comment.