| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/touch_selection/touch_handle.h" | 5 #include "ui/touch_selection/touch_handle.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 | 10 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 SetAlpha(is_visible_ ? u : 1.f - u); | 221 SetAlpha(is_visible_ ? u : 1.f - u); |
| 222 | 222 |
| 223 if (u >= 1.f) { | 223 if (u >= 1.f) { |
| 224 EndFade(); | 224 EndFade(); |
| 225 return false; | 225 return false; |
| 226 } | 226 } |
| 227 | 227 |
| 228 return true; | 228 return true; |
| 229 } | 229 } |
| 230 | 230 |
| 231 gfx::RectF TouchHandle::GetVisibleBounds() const { |
| 232 if (!is_visible_ || !enabled_) |
| 233 return gfx::RectF(); |
| 234 |
| 235 return drawable_->GetVisibleBounds(); |
| 236 } |
| 237 |
| 231 void TouchHandle::BeginDrag() { | 238 void TouchHandle::BeginDrag() { |
| 232 DCHECK(enabled_); | 239 DCHECK(enabled_); |
| 233 if (is_dragging_) | 240 if (is_dragging_) |
| 234 return; | 241 return; |
| 235 EndFade(); | 242 EndFade(); |
| 236 is_dragging_ = true; | 243 is_dragging_ = true; |
| 237 is_drag_within_tap_region_ = true; | 244 is_drag_within_tap_region_ = true; |
| 238 client_->OnHandleDragBegin(*this); | 245 client_->OnHandleDragBegin(*this); |
| 239 } | 246 } |
| 240 | 247 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 295 |
| 289 void TouchHandle::SetAlpha(float alpha) { | 296 void TouchHandle::SetAlpha(float alpha) { |
| 290 alpha = std::max(0.f, std::min(1.f, alpha)); | 297 alpha = std::max(0.f, std::min(1.f, alpha)); |
| 291 if (alpha_ == alpha) | 298 if (alpha_ == alpha) |
| 292 return; | 299 return; |
| 293 alpha_ = alpha; | 300 alpha_ = alpha; |
| 294 drawable_->SetAlpha(alpha); | 301 drawable_->SetAlpha(alpha); |
| 295 } | 302 } |
| 296 | 303 |
| 297 } // namespace ui | 304 } // namespace ui |
| OLD | NEW |