Made parts deselectable

This commit is contained in:
andreja6
2018-10-23 15:15:08 -07:00
parent 8909ded488
commit 421498e1fe
3 changed files with 20 additions and 5 deletions

View File

@@ -75,7 +75,7 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
_propGrid = New_PropertyGrid(_hwndProp,IDC_PROPERTYGRID);
PROPGRIDITEM pItem;
/*PROPGRIDITEM pItem;
PropGrid_ItemInit(pItem);
pItem.lpszCatalog="Test";
@@ -109,8 +109,8 @@ bool PropertyWindow::onCreate(int x, int y, int sx, int sy, HMODULE hThisInstanc
PropGrid_Enable(_propGrid,true);
ShowWindow(_propGrid,SW_SHOW);
PropGrid_AddItem(_propGrid,&pItem);
PropGrid_AddItem(_propGrid,&pItem2);
// PropGrid_AddItem(_propGrid,&pItem);
// PropGrid_AddItem(_propGrid,&pItem2);
PropGrid_SetItemHeight(_propGrid,20);
PropGrid_ShowToolTips(_propGrid,TRUE);
PropGrid_ShowPropertyDescriptions(_propGrid,TRUE);
@@ -154,4 +154,9 @@ void PropertyWindow::SetProperties(Instance * instance)
PropGrid_ExpandAllCatalogs(_propGrid);
SetWindowLongPtr(_propGrid,GWL_USERDATA,(LONG)this);
_redraw();
}
void PropertyWindow::ClearProperties()
{
PropGrid_ResetContent(_propGrid);
}

View File

@@ -5,6 +5,7 @@ public:
PropertyWindow(int x, int y, int sx, int sy, HMODULE hThisInstance);
bool onCreate(int x, int y, int sx, int sy, HMODULE hThisInstance);
void SetProperties(Instance *);
void ClearProperties();
void onResize();
HWND _hwndProp;

View File

@@ -1262,13 +1262,16 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
float nearest=std::numeric_limits<float>::infinity();
Vector3 camPos = cameraController.getCamera()->getCoordinateFrame().translation;
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
for(size_t i = 0; i < instances.size(); i++)
bool objFound = false;
for(size_t i = 0; i < instances.size(); i++)
{
if(PhysicalInstance* test = dynamic_cast<PhysicalInstance*>(instances.at(i)))
{
float time = testRay.intersectionTime(test->getBox());
if (time != inf())
{
objFound = true;
if (nearest>time)
{
nearest=time;
@@ -1295,7 +1298,13 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
//dragging = true;
}
}
}
}
}
if(!objFound)
{
while(selectedInstances.size() > 0)
selectedInstances.erase(selectedInstances.begin());
_propWindow->ClearProperties();
}
}
}