From 987246a806077bdadb4ff72bceb4d128fba7639e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Wed, 2 Aug 2023 14:02:55 +0200 Subject: [PATCH] Asset Drag'n'Drop preview --- GlitchyEditor/src/Assets/AssetHierarchy.bf | 4 ++-- GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/GlitchyEditor/src/Assets/AssetHierarchy.bf b/GlitchyEditor/src/Assets/AssetHierarchy.bf index 44e1701..7f3fc1b 100644 --- a/GlitchyEditor/src/Assets/AssetHierarchy.bf +++ b/GlitchyEditor/src/Assets/AssetHierarchy.bf @@ -228,8 +228,8 @@ class AssetHierarchy { if (File.Exists(fileToMove->AssetFile.AssetConfigPath)) { - String newConfigPathName = scope .(newPathName); - newConfigPathName.Append(AssetFile.ConfigFileExtension); + String newConfigPathName = scope .(newPathName); + newConfigPathName.Append(AssetFile.ConfigFileExtension); if (File.Move(fileToMove->AssetFile.AssetConfigPath, newConfigPathName) case .Err(let error)) { diff --git a/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf b/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf index d56a098..9f499a0 100644 --- a/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf +++ b/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf @@ -490,6 +490,16 @@ namespace GlitchyEditor.EditWindows { ImGui.SetDragDropPayload(.ContentBrowserItem, entry->Identifier, (uint64)entry->Identifier.Length, .Once); + float2 dndIconSize = (ImGui.GetFontSize() * 2.0f).XX; + + ImGui.Image(image, (.)dndIconSize); + + ImGui.SameLine(); + + ImGui.SetCursorPosY((dndIconSize.X - ImGui.GetFontSize()) / 2); + + ImGui.Text(entry->Identifier); + ImGui.EndDragDropSource(); }