Warning, /plasma-mobile/plasma-camera/src/contents/ui/ZoomControl.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2013 Digia Plc and/or its subsidiary(-ies) 0002 // SPDX-License-Identifier: BSD-3-Clause 0003 0004 import QtQuick 2.0 0005 import org.kde.kirigami 2.0 as Kirigami 0006 import QtMultimedia 5.0 0007 0008 Item { 0009 id : zoomControl 0010 property real currentZoom: 1 0011 property real maximumZoom: 1 0012 signal zoomTo(real value) 0013 0014 visible: zoomControl.maximumZoom > 1 0015 0016 MouseArea { 0017 id : mouseArea 0018 anchors.fill: parent 0019 0020 property real initialZoom: 0 0021 property real initialPos: 0 0022 0023 onPressed: { 0024 initialPos = mouseY 0025 initialZoom = zoomControl.currentZoom 0026 } 0027 0028 onPositionChanged: { 0029 if (pressed) { 0030 var target = initialZoom * Math.pow(5, (initialPos-mouseY)/zoomControl.height); 0031 target = Math.max(1, Math.min(target, zoomControl.maximumZoom)) 0032 zoomControl.zoomTo(target) 0033 } 0034 } 0035 } 0036 0037 Item { 0038 id : bar 0039 x : 16 0040 y : parent.height/4 0041 width : 24 0042 height : parent.height/2 0043 0044 Rectangle { 0045 anchors.fill: parent 0046 0047 smooth: true 0048 radius: 8 0049 border.color: "white" 0050 border.width: 2 0051 color: "black" 0052 opacity: 0.3 0053 } 0054 0055 Rectangle { 0056 id: groove 0057 x : 0 0058 y : parent.height * (1.0 - (zoomControl.currentZoom-1.0) / (zoomControl.maximumZoom-1.0)) 0059 width: parent.width 0060 height: parent.height - y 0061 smooth: true 0062 radius: Kirigami.Units.gridUnit * 0.5 0063 color: "white" 0064 opacity: 0.5 0065 } 0066 0067 Text { 0068 id: zoomText 0069 anchors { 0070 right: bar.left 0071 rightMargin: Kirigami.Units.gridUnit * 1 0072 } 0073 y: Math.min(parent.height - height, Math.max(0, groove.y - height / 2)) 0074 text: "x" + Math.round(zoomControl.currentZoom * 100) / 100 0075 font.bold: true 0076 color: "white" 0077 style: Text.Raised; styleColor: "black" 0078 opacity: 0.85 0079 font.pixelSize: Kirigami.Units.gridUnit 0080 } 0081 } 0082 }