Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix misalignment of multi-touch emu feedback #3506

Merged
merged 3 commits into from Aug 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 13 additions & 3 deletions kivy/core/window/__init__.py
Expand Up @@ -528,6 +528,18 @@ def _get_system_size(self):
'''Real size of the window ignoring rotation.
'''

def _get_effective_size(self):
'''On density=1 and non-ios displays, return system_size, else
return scaled / rotated size.

Used by MouseMotionEvent.update_graphics() and WindowBase.on_motion().
'''
w, h = self.system_size
if platform == 'ios' or self._density != 1:
w, h = self.size

return w, h

borderless = BooleanProperty(False)
'''When set to True, this property removes the window border/decoration.

Expand Down Expand Up @@ -942,9 +954,7 @@ def on_motion(self, etype, me):
The Motion Event currently dispatched.
'''
if me.is_touch:
w, h = self.system_size
if platform == 'ios' or self._density != 1:
w, h = self.size
w, h = self._get_effective_size()
me.scale_for_screen(w, h, rotation=self._rotation,
smode=self.softinput_mode,
kheight=self.keyboard_height)
Expand Down
11 changes: 7 additions & 4 deletions kivy/input/providers/mouse.py
Expand Up @@ -105,10 +105,13 @@ def update_graphics(self, win, create=False):
self.ud._drawelement = de
if de is not None:
self.push()
self.scale_for_screen(
win.system_size[0],
win.system_size[1],
rotation=win.rotation)

# use same logic as WindowBase.on_motion() so we get correct
# coordinates when _density != 1
w, h = win._get_effective_size()

self.scale_for_screen(w, h, rotation=win.rotation)

de[1].pos = self.x - 10, self.y - 10
self.pop()

Expand Down