UI: Allow centering/stretching for groups items

master
jp9000 2018-08-16 12:42:23 -07:00
parent 448399d5ea
commit 90327563e8
1 changed files with 33 additions and 31 deletions

View File

@ -5677,6 +5677,9 @@ static bool CenterAlignSelectedItems(obs_scene_t *scene, obs_sceneitem_t *item,
{
obs_bounds_type boundsType = *reinterpret_cast<obs_bounds_type*>(param);
if (obs_sceneitem_is_group(item))
obs_sceneitem_group_enum_items(item, CenterAlignSelectedItems,
param);
if (!obs_sceneitem_selected(item))
return true;
@ -5714,13 +5717,13 @@ void OBSBasic::on_actionStretchToScreen_triggered()
&boundsType);
}
void OBSBasic::on_actionCenterToScreen_triggered()
static bool center_to_scene(obs_scene_t *, obs_sceneitem_t *item, void *)
{
auto func = [] (obs_scene_t *scene, obs_sceneitem_t *item, void *param)
{
vec3 tl, br, itemCenter, screenCenter, offset;
obs_video_info ovi;
if (obs_sceneitem_is_group(item))
obs_sceneitem_group_enum_items(item, center_to_scene, nullptr);
if (!obs_sceneitem_selected(item))
return true;
@ -5740,13 +5743,12 @@ void OBSBasic::on_actionCenterToScreen_triggered()
vec3_add(&tl, &tl, &offset);
SetItemTL(item, tl);
UNUSED_PARAMETER(scene);
UNUSED_PARAMETER(param);
return true;
};
};
obs_scene_enum_items(GetCurrentScene(), func, nullptr);
void OBSBasic::on_actionCenterToScreen_triggered()
{
obs_scene_enum_items(GetCurrentScene(), center_to_scene, nullptr);
}
void OBSBasic::EnablePreviewDisplay(bool enable)