Index: components/html_viewer/touch_handler.cc |
diff --git a/components/html_viewer/touch_handler.cc b/components/html_viewer/touch_handler.cc |
index 4764867eb15e7dc7be50c8f2100b61d494d0311d..23deaa731e382f171dfdf75833cacd726da740c5 100644 |
--- a/components/html_viewer/touch_handler.cc |
+++ b/components/html_viewer/touch_handler.cc |
@@ -15,17 +15,33 @@ |
namespace html_viewer { |
namespace { |
+// TODO(rjkroege): Gesture recognition currently happens in the html_viewer. |
+// In phase2, it will be relocated to MUS. Update this code at that time. |
void SetPropertiesFromEvent(const mojo::Event& event, |
ui::PointerProperties* properties) { |
properties->id = event.pointer_data->pointer_id; |
- properties->x = event.pointer_data->x; |
- properties->y = event.pointer_data->y; |
- properties->raw_x = event.pointer_data->screen_x; |
- properties->raw_y = event.pointer_data->screen_y; |
- properties->pressure = event.pointer_data->pressure; |
- properties->SetAxesAndOrientation(event.pointer_data->radius_major, |
- event.pointer_data->radius_minor, |
- event.pointer_data->orientation); |
+ properties->x = event.pointer_data->location->x; |
+ properties->y = event.pointer_data->location->y; |
+ properties->raw_x = event.pointer_data->location->screen_x; |
+ properties->raw_y = event.pointer_data->location->screen_y; |
+ |
+ if (event.pointer_data->kind == mojo::POINTER_KIND_TOUCH || |
+ event.pointer_data->kind == mojo::POINTER_KIND_PEN) { |
+ properties->pressure = event.pointer_data->brush_data->pressure; |
+ |
+ // TODO(rjkroege): vary orientation for width, height. |
+ properties->SetAxesAndOrientation(event.pointer_data->brush_data->width, |
+ event.pointer_data->brush_data->height, |
+ 0.0); |
+ } else { |
+ if (event.flags & mojo::EVENT_FLAGS_LEFT_MOUSE_BUTTON || |
+ event.flags & mojo::EVENT_FLAGS_MIDDLE_MOUSE_BUTTON || |
+ event.flags & mojo::EVENT_FLAGS_MIDDLE_MOUSE_BUTTON) { |
+ properties->pressure = 0.5; |
+ } else { |
+ properties->pressure = 0.0; |
+ } |
+ } |
// TODO(sky): Add support for tool_type. |
} |