Bug 452679 - Zoom position wrong if razor tool is active
Summary: Zoom position wrong if razor tool is active
Status: NEEDSINFO WAITINGFORINFO
Alias: None
Product: kdenlive
Classification: Applications
Component: User Interface & Miscellaneous (other bugs)
Version First Reported In: git-master
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Jean-Baptiste Mardelle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-16 15:12 UTC by MKich@gmx.at
Modified: 2026-02-05 08:01 UTC (History)
2 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 MKich@gmx.at 2022-04-16 15:12:02 UTC
SUMMARY
When Changing the Zoom Level of the Timeline using the scroll wheel the centered position changes if currently the razor tool is active.


STEPS TO REPRODUCE
1. Open a project containing some clips (doesn't matter how much, they need to be long enough that you can scroll horizontally
2. Place the cursor somewhere (as location reference)
3. Move the mouse on top of a clip and to a location that you can easily remember e.g. the cursor
3. Select the razor tool using Hotkeys
4. Zoom in or out using the mouse wheel (at least twice)

OBSERVED RESULT
The cursor moves away from the mouse

EXPECTED RESULT
The position below the mouse should stay the same

SOFTWARE/OS VERSIONS
Kdenlive: 22.07.70 (rev. 7b7c568ba)
Package Type: Unknown/Default
MLT: 7.7.0
Qt: 5.12.8 (built against 5.12.8 x86_64-little_endian-lp64)
Frameworks: 5.68.0
System: Ubuntu 20.04.4 LTS
Kernel: linux 5.8.0-63-generic
CPU: x86_64
Windowing System: xcb
Movit (GPU): disabled
Track Compositing: frei0r.cairoblend

ADDITIONAL INFORMATION
This is most likely a duplicate of https://bugs.kde.org/show_bug.cgi?id=423955 but this has been closed due to missing information

I also did some digging:

During zooming with the mouse wheel the centered Position (gathered from src/timeline2/view/TimelineController::getMousePos()) should be constant. This part works, but the current mouse position is wrong.
This wrong information originates from src/timeline2/view/qml/timeline.qml:getMousePos() ~Line 229 . Here the values gathered from the dragProxy are wrong.
Those values are beeing updated inside src/timeline2/view/qml/Clip.qml:onPositionChanged ~Line 352
Those updates do not happen, because the razor disables the MouseArea

Based on my understanding there shouldn't be dragging active if the razor tool is active. Thus ending the dragging if the tool is changed fixed that bug:

diff --git a/src/timeline2/view/timelinewidget.cpp b/src/timeline2/view/timelinewidget.cpp
index 510cd39fa..e9cf22b85 100644
--- a/src/timeline2/view/timelinewidget.cpp
+++ b/src/timeline2/view/timelinewidget.cpp
@@ -410,6 +410,7 @@ void TimelineWidget::zoneUpdatedWithUndo(const QPoint &oldZone, const QPoint &ne
 
 void TimelineWidget::setTool(ToolType::ProjectTool tool)
 {
+    QMetaObject::invokeMethod(rootObject(), "endDrag", Qt::DirectConnection);
     rootObject()->setProperty("activeTool", int(tool));
 }
 
Tests seem to be unaffected by those changes
Comment 1 luzpaz 2026-01-27 02:29:11 UTC
This needs to be retested on latest stable. I tried but I'm not sure if I understand the bug.
Comment 2 MKich@gmx.at 2026-02-05 08:01:31 UTC
Both bug reports describe the problem quite good. I dont know how to describe it better.
The code internally contains some kind of memory variable to remember what position should stay the same during zooming. This variable was not updated correctly

I don't really use kdenlive any more. I tried to reproduce it, but I was unable to do so. Maybe the bug got fixed in the meantime. This is the version that I tested:
Kdenlive: 25.12.1
Kdenlive
MLT: 7.37.0
FFmpeg
KDE Frameworks: 6.22.0
Qt: 6.9.3 wird verwendet und gebaut wurde mit 6.9.3
Flatpak
KDE Flatpak runtime (Wayland)
Build ABI: x86_64-little_endian-lp64
Kernel: linux 6.8.0-52-generic