on xenial help sign in
update sleection highlight
commitaf2788a185a80bbe88e8d4cfea68a3ac870d9a00 authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 23 Aug 2016, 14:51 (10 years ago) parent6b7d2ea
3 files changed+24−12
qml/Stage/DecoratedWindow.qml+11−9 qml/Stage/Spread/SpreadMaths.qml+11−3 qml/Stage/Stage.qml+2
qml/Stage/DecoratedWindow.qml+11−9
@@ -42,7 +42,9 @@ FocusScope {
4242 property bool showDecoration: true
4343 property bool animateDecoration: false
4444 property bool showHighlight: false
45+ property int highlightSize: units.gu(1)
4546 property real shadowOpacity: 0
47+ property bool darkening: false
4648
4749 property real requestedWidth
4850 property real requestedHeight
@@ -82,16 +84,9 @@ FocusScope {
8284 Rectangle {
8385 id: selectionHighlight
8486 anchors.fill: parent
85− anchors.margins: -units.gu(1)
87+ anchors.margins: -root.highlightSize
8688 color: "white"
87− opacity: showHighlight ? 0.15 : 0
88− }
89−
90− Rectangle {
91− anchors { left: selectionHighlight.left; right: selectionHighlight.right; bottom: selectionHighlight.bottom; }
92− height: units.dp(2)
93− color: theme.palette.normal.focus
94− visible: showHighlight
89+ opacity: showHighlight ? 0.55 : 0
9590 }
9691
9792 BorderImage {
@@ -186,4 +181,11 @@ FocusScope {
186181
187182 ]
188183 }
184+
185+ Rectangle {
186+ anchors.fill: parent
187+ color: "black"
188+ opacity: root.darkening && !root.showHighlight ? 0.05 : 0
189+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
190+ }
189191}
qml/Stage/Spread/SpreadMaths.qml+11−3
@@ -35,6 +35,16 @@ Item {
3535 property real stackingX: (MathUtils.easeOutCubic(rightStackingProgress) - MathUtils.easeOutCubic(leftStackingProgress)) * spread.stackWidth
3636
3737
38+ QtObject {
39+ id: d
40+ property real spreadScale: MathUtils.clamp(
41+ MathUtils.map(spreadPosition, 0, 1, spread.leftStackScale, spread.rightStackScale),
42+ spread.leftStackScale, spread.rightStackScale)
43+
44+ property real selectedScale: (spread.highlightedIndex == itemIndex ? 1.01 : 1)
45+ Behavior on selectedScale { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
46+
47+ }
3848
3949 // Output
4050 readonly property int targetX: spread.leftStackXPos +
@@ -48,9 +58,7 @@ Item {
4858 Math.min(spread.dynamicLeftRotationAngle, spread.dynamicRightRotationAngle), Math.max(spread.dynamicLeftRotationAngle, spread.dynamicRightRotationAngle))
4959
5060
51− readonly property real targetScale: MathUtils.clamp(
52− MathUtils.map(spreadPosition, 0, 1, spread.leftStackScale, spread.rightStackScale),
53− spread.leftStackScale, spread.rightStackScale)
61+ readonly property real targetScale: d.spreadScale * d.selectedScale
5462
5563 readonly property real shadowOpacity: 0.2 * (1 - rightStackingProgress) * (1 - leftStackingProgress)
5664
qml/Stage/Stage.qml+2
@@ -835,6 +835,7 @@ AbstractStage {
835835 hasDecoration: root.mode === "windowed"
836836 shadowOpacity: spreadMaths.shadowOpacity
837837 showHighlight: spreadItem.highlightedIndex === index
838+ darkening: spreadItem.highlightedIndex >= 0
838839 anchors.topMargin: dragArea.distance
839840 }
840841 PropertyChanges {
@@ -1156,6 +1157,7 @@ AbstractStage {
11561157 overlayShown: touchControls.overlayShown
11571158 width: implicitWidth
11581159 height: implicitHeight
1160+ highlightSize: windowInfoItem.iconMargin / 2
11591161
11601162 requestedWidth: appDelegate.requestedWidth
11611163 requestedHeight: appDelegate.requestedHeight