[Panorama Viewer] add mouse speed multiplier

This commit is contained in:
Landrodie 2021-01-26 21:18:43 +01:00 committed by Fabien Castan
parent b66a19d01e
commit dadb875484
4 changed files with 44 additions and 5 deletions

View file

@ -21,6 +21,8 @@ FloatingPane {
property int subdivisionsDefaultValue: 12
property int subdivisionsValue: subdivisionsCtrl.value
property int mouseSpeed: speedSpinBox.value
background: Rectangle { color: root.palette.window }
DoubleValidator {
@ -100,11 +102,43 @@ FloatingPane {
stepSize: 2
}
}
//Fill rectangle to have a better UI
Rectangle{
color: root.palette.window
Layout.fillWidth: true
}
RowLayout{
ToolButton {
text: "Edit Speed"
ToolTip.visible: ToolTip.text && hovered
ToolTip.delay: 100
ToolTip.text: "Reset the mouse multiplier"
onClicked: {
speedSpinBox.value = 1;
}
}
SpinBox {
id: speedSpinBox
from: 1
value: 1
to: 10
stepSize: 1
Layout.fillWidth: false
Layout.maximumWidth: 50
validator: DoubleValidator {
bottom: Math.min(speedSpinBox.from, speedSpinBox.to)
top: Math.max(speedSpinBox.from, speedSpinBox.to)
}
textFromValue: function(value, locale) {
return "x" + value.toString()
}
}
}
RowLayout{
ToolButton {
text: "Downscale"
@ -124,6 +158,7 @@ FloatingPane {
to: 3
stepSize: 1
Layout.fillWidth: false
Layout.maximumWidth: 50
validator: DoubleValidator {

View file

@ -29,6 +29,8 @@ AliceVision.PanoramaViewer {
property bool displayGridPano: true
property int mouseMultiplier: 1
onIsHighlightableChanged:{
for (var i = 0; i < repeater.model; i++) {
repeater.itemAt(i).item.onChangedHighlightState(isHighlightable);
@ -82,7 +84,7 @@ AliceVision.PanoramaViewer {
lastX = mouse.x;
lastY = mouse.y;
for (var i = 0; i < repeater.model; i++) {
repeater.itemAt(i).item.rotatePanorama(xoffset * 0.001, yoffset*0.001)
repeater.itemAt(i).item.rotatePanorama(xoffset * 0.001 * mouseMultiplier, -yoffset * 0.001 * mouseMultiplier)
}
}
}
@ -213,6 +215,7 @@ AliceVision.PanoramaViewer {
root.status = Image.Ready;
}
}
function updateRepeater() {
if(repeater.model !== root.pathList.length){
repeater.model = 0;

View file

@ -266,7 +266,8 @@ FocusScope {
'isHighlightable': Qt.binding(function(){ return panoramaViewerToolbar.enableHover;}),
'downscaleValue': Qt.binding(function(){return panoramaViewerToolbar.downscaleValue;}),
'subdivisionsPano': Qt.binding(function(){ return panoramaViewerToolbar.subdivisionsValue;}),
'displayGridPano': Qt.binding(function(){ return panoramaViewerToolbar.displayGrid;})
'displayGridPano': Qt.binding(function(){ return panoramaViewerToolbar.displayGrid;}),
'mouseMultiplier': Qt.binding(function(){ return panoramaViewerToolbar.mouseSpeed;})
})
} else {
// Force the unload (instead of using Component.onCompleted to load it once and for all) is necessary since Qt 5.14

View file

@ -123,7 +123,7 @@ Item {
id: displayImagePathAction
text: "Display Image Path"
checkable: true
checked: true
checked: true && !viewer2D.usePanoramaViewer
}
}
}