| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 // Indicates whether the element should be tested for cursor input. | 104 // Indicates whether the element should be tested for cursor input. |
| 105 bool IsHitTestable() const; | 105 bool IsHitTestable() const; |
| 106 | 106 |
| 107 virtual void Render(VrShellRenderer* renderer, | 107 virtual void Render(VrShellRenderer* renderer, |
| 108 vr::Mat4f view_proj_matrix) const; | 108 vr::Mat4f view_proj_matrix) const; |
| 109 | 109 |
| 110 virtual void Initialize(); | 110 virtual void Initialize(); |
| 111 | 111 |
| 112 // Controller interaction methods. | 112 // Controller interaction methods. |
| 113 virtual void OnHoverEnter(gfx::PointF position); | 113 virtual void OnHoverEnter(const gfx::PointF& position); |
| 114 virtual void OnHoverLeave(); | 114 virtual void OnHoverLeave(); |
| 115 virtual void OnMove(gfx::PointF position); | 115 virtual void OnMove(const gfx::PointF& position); |
| 116 virtual void OnButtonDown(gfx::PointF position); | 116 virtual void OnButtonDown(const gfx::PointF& position); |
| 117 virtual void OnButtonUp(gfx::PointF position); | 117 virtual void OnButtonUp(const gfx::PointF& position); |
| 118 // Whether the point (relative to the origin of the element), should be |
| 119 // considered on the element. All elements are considered rectangular by |
| 120 // default though elements may override this function to handle arbitrary |
| 121 // shapes. Points within the rectangular area are mapped from 0:1 as follows, |
| 122 // though will extend outside this range when outside of the element: |
| 123 // [(0.0, 0.0), (1.0, 0.0) |
| 124 // (1.0, 0.0), (1.0, 1.0)] |
| 125 virtual bool HitTest(const gfx::PointF& point) const; |
| 118 | 126 |
| 119 int id() const { return id_; } | 127 int id() const { return id_; } |
| 120 void set_id(int id) { id_ = id; } | 128 void set_id(int id) { id_ = id; } |
| 121 | 129 |
| 122 // If a non-negative parent ID is specified, applicable transformations | 130 // If a non-negative parent ID is specified, applicable transformations |
| 123 // are applied relative to the parent, rather than absolutely. | 131 // are applied relative to the parent, rather than absolutely. |
| 124 int parent_id() const { return parent_id_; } | 132 int parent_id() const { return parent_id_; } |
| 125 void set_parent_id(int id) { parent_id_ = id; } | 133 void set_parent_id(int id) { parent_id_ = id; } |
| 126 | 134 |
| 127 // If true, this object will be visible. | 135 // If true, this object will be visible. |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 bool dirty_ = false; | 300 bool dirty_ = false; |
| 293 | 301 |
| 294 Transform transform_; | 302 Transform transform_; |
| 295 | 303 |
| 296 DISALLOW_COPY_AND_ASSIGN(UiElement); | 304 DISALLOW_COPY_AND_ASSIGN(UiElement); |
| 297 }; | 305 }; |
| 298 | 306 |
| 299 } // namespace vr_shell | 307 } // namespace vr_shell |
| 300 | 308 |
| 301 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ | 309 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_UI_ELEMENT_H_ |
| OLD | NEW |