[PreviewPane]Fix location and scaling issues with different DPI (#31802)

* [PreviewPane] Monaco Previewer: await initial position, size update + use recieved coordinates

* Fixing size and position issue for all file explorer previewers
This commit is contained in:
Laszlo Nemeth
2024-03-20 15:28:43 +01:00
committed by GitHub
parent f5797a065a
commit 58e598815c
13 changed files with 85 additions and 15 deletions

View File

@@ -129,6 +129,12 @@ IFACEMETHODIMP GcodePreviewHandler::SetRect(const RECT* prc)
HRESULT hr = E_INVALIDARG;
if (prc != NULL)
{
if (m_rcParent.left == 0 && m_rcParent.top == 0 && m_rcParent.right == 0 && m_rcParent.bottom == 0 && (prc->left != 0 || prc->top != 0 || prc->right != 0 || prc->bottom != 0))
{
// GcodePreviewHandler position first initialisation, do the first preview
m_rcParent = *prc;
DoPreview();
}
if (!m_resizeEvent)
{
Logger::error(L"Failed to create resize event for GcodePreviewHandler");
@@ -153,6 +159,11 @@ IFACEMETHODIMP GcodePreviewHandler::DoPreview()
{
try
{
if (m_rcParent.left == 0 && m_rcParent.top == 0 && m_rcParent.right == 0 && m_rcParent.bottom == 0)
{
// Postponing Start GcodePreviewHandler.exe, position not yet initialized. preview will be done after initialisation
return S_OK;
}
Logger::info(L"Starting GcodePreviewHandler.exe");
STARTUPINFO info = { sizeof(info) };