()
| 2354 | |
| 2355 | /// <inheritdoc /> |
| 2356 | public override void UpdateKeyframes() |
| 2357 | { |
| 2358 | if (_points.Count == 0) |
| 2359 | { |
| 2360 | // No keyframes |
| 2361 | _contents.Bounds = Rectangle.Empty; |
| 2362 | return; |
| 2363 | } |
| 2364 | |
| 2365 | _mainPanel.LockChildrenRecursive(); |
| 2366 | |
| 2367 | // Place keyframes |
| 2368 | Rectangle curveContentAreaBounds = _mainPanel.GetClientArea(); |
| 2369 | var viewScale = ViewScale; |
| 2370 | var pointsSize = _showCollapsed ? new Float2(4.0f / viewScale.X, Height - 2.0f) : KeyframesSize / viewScale; |
| 2371 | for (int i = 0; i < _points.Count; i++) |
| 2372 | { |
| 2373 | var p = _points[i]; |
| 2374 | var k = _keyframes[p.Index]; |
| 2375 | var point = GetKeyframePoint(ref k, p.Component); |
| 2376 | var location = new Float2 |
| 2377 | ( |
| 2378 | point.X * UnitsPerSecond - pointsSize.X * 0.5f, |
| 2379 | point.Y * -UnitsPerSecond - pointsSize.Y * 0.5f + curveContentAreaBounds.Height |
| 2380 | ); |
| 2381 | if (_showCollapsed) |
| 2382 | { |
| 2383 | location.Y = 1.0f; |
| 2384 | p.Visible = p.Component == 0; |
| 2385 | } |
| 2386 | else |
| 2387 | { |
| 2388 | p.Visible = true; |
| 2389 | } |
| 2390 | p.Bounds = new Rectangle(location, pointsSize); |
| 2391 | } |
| 2392 | |
| 2393 | // Calculate bounds |
| 2394 | var bounds = _points[0].Bounds; |
| 2395 | for (int i = 1; i < _points.Count; i++) |
| 2396 | bounds = Rectangle.Union(bounds, _points[i].Bounds); |
| 2397 | |
| 2398 | // Adjust contents bounds to fill the curve area |
| 2399 | if (EnablePanning != UseMode.Off || !ShowCollapsed) |
| 2400 | { |
| 2401 | bounds.Width = Mathf.Max(bounds.Width, 1.0f); |
| 2402 | bounds.Height = Mathf.Max(bounds.Height, 1.0f); |
| 2403 | bounds.Location = ApplyUseModeMask(EnablePanning, bounds.Location, _contents.Location); |
| 2404 | bounds.Size = ApplyUseModeMask(EnablePanning, bounds.Size, _contents.Size); |
| 2405 | if (!_contents._isMovingSelection) |
| 2406 | _contents.Bounds = bounds; |
| 2407 | } |
| 2408 | else if (_contents.Bounds == Rectangle.Empty) |
| 2409 | { |
| 2410 | _contents.Bounds = Rectangle.Union(bounds, new Rectangle(Float2.Zero, Float2.One)); |
| 2411 | } |
| 2412 | |
| 2413 | // Offset the keyframes (parent container changed its location) |
nothing calls this directly
no test coverage detected