UI: Show spacing helpers in preview

This shows distance between sides of preview and edges of sources.
This will allow users to more easily align sources.

Co-authored-by: Palakis <contact@slepin.fr>
This commit is contained in:
Clayton Groeneveld
2021-11-01 02:16:56 -05:00
committed by Jim
parent 728d919bde
commit 2d6a9c9cc1
8 changed files with 339 additions and 0 deletions

View File

@@ -469,6 +469,7 @@ OBSBasic::OBSBasic(QWidget *parent)
&OBSBasic::BroadcastButtonClicked);
UpdatePreviewSafeAreas();
UpdatePreviewSpacingHelpers();
}
static void SaveAudioDevice(const char *name, int channel, obs_data_t *parent,
@@ -4246,6 +4247,9 @@ void OBSBasic::RenderMain(void *data, uint32_t cx, uint32_t cy)
RenderSafeAreas(window->rightLine, targetCX, targetCY);
}
if (window->drawSpacingHelpers)
window->ui->preview->DrawSpacingHelpers();
/* --------------------------------------- */
gs_projection_pop();
@@ -10177,3 +10181,9 @@ QColor OBSBasic::GetHoverColor() const
return QColor::fromRgb(0, 127, 255);
}
}
void OBSBasic::UpdatePreviewSpacingHelpers()
{
drawSpacingHelpers = config_get_bool(
App()->GlobalConfig(), "BasicWindow", "SpacingHelpersEnabled");
}