Opens the specified editor window (shows it with editor options handling for new windows). The window.
(EditorWindow window)
| 696 | /// </summary> |
| 697 | /// <param name="window">The window.</param> |
| 698 | public void Open(EditorWindow window) |
| 699 | { |
| 700 | var newLocation = (DockState)Editor.Options.Options.Interface.NewWindowLocation; |
| 701 | if (newLocation == DockState.Float) |
| 702 | { |
| 703 | // Check if there is a floating window that has the same size |
| 704 | var dpi = (float)Platform.Dpi / 96.0f; |
| 705 | #if PLATFORM_MAC && !PLATFORM_SDL |
| 706 | dpi = 1.0f; // TODO: refactor DPI support on macOS to skip such hacks |
| 707 | #endif |
| 708 | var dpiScale = Platform.CustomDpiScale; |
| 709 | var defaultSize = window.DefaultSize * dpi; |
| 710 | for (var i = 0; i < Editor.UI.MasterPanel.FloatingPanels.Count; i++) |
| 711 | { |
| 712 | var win = Editor.UI.MasterPanel.FloatingPanels[i]; |
| 713 | if (Float2.Abs(win.Size - defaultSize).LengthSquared < 100) |
| 714 | { |
| 715 | window.Show(DockState.DockFill, win); |
| 716 | window.Focus(); |
| 717 | return; |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | window.ShowFloating(defaultSize * dpiScale); |
| 722 | } |
| 723 | else |
| 724 | { |
| 725 | window.Show(newLocation); |
| 726 | } |
| 727 | } |
| 728 | |
| 729 | /// <summary> |
| 730 | /// Gets <see cref="EditorWindow"/> that is represented by the given serialized typename. Used to restore workspace layout. |
no test coverage detected