diff --git a/linphone-app/ui/modules/Common/Helpers/DragBox.qml b/linphone-app/ui/modules/Common/Helpers/DragBox.qml index 0b3ade33a..dea4198c7 100644 --- a/linphone-app/ui/modules/Common/Helpers/DragBox.qml +++ b/linphone-app/ui/modules/Common/Helpers/DragBox.qml @@ -19,6 +19,7 @@ Item { // --------------------------------------------------------------------------- + signal clicked (var mouse) signal pressed (var mouse) signal released (var mouse) signal wheel (var wheel) @@ -57,7 +58,20 @@ Item { _mouseArea = null } } + function updateBoundaries(){ + var container = dragBox.container + if (parent.x < 0) { + parent.x = 0 + } else if (parent.x + parent.width >= container.width) { + parent.x = container.width - parent.width + } + if (parent.y < 0) { + parent.y = 0 + } else if (parent.y + parent.height >= container.height) { + parent.y = container.height - parent.height + } + } // --------------------------------------------------------------------------- Component.onCompleted: enabled && _create() @@ -81,11 +95,13 @@ Item { anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + drag { axis: Drag.XandYAxis target: parent } - + onClicked:dragBox.clicked(mouse) onPressed: { dragBox.pressed(mouse) held = true @@ -94,20 +110,7 @@ Item { onReleased: { dragBox.released(mouse) held = false - - var container = dragBox.container - - if (parent.x < 0) { - parent.x = 0 - } else if (parent.x + parent.width >= container.width) { - parent.x = container.width - parent.width - } - - if (parent.y < 0) { - parent.y = 0 - } else if (parent.y + parent.height >= container.height) { - parent.y = container.height - parent.height - } + updateBoundaries() } onWheel: dragBox.wheel(wheel) diff --git a/linphone-app/ui/views/App/Calls/IncallFullscreenWindow.qml b/linphone-app/ui/views/App/Calls/IncallFullscreenWindow.qml index bbd2df5f3..b635897df 100644 --- a/linphone-app/ui/views/App/Calls/IncallFullscreenWindow.qml +++ b/linphone-app/ui/views/App/Calls/IncallFullscreenWindow.qml @@ -422,7 +422,8 @@ Window { id: cameraPreview Camera { - property bool scale: false + id:cameraPreviewItem + property double scale: 1.0 function xPosition () { return window.width / 2 - width / 2 @@ -431,12 +432,17 @@ Window { function yPosition () { return window.height - height } + + function resetPosition(){ + x = xPosition (); + y = yPosition (); + } call: window.call isPreview: true - height: CallStyle.actionArea.userVideo.height * (scale ? 2 : 1) - width: CallStyle.actionArea.userVideo.width * (scale ? 2 : 1) + height: (CallStyle.actionArea.userVideo.height * window.height/CallStyle.actionArea.userVideo.heightReference) * scale + width: (CallStyle.actionArea.userVideo.width * window.width/CallStyle.actionArea.userVideo.widthReference) * scale DragBox { container: window @@ -444,8 +450,23 @@ Window { xPosition: parent.xPosition yPosition: parent.yPosition + + property double startTime: 0 - onWheel: parent.scale = wheel.angleDelta.y > 0 + onWheel: { + var acceleration = 0.1; + if(startTime == 0){ + startTime = new Date().getTime(); + }else + acceleration = Math.max(0.005,10/(new Date().getTime() - startTime)); + parent.scale = Math.max(0.5 , parent.scale+acceleration*(wheel.angleDelta.y >0 ? 1 : -1) ); + updateBoundaries(); + startTime = new Date().getTime(); + } + onClicked: if(mouse.button == Qt.RightButton) { + parent.scale = 1; + resetPosition(); + } } } } diff --git a/linphone-app/ui/views/App/Styles/Calls/CallStyle.qml b/linphone-app/ui/views/App/Styles/Calls/CallStyle.qml index 20668d8e7..57f91d3b1 100644 --- a/linphone-app/ui/views/App/Styles/Calls/CallStyle.qml +++ b/linphone-app/ui/views/App/Styles/Calls/CallStyle.qml @@ -19,6 +19,8 @@ QtObject { property QtObject userVideo: QtObject { property int height: 200 property int width: 130 + property int heightReference: 1200 // height and width are fixed from these references + property int widthReference: 780 } property QtObject vu: QtObject {