From a339be2827793d28fb7d4b981f326d62ddcbba07 Mon Sep 17 00:00:00 2001 From: ExMix Date: Wed, 13 May 2015 16:36:16 +0300 Subject: [PATCH] [drape] android touches fix correct resize event on android --- .../com/mapswithme/maps/RenderActivity.java | 36 ++++++++++--------- drape_frontend/drape_engine.cpp | 3 -- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/android/src/com/mapswithme/maps/RenderActivity.java b/android/src/com/mapswithme/maps/RenderActivity.java index eb266e4e7a..8bd3a97495 100644 --- a/android/src/com/mapswithme/maps/RenderActivity.java +++ b/android/src/com/mapswithme/maps/RenderActivity.java @@ -82,12 +82,14 @@ public abstract class RenderActivity extends MWMFragmentActivity if (count == 0) return super.onTouchEvent(event); - int action = event.getAction(); + int action = event.getActionMasked(); switch (action) { + case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_UP: action = NATIVE_ACTION_UP; break; + case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_DOWN: action = NATIVE_ACTION_DOWN; break; @@ -102,27 +104,27 @@ public abstract class RenderActivity extends MWMFragmentActivity switch (count) { case 1: - { - mLastPointerId = event.getPointerId(0); + { + mLastPointerId = event.getPointerId(0); - final float x0 = event.getX(); - final float y0 = event.getY(); + final float x0 = event.getX(); + final float y0 = event.getY(); - return OnTouch(action, true, false, x0, y0, 0, 0); - } + return OnTouch(action, true, false, x0, y0, 0, 0); + } default: - { - final float x0 = event.getX(0); - final float y0 = event.getY(0); + { + final float x0 = event.getX(0); + final float y0 = event.getY(0); - final float x1 = event.getX(1); - final float y1 = event.getY(1); + final float x1 = event.getX(1); + final float y1 = event.getY(1); - if (event.getPointerId(0) == mLastPointerId) - return OnTouch(action, true, true, x0, y0, x1, y1); - else - return OnTouch(action, true, true, x1, y1, x0, y0); - } + if (event.getPointerId(0) == mLastPointerId) + return OnTouch(action, true, true, x0, y0, x1, y1); + else + return OnTouch(action, true, true, x1, y1, x0, y0); + } } } diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp index 568e701a30..6df64faff9 100644 --- a/drape_frontend/drape_engine.cpp +++ b/drape_frontend/drape_engine.cpp @@ -61,9 +61,6 @@ DrapeEngine::~DrapeEngine() void DrapeEngine::Resize(int w, int h) { - if (m_viewport.GetWidth() == w && m_viewport.GetHeight() == h) - return; - m_viewport.SetViewport(0, 0, w, h); AddUserEvent(ResizeEvent(w, h)); }