UI: Add Crop to Bounds checkbox to transform dialog

This commit is contained in:
derrod
2023-11-18 12:41:54 +01:00
committed by Lain
parent 7e456d9dea
commit 09024e9c74
3 changed files with 18 additions and 2 deletions

View File

@@ -71,6 +71,8 @@ OBSBasicTransform::OBSBasicTransform(OBSSceneItem item, OBSBasic *parent)
&OBSBasicTransform::OnCropChanged);
HookWidget(ui->cropBottom, ISCROLL_CHANGED,
&OBSBasicTransform::OnCropChanged);
HookWidget(ui->cropToBounds, &QCheckBox::stateChanged,
&OBSBasicTransform::OnControlChanged);
ui->buttonBox->button(QDialogButtonBox::Close)->setDefault(true);
@@ -297,6 +299,7 @@ void OBSBasicTransform::RefreshControls()
ui->boundsAlign->setCurrentIndex(boundsAlignIndex);
ui->boundsWidth->setValue(osi.bounds.x);
ui->boundsHeight->setValue(osi.bounds.y);
ui->cropToBounds->setChecked(osi.crop_to_bounds);
ui->cropLeft->setValue(int(crop.left));
ui->cropRight->setValue(int(crop.right));
@@ -319,6 +322,7 @@ void OBSBasicTransform::OnBoundsType(int index)
ui->boundsAlign->setEnabled(enable);
ui->boundsWidth->setEnabled(enable);
ui->boundsHeight->setEnabled(enable);
ui->cropToBounds->setEnabled(enable);
if (!ignoreItemChange) {
obs_bounds_type lastType = obs_sceneitem_get_bounds_type(item);
@@ -364,6 +368,7 @@ void OBSBasicTransform::OnControlChanged()
oti.bounds_alignment = listToAlign[ui->boundsAlign->currentIndex()];
oti.bounds.x = float(ui->boundsWidth->value());
oti.bounds.y = float(ui->boundsHeight->value());
oti.crop_to_bounds = ui->cropToBounds->isChecked();
ignoreTransformSignal = true;
obs_sceneitem_set_info(item, &oti);