Bug 497008 - Title Clip: unexpected behavior when resizing ellipse with border width > 0
Summary: Title Clip: unexpected behavior when resizing ellipse with border width > 0
Status: CONFIRMED
Alias: None
Product: kdenlive
Classification: Applications
Component: Title Clips & Subtitles (other bugs)
Version First Reported In: 25.04.1
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Jean-Baptiste Mardelle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-03 19:50 UTC by sideprojectslab
Modified: 2025-06-30 22:00 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sideprojectslab 2024-12-03 19:50:03 UTC
SUMMARY
The behavior of resizing an ellipse in the title clip by dragging one of its sides is erratic.

STEPS TO REPRODUCE
1. open a new project
2. add a title clip
3. add an ellipse and a rectangle of any size
4. resize the rectangle by dragging one of its sides
5. resize the ellipse by dragging one of the side of its container rectangle

OBSERVED RESULT
resizing the ellipse has a completely different behavior than resizing the rectangle. Both dimensions always change when dragging one side of the container rectangle

EXPECTED RESULT
The resizing behavior of rectangle and ellipse should be identical, as when resizing the ellipse, one is in fact resizing its container rectangle. Certainly only one dimension of the ellipse should change and not both.

SOFTWARE/OS VERSIONS
Windows: 11

ADDITIONAL INFORMATION
Comment 1 Ron 2025-06-24 15:38:45 UTC
I cannot reproduce this in the 25.04.2 appimage.

In both cases dragging a side of the bounding box moves just that side of the bounding box and the shape then fills the resulting box.
Comment 2 emohr 2025-06-24 16:21:31 UTC
On Windows 10 with Kdenlive 25.04.2 I cannot reproduce the issue following your steps. Please update to Kdenlive 25.4.2 and try again.
Comment 3 vp.accounts 2025-06-24 17:42:07 UTC
you are correct, there is another crucial step to reproduce, which I didn't notice initially, you have to set the ellipse border to anything higher than zero. The higher the border value the more visible is the effect, try for instance with 14 or something, with 1-2 it is very light. With this extra step I can reproduce on all platforms with 25.04.2
Comment 4 Ron 2025-06-24 18:14:27 UTC
(In reply to vp.accounts from comment #3)
> you are correct, there is another crucial step to reproduce, which I didn't
> notice initially, you have to set the ellipse border to anything higher than
> zero. The higher the border value the more visible is the effect, try for
> instance with 14 or something, with 1-2 it is very light. With this extra
> step I can reproduce on all platforms with 25.04.2

Ok, I can see that.  Something weird is tangled in the math.  Any movement of the mouse (in any direction) while a bounding box border is grabbed causes the orthogonal dimension to grow.  It's probably a mix of recomputing the bound size without the border width then adding the border to that.

Should be reasonably easy to find and fix the next time someone is in that code.

Workaround in the meantime is to size your ellipse without a border, then configure the desired border width as the final step.
Comment 5 emohr 2025-06-24 18:19:53 UTC
Ooh yes, following your steps. The higher the border width value the worse the ellipse behave.
Comment 6 vp.accounts 2025-06-24 21:46:11 UTC
If you can tell me where to find the relevant code I can try to have a look. I suppose I can get it to build on linux without too much effort
Comment 7 Ron 2025-06-25 03:57:58 UTC
(In reply to vp.accounts from comment #6)
> If you can tell me where to find the relevant code I can try to have a look.
> I suppose I can get it to build on linux without too much effort

Start here:
https://invent.kde.org/multimedia/kdenlive
https://community.kde.org/Kdenlive/Development
https://invent.kde.org/multimedia/kdenlive/-/blob/master/dev-docs/build.md

You'll need a reasonably up to date distro to provide the needed versions of Qt/KDE dependencies.
[Debian Trixie (in freeze to be the next stable release) is fine, but Bookworm (current stable release) doesn't have backports of them].
Comment 8 vp.accounts 2025-06-25 21:20:12 UTC
(In reply to Ron from comment #7)
> (In reply to vp.accounts from comment #6)
> > If you can tell me where to find the relevant code I can try to have a look.
> > I suppose I can get it to build on linux without too much effort
> 
> Start here:
> https://invent.kde.org/multimedia/kdenlive
> https://community.kde.org/Kdenlive/Development
> https://invent.kde.org/multimedia/kdenlive/-/blob/master/dev-docs/build.md
> 
> You'll need a reasonably up to date distro to provide the needed versions of
> Qt/KDE dependencies.
> [Debian Trixie (in freeze to be the next stable release) is fine, but
> Bookworm (current stable release) doesn't have backports of them].

Ok, I am using linux mint, I hope that will suffice
Comment 9 vp.accounts 2025-06-27 07:00:33 UTC
Another thing I noticed: if you set the border to any amount BEFORE creating the ellipse, it actually works very well, that's because when the ellipse is create it is grabbed by the corner. Indeed, when the ellipse is very small it is still possible to resize it by the corner and that works exactly as expected. However as the ellipse becomes larger it is not possible to resize it by the corner any longer. It looks like the containing rectangle can only be grabbed if the curve is relatively close to its sides, so as the ellipse grows you can only grab the box very close to the tangent points. So allowing "grab by corner" regardless of how close the curve is to it would probably be a good idea, and would also partially solve the previous issue (though both should probably still be addressed).
Comment 10 vp.accounts 2025-06-29 18:48:36 UTC
I tried to set up the build environment on linux mint 22.1 Cinnamon but I get several warnings and an error:

```
~/Desktop/kdenlive-build$ ./build.sh 
-- Checking for module 'libexif'
--   Package 'libexif', required by 'virtual:world', not found
-- Checking for module 'fontconfig'
--   Package 'fontconfig', required by 'virtual:world', not found
-- Checking for module 'frei0r'
--   Package 'frei0r', required by 'virtual:world', not found
-- Checking for module 'gdk-pixbuf-2.0'
--   Package 'gdk-pixbuf-2.0', required by 'virtual:world', not found
-- Checking for module 'movit'
--   Package 'movit', required by 'virtual:world', not found
CMake Warning at CMakeLists.txt:320 (find_package):
  By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt6", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt6" with any of
  the following names:

    Qt6Config.cmake
    qt6-config.cmake

  Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
  to a directory containing one of the above files.  If "Qt6" provides a
  separate development package or SDK, be sure it has been installed.


CMake Warning at CMakeLists.txt:330 (find_package):
  By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt6", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt6" with any of
  the following names:

    Qt6Config.cmake
    qt6-config.cmake

  Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
  to a directory containing one of the above files.  If "Qt6" provides a
  separate development package or SDK, be sure it has been installed.


-- Checking for module 'spatialaudio'
--   Package 'spatialaudio', required by 'virtual:world', not found
-- Checking for module 'vidstab'
--   Package 'vidstab', required by 'virtual:world', not found
-- Checking for module 'vorbis'
--   Package 'vorbis', required by 'virtual:world', not found
-- Checking for module 'vorbisfile'
--   Package 'vorbisfile', required by 'virtual:world', not found
-- Could NOT find SWIG (missing: SWIG_EXECUTABLE SWIG_DIR) 
-- Could NOT find ClangFormat (missing: CLANGFORMAT_EXECUTABLE CLANGFORMAT_VERSION) (Required is exact version "14")
-- The following features have been enabled:

 * GPLv2
 * GPLv3
 * Module: avformat
 * Module: DeckLink
 * Module: JACKRack
 * Module: Kdenlive
 * Module: Normalize
 * Module: Oldfilm
 * Module: Plus
 * Module: PlusGPL
 * Module: Resample
 * Module: RtAudio
 * Module: Rubberband
 * Module: SDL1
 * Module: SDL2
 * Module: SoX
 * Module: XINE
 * Module: XML

-- The following OPTIONAL packages have been found:

 * JACK
 * OpenGL

-- The following REQUIRED packages have been found:

 * Threads
 * PkgConfig

-- The following features have been disabled:

 * Tests
 * Doxygen
 * Clang Format
 * Module: Frei0r
 * Module: GDK
 * Module: Glaxnimate (Qt5)
 * Module: Glaxnimate (Qt6)
 * Module: NDI
 * Module: OpenCV
 * Module: Movit
 * Module: Qt (Qt5)
 * Module: Qt6
 * Module: SpatialAudio
 * Module: vid.stab
 * Module: Vorbis
 * SWIG: C#
 * SWIG: Java
 * SWIG: Lua
 * SWIG: Node.js
 * SWIG: Perl
 * SWIG: PHP
 * SWIG: Python
 * SWIG: Ruby
 * SWIG: Tcl
 * lv2: LV2 Plugins support
 * vst2: VST2 Plugins support

-- The following OPTIONAL packages have not been found:

 * Qt6
 * SWIG
 * ClangFormat (required version == 14)

-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /home/vpascucci/Desktop/kdenlive-build/mlt/build
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target 'install'.  Stop.
CMake Error at CMakeLists.txt:50 (find_package):
  Could not find a configuration file for package "ECM" that is compatible
  with requested version "6.3.0".

  The following configuration files were considered but not accepted:

    /usr/share/ECM/cmake/ECMConfig.cmake, version: 5.115.0



-- Configuring incomplete, errors occurred!

```

Any idea what I might be doing wrong?
Comment 11 vp.accounts 2025-06-29 18:52:26 UTC
Also when installing the dependencies I get these errors (I wasn't able to install the kdenlive PPA as it returned an error saying it doesn't support "noble"):

E: Unable to locate package kf6-breeze-icon-theme
E: Unable to locate package libkf6archive-dev
E: Unable to locate package libkf6bookmarks-dev
E: Unable to locate package libkf6codecs-dev
E: Unable to locate package libkf6config-dev
E: Unable to locate package libkf6configwidgets-dev
E: Unable to locate package libkf6coreaddons-dev
E: Unable to locate package libkf6crash-dev
E: Unable to locate package libkf6dbusaddons-dev
E: Unable to locate package libkf6doctools-dev
E: Unable to locate package libkf6filemetadata-dev
E: Unable to locate package libkf6guiaddons-dev
E: Unable to locate package libkf6iconthemes-dev
E: Unable to locate package libkf6kio-dev
E: Unable to locate package libkf6newstuff-dev
E: Unable to locate package libkf6notifications-dev
E: Unable to locate package libkf6notifyconfig-dev
E: Unable to locate package libkf6purpose-dev
E: Unable to locate package libkf6solid-dev
E: Unable to locate package libkf6textwidgets-dev
E: Unable to locate package libkf6widgetsaddons-dev
E: Unable to locate package libkf6xmlgui-dev
Comment 12 vp.accounts 2025-06-30 08:58:49 UTC
Ok never mind I was able to build on Linux with craft. Now I guess my silly question is: how do I edit the source code and rebuild with craft bringing in my changes? I see that I can select a branch but does that mean I should branch the git repo? or point craft to my own fork of the project? And if so how?

Second: Could anyone roughly point me to where the code for drawing ellipses in the title screen is?
Comment 13 vp.accounts 2025-06-30 16:54:01 UTC
double-triple-quadruple posting to say that I'm finally there, I can make changes and build on linux, now I can start investigating, still though if you have any tips please do share them
Comment 14 vp.accounts 2025-06-30 22:00:53 UTC
Ok so the bulk of the issue is in graphicsscenerectmove.cpp around line 890 and line 990, I think it is important to set both "r1" and  "newrect" as the rect() of ellipses too and not the boundingrect(), and indeed doing that fixes the problem from what I can tell. Will you pick this one up or should I make a PR on gitlab?

This doesn't yet solve the issue of not being able to resize ellipses by the corner. Any advice for that?