| 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 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" | 5 #include "chrome/browser/android/vr_shell/ui_elements/ui_element.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 UiElement::~UiElement() = default; | 110 UiElement::~UiElement() = default; |
| 111 | 111 |
| 112 void UiElement::Render(VrShellRenderer* renderer, | 112 void UiElement::Render(VrShellRenderer* renderer, |
| 113 vr::Mat4f view_proj_matrix) const { | 113 vr::Mat4f view_proj_matrix) const { |
| 114 NOTREACHED(); | 114 NOTREACHED(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void UiElement::Initialize() {} | 117 void UiElement::Initialize() {} |
| 118 | 118 |
| 119 void UiElement::OnHoverEnter(gfx::PointF position) {} | 119 void UiElement::OnHoverEnter(const gfx::PointF& position) {} |
| 120 | 120 |
| 121 void UiElement::OnHoverLeave() {} | 121 void UiElement::OnHoverLeave() {} |
| 122 | 122 |
| 123 void UiElement::OnMove(gfx::PointF position) {} | 123 void UiElement::OnMove(const gfx::PointF& position) {} |
| 124 | 124 |
| 125 void UiElement::OnButtonDown(gfx::PointF position) {} | 125 void UiElement::OnButtonDown(const gfx::PointF& position) {} |
| 126 | 126 |
| 127 void UiElement::OnButtonUp(gfx::PointF position) {} | 127 void UiElement::OnButtonUp(const gfx::PointF& position) {} |
| 128 | 128 |
| 129 void UiElement::OnBeginFrame(const base::TimeTicks& begin_frame_time) {} | 129 void UiElement::OnBeginFrame(const base::TimeTicks& begin_frame_time) {} |
| 130 | 130 |
| 131 void UiElement::Animate(const base::TimeTicks& time) { | 131 void UiElement::Animate(const base::TimeTicks& time) { |
| 132 for (auto& it : animations_) { | 132 for (auto& it : animations_) { |
| 133 Animation& animation = *it; | 133 Animation& animation = *it; |
| 134 if (time < animation.start) | 134 if (time < animation.start) |
| 135 continue; | 135 continue; |
| 136 | 136 |
| 137 // If |from| is not specified, start at the current values. | 137 // If |from| is not specified, start at the current values. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 219 } |
| 220 | 220 |
| 221 bool UiElement::IsHitTestable() const { | 221 bool UiElement::IsHitTestable() const { |
| 222 return IsVisible() && hit_testable_; | 222 return IsVisible() && hit_testable_; |
| 223 } | 223 } |
| 224 | 224 |
| 225 void UiElement::SetEnabled(bool enabled) { | 225 void UiElement::SetEnabled(bool enabled) { |
| 226 visible_ = enabled; | 226 visible_ = enabled; |
| 227 } | 227 } |
| 228 | 228 |
| 229 bool UiElement::HitTest(const gfx::PointF& point) const { |
| 230 return point.x() >= 0.0f && point.x() <= 1.0f && point.y() >= 0.0f && |
| 231 point.y() <= 1.0f; |
| 232 } |
| 233 |
| 229 } // namespace vr_shell | 234 } // namespace vr_shell |
| OLD | NEW |