Fixes issue where you can scroll in the preview

This commit is contained in:
2024-10-16 10:03:33 -04:00
parent 603732232c
commit 0c3d82334b
2 changed files with 10 additions and 3 deletions

View File

@@ -113,6 +113,9 @@ namespace fgl::engine::gui
else
name = camera.getName();
ImGui::PushStyleVar( ImGuiStyleVar_ChildBorderSize, 0.0f );
ImGui::PushStyleVar( ImGuiStyleVar_WindowPadding, ImVec2( 0.0f, 0.0f ) );
ImGui::Begin(
name.c_str(),
nullptr,
@@ -127,6 +130,8 @@ namespace fgl::engine::gui
drawRenderingOutputs( info, camera );
ImGui::End();
ImGui::PopStyleVar( 2 );
}
}

View File

@@ -5,13 +5,13 @@
#include "preview.hpp"
#include "engine/FrameInfo.hpp"
#include "engine/assets/model/Model.hpp"
#include "engine/assets/model/builders/SceneBuilder.hpp"
#include "engine/camera/Camera.hpp"
#include "engine/camera/CameraSwapchain.hpp"
#include "engine/filesystem/scanner/FileScanner.hpp"
#include "engine/filesystem/types.hpp"
#include "engine/gameobjects/components/ModelComponent.hpp"
#include "engine/assets/model/Model.hpp"
#include "engine/assets/model/builders/SceneBuilder.hpp"
#include "engine/rendering/SwapChain.hpp"
#include "engine/tree/octtree/OctTreeNode.hpp"
#include "safe_include.hpp"
@@ -178,7 +178,9 @@ namespace fgl::engine::gui
drawConfigBar( info, camera, frame_index, current );
const float ratio { camera.aspectRatio() };
const auto imgui_size { ImGui::GetWindowSize() };
auto imgui_size { ImGui::GetWindowSize() };
imgui_size.x -= 8;
const auto target_size { calculateTargetSize( ratio, imgui_size ) };
if ( hotkeys_enabled && ImGui::IsWindowFocused() && ImGui::IsKeyDown( ImGuiKey_LeftAlt ) )