ToggleButton fix

This commit is contained in:
maverickdgg 2023-01-09 09:56:46 +08:00
parent e89b6f5c4c
commit 88491ffbd8
2 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,3 @@
Name: UI Test
ID: 96041206
ID: 88543249
Type: 5

View File

@ -161,7 +161,9 @@ namespace SHADE
windowSize = SHEditorWindowManager::GetEditorWindow<SHEditorViewport>()->windowSize;
mousePos = SHEditorWindowManager::GetEditorWindow<SHEditorViewport>()->viewportMousePos;
//mousePos.y = windowSize.y - mousePos.y;
SHLOG_INFO("mouse pos: {}, {}", mousePos.x, mousePos.y)
mousePos /= windowSize;
SHLOG_INFO("mouse pos normalized: {}, {}", mousePos.x, mousePos.y)
#endif
SHVec2 camSize{ cameraSystem->GetCameraWidthHeight(0)};
@ -169,6 +171,7 @@ namespace SHADE
topExtent = CanvasToScreenPoint(topExtent);
btmExtent = CanvasToScreenPoint(btmExtent);
//SHLOG_INFO("TopExtent: {}, {} Btm Extent: {}, {}", topExtent.x, topExtent.y, btmExtent.x, btmExtent.y)
topExtent /= camSize;
btmExtent /= camSize;
@ -210,8 +213,9 @@ namespace SHADE
auto cameraSystem = SHSystemManager::GetSystem<SHCameraSystem>();
auto uiComp = SHComponentManager::GetComponent<SHUIComponent>(comp.GetEID());
SHVec4 topExtent4 = uiComp->GetMatrix() * SHVec4(-comp.size.x * 0.5f, comp.size.y * 0.5f, 0.0f, 1.0f);
SHVec4 btmExtent4 = uiComp->GetMatrix() * SHVec4(comp.size.x * 0.5f, -comp.size.y * 0.5f, 0.0f, 1.0f);
SHVec4 topExtent4 = SHMatrix::Translate(-comp.size.x * 0.5f, comp.size.y * 0.5f, 0.0f) * uiComp->GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
SHVec4 btmExtent4 = SHMatrix::Translate(comp.size.x * 0.5f, -comp.size.y * 0.5f, 0.0f) * uiComp->GetMatrix() * SHVec4(0.0f, 0.0f, 0.0f, 1.0f);
SHVec2 topExtent{ topExtent4.x,topExtent4.y };
SHVec2 btmExtent{ btmExtent4.x,btmExtent4.y };