[multimedia/kdenlive/release/26.08] src/monitor/view: Fix transform resize with side hanles and forced ratio
Jean-Baptiste Mardelle <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 5098886f6d1282eb3e60345b915ff29aceb9e1ba by Jean-Baptiste Mardelle.
Committed on 31/07/2026 at 14:48.
Pushed by mardelle into branch 'release/26.08'.
Fix transform resize with side hanles and forced ratio
BUG: 516921
FIXED-IN: 26.08.0
M +35 -14 src/monitor/view/ResizeLogic.js
https://invent.kde.org/multimedia/kdenlive/-/commit/5098886f6d1282eb3e60345b915ff29aceb9e1ba
diff --git a/src/monitor/view/ResizeLogic.js b/src/monitor/view/ResizeLogic.js
index aa1da275be..cf8eca5f42 100644
--- a/src/monitor/view/ResizeLogic.js
+++ b/src/monitor/view/ResizeLogic.js
@@ -222,36 +222,57 @@ function _calculateResize(handleType, scaledDeltaX, scaledDeltaY, frameSize, loc
}
}
+ // For aspect ratio with edge handles, center the unchanged dimension
+ let sideForceRescale = 0
+ if ((lockRatio > 0 || modifiers & Qt.ShiftModifier) && !_isCornerHandle(handleType)) {
+ sideForceRescale = 1
+ if (_affectsX(handleType) && Math.abs(effectiveY) > 0) {
+ // X handle changed Y: center vertically
+ if (xDirection < 0) {
+ adjustedFrame.height = Math.max(1, frameSize.height - effectiveY)
+ adjustedFrame.y = frameSize.y + (frameSize.height - adjustedFrame.height) / 2
+ } else {
+ adjustedFrame.height = Math.max(1, frameSize.height + effectiveY)
+ }
+ } else if (_affectsY(handleType) && Math.abs(effectiveX) > 0) {
+ // Y handle changed X: center horizontally
+ if (yDirection < 0) {
+ adjustedFrame.width = Math.max(1, frameSize.width - effectiveX)
+ adjustedFrame.x = frameSize.x + (frameSize.width - adjustedFrame.width) / 2
+ } else {
+ adjustedFrame.width = Math.max(1, frameSize.width + effectiveX)
+ }
+ }
+ }
+
// center-based scaling (Ctrl modifier)
if (modifiers & Qt.ControlModifier) {
+ if (sideForceRescale === 1) {
+ // No resize, just center
+ let xDelta = (adjustedFrame.width - frameSize.width) / 2
+ let yDelta = (adjustedFrame.height - frameSize.height) / 2
+ adjustedFrame.x = frameSize.x - xDelta
+ adjustedFrame.y = frameSize.y - yDelta
+ return adjustedFrame
+ }
+
if (_affectsX(handleType)) {
// Right handles: rightward movement expands both sides
// Left handles: rightward movement shrinks both sides
- var xDelta = effectiveX * xDirection
+ let xDelta = effectiveX * xDirection
adjustedFrame.width = Math.max(1, frameSize.width + 2 * xDelta)
adjustedFrame.x = frameSize.x - xDelta
}
-
+
if (_affectsY(handleType)) {
// Bottom handles: downward movement expands both sides
// Top handles: downward movement shrinks both sides
- var yDelta = effectiveY * yDirection
+ let yDelta = effectiveY * yDirection
adjustedFrame.height = Math.max(1, frameSize.height + 2 * yDelta)
adjustedFrame.y = frameSize.y - yDelta
}
}
- // For aspect ratio with edge handles, center the unchanged dimension
- if ((lockRatio > 0 || modifiers & Qt.ShiftModifier) && !_isCornerHandle(handleType)) {
- if (_affectsX(handleType) && Math.abs(effectiveY) > 0) {
- // X handle changed Y: center vertically
- adjustedFrame.y = frameSize.y + (frameSize.height - adjustedFrame.height) / 2
- } else if (_affectsY(handleType) && Math.abs(effectiveX) > 0) {
- // Y handle changed X: center horizontally
- adjustedFrame.x = frameSize.x + (frameSize.width - adjustedFrame.width) / 2
- }
- }
-
return adjustedFrame
}