mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-17 05:57:11 -04:00
UI: Add ability to lock preview
Adds the ability to lock the preview so sources can't be edited. This feature is typically used in the case where the user wants to prevent accidentally clicking and dragging on sources.
This commit is contained in:
@@ -379,6 +379,11 @@ void OBSBasicPreview::GetStretchHandleData(const vec2 &pos)
|
||||
|
||||
void OBSBasicPreview::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (locked) {
|
||||
OBSQTDisplay::mousePressEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
|
||||
float pixelRatio = main->devicePixelRatio();
|
||||
float x = float(event->x()) - main->previewX / pixelRatio;
|
||||
@@ -451,6 +456,11 @@ void OBSBasicPreview::ProcessClick(const vec2 &pos)
|
||||
|
||||
void OBSBasicPreview::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (locked) {
|
||||
OBSQTDisplay::mouseReleaseEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mouseDown) {
|
||||
vec2 pos = GetMouseEventPos(event);
|
||||
|
||||
@@ -941,6 +951,9 @@ void OBSBasicPreview::StretchItem(const vec2 &pos)
|
||||
|
||||
void OBSBasicPreview::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (locked)
|
||||
return;
|
||||
|
||||
if (mouseDown) {
|
||||
vec2 pos = GetMouseEventPos(event);
|
||||
|
||||
@@ -1076,6 +1089,9 @@ bool OBSBasicPreview::DrawSelectedItem(obs_scene_t *scene,
|
||||
|
||||
void OBSBasicPreview::DrawSceneEditing()
|
||||
{
|
||||
if (locked)
|
||||
return;
|
||||
|
||||
OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
|
||||
|
||||
gs_effect_t *solid = obs_get_base_effect(OBS_EFFECT_SOLID);
|
||||
|
||||
Reference in New Issue
Block a user