| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_EVENTS_EVENT_H_ | 5 #ifndef UI_EVENTS_EVENT_H_ |
| 6 #define UI_EVENTS_EVENT_H_ | 6 #define UI_EVENTS_EVENT_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 // converted from |source| coordinate system to |target| coordinate system. | 490 // converted from |source| coordinate system to |target| coordinate system. |
| 491 template <class T> | 491 template <class T> |
| 492 TouchEvent(const TouchEvent& model, T* source, T* target) | 492 TouchEvent(const TouchEvent& model, T* source, T* target) |
| 493 : LocatedEvent(model, source, target), | 493 : LocatedEvent(model, source, target), |
| 494 touch_id_(model.touch_id_), | 494 touch_id_(model.touch_id_), |
| 495 unique_event_id_(model.unique_event_id_), | 495 unique_event_id_(model.unique_event_id_), |
| 496 radius_x_(model.radius_x_), | 496 radius_x_(model.radius_x_), |
| 497 radius_y_(model.radius_y_), | 497 radius_y_(model.radius_y_), |
| 498 rotation_angle_(model.rotation_angle_), | 498 rotation_angle_(model.rotation_angle_), |
| 499 force_(model.force_), | 499 force_(model.force_), |
| 500 tilt_(model.tilt_), |
| 501 tiltDirection_(model.tiltDirection_), |
| 500 may_cause_scrolling_(model.may_cause_scrolling_), | 502 may_cause_scrolling_(model.may_cause_scrolling_), |
| 501 should_remove_native_touch_id_mapping_(false) {} | 503 should_remove_native_touch_id_mapping_(false) {} |
| 502 | 504 |
| 503 TouchEvent(EventType type, | 505 TouchEvent(EventType type, |
| 504 const gfx::PointF& location, | 506 const gfx::PointF& location, |
| 505 int touch_id, | 507 int touch_id, |
| 506 base::TimeDelta time_stamp); | 508 base::TimeDelta time_stamp); |
| 507 | 509 |
| 508 TouchEvent(EventType type, | 510 TouchEvent(EventType type, |
| 509 const gfx::PointF& location, | 511 const gfx::PointF& location, |
| 510 int flags, | 512 int flags, |
| 511 int touch_id, | 513 int touch_id, |
| 512 base::TimeDelta timestamp, | 514 base::TimeDelta timestamp, |
| 513 float radius_x, | 515 float radius_x, |
| 514 float radius_y, | 516 float radius_y, |
| 515 float angle, | 517 float angle, |
| 516 float force); | 518 float force, |
| 519 float tilt, |
| 520 float tiltDirection); |
| 517 | 521 |
| 518 ~TouchEvent() override; | 522 ~TouchEvent() override; |
| 519 | 523 |
| 520 // The id of the pointer this event modifies. | 524 // The id of the pointer this event modifies. |
| 521 int touch_id() const { return touch_id_; } | 525 int touch_id() const { return touch_id_; } |
| 522 // A unique identifier for this event. | 526 // A unique identifier for this event. |
| 523 uint64 unique_event_id() const { return unique_event_id_; } | 527 uint64 unique_event_id() const { return unique_event_id_; } |
| 524 // If we aren't provided with a radius on one axis, use the | 528 // If we aren't provided with a radius on one axis, use the |
| 525 // information from the other axis. | 529 // information from the other axis. |
| 526 float radius_x() const { return radius_x_ > 0 ? radius_x_ : radius_y_; } | 530 float radius_x() const { return radius_x_ > 0 ? radius_x_ : radius_y_; } |
| 527 float radius_y() const { return radius_y_ > 0 ? radius_y_ : radius_x_; } | 531 float radius_y() const { return radius_y_ > 0 ? radius_y_ : radius_x_; } |
| 528 float rotation_angle() const { return rotation_angle_; } | 532 float rotation_angle() const { return rotation_angle_; } |
| 529 float force() const { return force_; } | 533 float force() const { return force_; } |
| 534 float tilt() const { return tilt_; } |
| 535 float tiltDirection() const { return tiltDirection_; } |
| 530 | 536 |
| 531 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; } | 537 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; } |
| 532 bool may_cause_scrolling() const { return may_cause_scrolling_; } | 538 bool may_cause_scrolling() const { return may_cause_scrolling_; } |
| 533 | 539 |
| 534 // Used for unit tests. | 540 // Used for unit tests. |
| 535 void set_radius_x(const float r) { radius_x_ = r; } | 541 void set_radius_x(const float r) { radius_x_ = r; } |
| 536 void set_radius_y(const float r) { radius_y_ = r; } | 542 void set_radius_y(const float r) { radius_y_ = r; } |
| 537 | 543 |
| 538 void set_should_remove_native_touch_id_mapping( | 544 void set_should_remove_native_touch_id_mapping( |
| 539 bool should_remove_native_touch_id_mapping) { | 545 bool should_remove_native_touch_id_mapping) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 568 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. | 574 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. |
| 569 float radius_y_; | 575 float radius_y_; |
| 570 | 576 |
| 571 // Clockwise angle (in degrees) of the major axis from the X axis. Must be | 577 // Clockwise angle (in degrees) of the major axis from the X axis. Must be |
| 572 // less than 180 and non-negative. | 578 // less than 180 and non-negative. |
| 573 float rotation_angle_; | 579 float rotation_angle_; |
| 574 | 580 |
| 575 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. | 581 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. |
| 576 float force_; | 582 float force_; |
| 577 | 583 |
| 584 // Tilt angle of the stylus away from the perpendicular to the screen. |
| 585 // Default is NaN. |
| 586 float tilt_; |
| 587 |
| 588 // Clockwise angle from the X axis to the XY-projection of the stylus. |
| 589 // Range is [-180, 180), default is NaN. |
| 590 float tiltDirection_; |
| 591 |
| 578 // Whether the (unhandled) touch event will produce a scroll event (e.g., a | 592 // Whether the (unhandled) touch event will produce a scroll event (e.g., a |
| 579 // touchmove that exceeds the platform slop region, or a touchend that | 593 // touchmove that exceeds the platform slop region, or a touchend that |
| 580 // causes a fling). Defaults to false. | 594 // causes a fling). Defaults to false. |
| 581 bool may_cause_scrolling_; | 595 bool may_cause_scrolling_; |
| 582 | 596 |
| 583 // True if this event should remove the mapping between the native | 597 // True if this event should remove the mapping between the native |
| 584 // event id and the touch_id_. This should only be the case for | 598 // event id and the touch_id_. This should only be the case for |
| 585 // release and cancel events where the associated touch press event | 599 // release and cancel events where the associated touch press event |
| 586 // created a mapping between the native id and the touch_id_. | 600 // created a mapping between the native id and the touch_id_. |
| 587 bool should_remove_native_touch_id_mapping_; | 601 bool should_remove_native_touch_id_mapping_; |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 | 895 |
| 882 const GestureEventDetails& details() const { return details_; } | 896 const GestureEventDetails& details() const { return details_; } |
| 883 | 897 |
| 884 private: | 898 private: |
| 885 GestureEventDetails details_; | 899 GestureEventDetails details_; |
| 886 }; | 900 }; |
| 887 | 901 |
| 888 } // namespace ui | 902 } // namespace ui |
| 889 | 903 |
| 890 #endif // UI_EVENTS_EVENT_H_ | 904 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |