Commit 8300b049 authored by luyikei's avatar luyikei

Timeline: Fix wrong calculation of the scale

parent df900df3
......@@ -64,6 +64,9 @@ Rectangle {
}
onXChanged: {
if ( sView.width - initPosOfCursor < width )
return;
if ( sView.flickableItem.contentX + sView.width <
x + width + initPosOfCursor + sView.sViewPadding )
Drag.hotSpot.x = 0;
......
......@@ -270,11 +270,11 @@ Rectangle {
if ( newUnit < mUnit ) {
newPpu /= ratio; // Restore the original scale.
newPpu *= mUnit / newPpu;
newPpu *= mUnit / newUnit;
newUnit = mUnit;
}
// Make unit a multiple of fps.
// Make unit a multiple of 1 / fps.
newPpu *= ( newUnit - ( newUnit % mUnit ) ) / newUnit;
newUnit -= newUnit % mUnit;
......@@ -291,10 +291,9 @@ Rectangle {
if ( newContentX >= 0 && sView.flickableItem.contentWidth - newContentX > sView.width )
sView.flickableItem.contentX = newContentX;
if ( ratio > 1 )
scale++;
else
scale--;
scale = Math.floor( Math.log( newUnit / mUnit ) / Math.log( 2 ) - 1 );
scale = Math.min( 9, scale );
scale = Math.max( 0, scale );
mainwindow.setScale( scale );
}
......@@ -511,12 +510,14 @@ Rectangle {
if ( event.key === Qt.Key_Delete ) {
removeSelectedClipsDialog.visible = true;
}
else if ( event.key === Qt.Key_Plus && event.modifiers & Qt.ControlModifier )
{
else if ( event.key === Qt.Key_Plus &&
event.modifiers & Qt.ControlModifier
&& scale > 0 ) {
zoomIn( 2 );
}
else if ( event.key === Qt.Key_Minus && event.modifiers & Qt.ControlModifier )
{
else if ( event.key === Qt.Key_Minus &&
event.modifiers & Qt.ControlModifier &&
scale < 9 ) {
zoomIn( 0.5 );
}
event.accepted = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment