mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-02-18 15:04:53 -05:00
UI: Fix 0,0 size transform bug when resizing sources
Fix a bug where if a source's width or height becomes 0 while you're stretching the size of a source or modifying it from the transform dialog, it would become permanently invisible Closes obsproject/obs-studio#7962
This commit is contained in:
@@ -1492,9 +1492,17 @@ void OBSBasicPreview::StretchItem(const vec2 &pos)
|
||||
|
||||
obs_source_t *source = obs_sceneitem_get_source(stretchItem);
|
||||
|
||||
uint32_t source_cx = obs_source_get_width(source);
|
||||
uint32_t source_cy = obs_source_get_height(source);
|
||||
|
||||
/* if the source's internal size has been set to 0 for whatever reason
|
||||
* while resizing, do not update transform, otherwise source will be
|
||||
* stuck invisible until a complete transform reset */
|
||||
if (!source_cx || !source_cy)
|
||||
return;
|
||||
|
||||
vec2 baseSize;
|
||||
vec2_set(&baseSize, float(obs_source_get_width(source)),
|
||||
float(obs_source_get_height(source)));
|
||||
vec2_set(&baseSize, float(source_cx), float(source_cy));
|
||||
|
||||
vec2 size;
|
||||
vec2_set(&size, br.x - tl.x, br.y - tl.y);
|
||||
|
||||
Reference in New Issue
Block a user