diff --git a/src/declarativeimports/plasmacomponents3/ScrollBar.qml b/src/declarativeimports/plasmacomponents3/ScrollBar.qml --- a/src/declarativeimports/plasmacomponents3/ScrollBar.qml +++ b/src/declarativeimports/plasmacomponents3/ScrollBar.qml @@ -20,46 +20,108 @@ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.kirigami 2.2 as Kirigami +import org.kde.kirigami 2.10 as Kirigami T.ScrollBar { - id: control + id: controlRoot implicitWidth: background.implicitWidth implicitHeight: background.implicitHeight hoverEnabled: !Kirigami.Settings.isMobile - visible: control.size < 1.0 + visible: controlRoot.size < 1.0 - background: PlasmaCore.FrameSvgItem { - imagePath:"widgets/scrollbar" + interactive: !Kirigami.Settings.tabletMode + + background: Item { + visible: controlRoot.size < 1.0 && controlRoot.interactive implicitWidth: scrollbarSvg.elementSize("hint-scrollbar-size").width implicitHeight: implicitWidth - colorGroup: PlasmaCore.ColorScope.colorGroup - visible: control.size < 1.0 - - prefix: control.horizontal ? "background-horizontal" : "background-vertical" - opacity: Kirigami.Settings.isMobile ? (control.active ? 1 : 0) : (control.hovered ? 1 : 0) - Behavior on opacity { - OpacityAnimator { - duration: units.longDuration + Rectangle { + anchors { + top: parent.top + bottom: parent.bottom + left: parent.left + } + // the separator line doesn't work yet with the plasmoids design + visible: typeof plasmoid === "undefined" + width: units.devicePixelRatio + color: PlasmaCore.ColorScope.textColor + opacity: 0.1 + } + PlasmaCore.FrameSvgItem { + anchors.fill: parent + imagePath:"widgets/scrollbar" + colorGroup: PlasmaCore.ColorScope.colorGroup + + prefix: controlRoot.horizontal ? "background-horizontal" : "background-vertical" + opacity: controlRoot.hovered + Behavior on opacity { + OpacityAnimator { + duration: units.longDuration + } } } } - contentItem: PlasmaCore.FrameSvgItem { - imagePath:"widgets/scrollbar" - implicitWidth: scrollbarSvg.elementSize("hint-scrollbar-size").width - implicitHeight: implicitWidth - colorGroup: PlasmaCore.ColorScope.colorGroup - visible: control.size < 1.0 - - prefix: control.hovered ? "mouseover-slider" : "slider" - opacity: Kirigami.Settings.isMobile ? (control.active ? 1 : 0) : 1 - Behavior on opacity { - OpacityAnimator { - duration: units.longDuration + onPositionChanged: { + disappearTimer.restart(); + handleGraphics.handleState = Math.min(1, handleGraphics.handleState + 0.1) + } + + contentItem: Item { + PlasmaCore.FrameSvgItem { + anchors.fill: parent + imagePath:"widgets/scrollbar" + + implicitWidth: scrollbarSvg.elementSize("hint-scrollbar-size").width + visible: controlRoot.interactive && controlRoot.size < 1.0 + implicitHeight: implicitWidth + colorGroup: PlasmaCore.ColorScope.colorGroup + + prefix: controlRoot.hovered ? "mouseover-slider" : "slider" + } + Rectangle { + id: handleGraphics + + property real handleState: 0 + + visible: !controlRoot.interactive + x: Math.round(controlRoot.orientation == Qt.Vertical + ? (parent.width - width) - (parent.width/2 - width/2) * handleState + : 0) + + y: Math.round(controlRoot.orientation == Qt.Horizontal + ? (parent.height - height) - (parent.height/2 - height/2) * handleState + : 0) + + NumberAnimation { + id: resetAnim + target: handleGraphics + property: "handleState" + from: handleGraphics.handleState + to: 0 + duration: Kirigami.Units.longDuration + easing.type: Easing.InOutQuad + } + + width: Math.round(controlRoot.orientation == Qt.Vertical + ? Math.max(2, Kirigami.Units.smallSpacing * handleState) + : parent.width) + height: Math.round(controlRoot.orientation == Qt.Horizontal + ? Math.max(2, Kirigami.Units.smallSpacing * handleState) + : parent.height) + radius: Math.min(width, height) + color: PlasmaCore.ColorScope.textColor + opacity: 0.3 + Timer { + id: disappearTimer + interval: 1000 + onTriggered: { + resetAnim.restart(); + handleGraphics.handleState = 0; + } } } } diff --git a/src/desktoptheme/breeze/widgets/scrollbar.svg b/src/desktoptheme/breeze/widgets/scrollbar.svg --- a/src/desktoptheme/breeze/widgets/scrollbar.svg +++ b/src/desktoptheme/breeze/widgets/scrollbar.svg @@ -13,8 +13,8 @@ height="98" id="svg3642" sodipodi:version="0.32" - inkscape:version="0.91 r13725" - sodipodi:docname="scrollbar.svgz" + inkscape:version="0.92.2 5c3e80d, 2017-08-06" + sodipodi:docname="scrollbar.svg" inkscape:output_extension="org.inkscape.output.svgz.inkscape" version="1.0"> + transform="matrix(0.75,0,0,1,15.25,13)"> + transform="matrix(0.75,0,0,0.75,15.25,13.75)"> + transform="matrix(0.75,0,0,0.75,15.25,18.25)"> + transform="matrix(-0.75,0,0,1,25.75,13)"> + transform="matrix(-0.75,0,0,0.75,25.75,13.75)"> + transform="matrix(-0.75,0,0,0.75,25.75,18.25)"> + transform="matrix(0,0.75,-0.1,0,21.7,24.25)"> + style="opacity:0.6;fill:currentColor;fill-opacity:1;fill-rule:evenodd;stroke:none" /> + d="m 9,7 v 10 h 4 V 7 Z" + style="opacity:0.6;fill:currentColor;fill-opacity:1;fill-rule:evenodd;stroke:none" /> + d="m 9,3 v 4 h 4 C 13,4.784 11.216,3 9,3 Z" + style="opacity:0.6;fill:currentColor;fill-opacity:1;fill-rule:evenodd;stroke:none" /> + transform="matrix(0,-0.75,-0.1,0,21.700001,58.75)"> + d="m 9,7 v 10 h 4 V 7 Z" + style="opacity:0.6;fill:currentColor;fill-opacity:1;fill-rule:evenodd;stroke:none" /> + id="background-vertical-center" + transform="translate(3)"> + transform="matrix(0,-0.75,-0.1,0,42.700001,58.750001)"> + transform="translate(3,33)">