1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-25 19:21:41 +03:00

move external shadow under liblatte2

This commit is contained in:
Michail Vourlakos 2019-03-09 18:59:59 +02:00
parent 0816e2b8aa
commit e1c964ea34
5 changed files with 134 additions and 92 deletions

View File

@ -196,6 +196,7 @@ Item{
when: latteView && latteView.effects
value: {
if (Latte.WindowSystem.compositingActive
&& root.editMode
&& editModeVisual.editAnimationEnded
&& (!root.isHovered || root.zoomFactor===1) ) {
return true;

View File

@ -1,40 +0,0 @@
/*
* Copyright 2016 Smith AR <audoban@openmailbox.org>
* Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.1
import org.kde.plasma.core 2.0 as PlasmaCore
import QtGraphicalEffects 1.0
import org.kde.latte 0.2 as Latte
Rectangle{
width: imageTiler.width
height: imageTiler.height
color: "white"
layer.enabled: true
layer.effect: DropShadow {
radius: root.editShadow
fast: true
samples: 2 * radius
color: "#040404"
}
}

View File

@ -26,7 +26,6 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.latte 0.2 as Latte
Item{
id: editVisual
width: root.isHorizontal ? (latteView ? latteView.width : root.width) :
@ -55,19 +54,15 @@ Item{
readonly property real maxOpacity: Latte.WindowSystem.compositingActive && !plasmoid.configuration.inConfigureAppletsMode ?
plasmoid.configuration.editBackgroundOpacity : 1
Item{
id: shadow
width: root.isHorizontal ? imageTiler.width + 2*root.editShadow : root.editShadow
height: root.isHorizontal ? root.editShadow : imageTiler.height + 2*root.editShadow
clip: true
Latte.ExternalShadow{
id: editExternalShadow
width: root.isHorizontal ? imageTiler.width : root.editShadow
height: root.isHorizontal ? root.editShadow : imageTiler.height
visible: !editTransition.running && root.editMode && Latte.WindowSystem.compositingActive
opacity: Math.max(0.35, imageTiler.opacity)
ExternalShadow{
id: editShadow
}
shadowSize: root.editShadow
shadowOpacity: Math.max(0.35, imageTiler.opacity)
shadowDirection: plasmoid.location
states: [
///topShadow
@ -76,19 +71,10 @@ Item{
when: (plasmoid.location === PlasmaCore.Types.BottomEdge)
AnchorChanges {
target: shadow
target: editExternalShadow
anchors{ top:undefined; bottom:imageTiler.top; left:undefined; right:undefined;
horizontalCenter:imageTiler.horizontalCenter; verticalCenter:undefined}
}
AnchorChanges {
target: editShadow
anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined;
horizontalCenter:parent.horizontalCenter; verticalCenter:parent.undefined}
}
PropertyChanges{
target: editShadow
anchors{ leftMargin: 0; rightMargin:0; topMargin:root.editShadow; bottomMargin:0}
}
},
///bottomShadow
State {
@ -96,19 +82,10 @@ Item{
when: (plasmoid.location === PlasmaCore.Types.TopEdge)
AnchorChanges {
target: shadow
target: editExternalShadow
anchors{ top:imageTiler.bottom; bottom:undefined; left:undefined; right:undefined;
horizontalCenter:imageTiler.horizontalCenter; verticalCenter:undefined}
}
AnchorChanges {
target: editShadow
anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:undefined;
horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
}
PropertyChanges{
target: editShadow
anchors{ leftMargin: 0; rightMargin:0; topMargin:0; bottomMargin:root.editShadow}
}
},
///leftShadow
State {
@ -116,19 +93,10 @@ Item{
when: (plasmoid.location === PlasmaCore.Types.RightEdge)
AnchorChanges {
target: shadow
target: editExternalShadow
anchors{ top:undefined; bottom:undefined; left:undefined; right:imageTiler.left;
horizontalCenter:undefined; verticalCenter:imageTiler.verticalCenter}
}
AnchorChanges {
target: editShadow
anchors{ top:undefined; bottom:undefined; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:undefined}
}
PropertyChanges{
target: editShadow
anchors{ leftMargin: root.editShadow; rightMargin:0; topMargin:0; bottomMargin:0}
}
},
///rightShadow
State {
@ -136,19 +104,10 @@ Item{
when: (plasmoid.location === PlasmaCore.Types.LeftEdge)
AnchorChanges {
target: shadow
target: editExternalShadow
anchors{ top:undefined; bottom:undefined; left:imageTiler.right; right:undefined;
horizontalCenter:undefined; verticalCenter:imageTiler.verticalCenter}
}
AnchorChanges {
target: editShadow
anchors{ top:undefined; bottom:undefined; left:undefined; right:parent.right;
horizontalCenter:undefined; verticalCenter:undefined}
}
PropertyChanges{
target: editShadow
anchors{ leftMargin: 0; rightMargin:root.editShadow; topMargin:0; bottomMargin:0}
}
}
]
}

View File

@ -0,0 +1,121 @@
/*
* Copyright 2016 Smith AR <audoban@openmailbox.org>
* Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.1
import org.kde.plasma.core 2.0 as PlasmaCore
import QtGraphicalEffects 1.0
import org.kde.latte 0.2 as Latte
Item{
id: shadowRoot
property int shadowDirection: PlasmaCore.Types.BottomEdge
property int shadowSize: 7
property real shadowOpacity: 1
Item{
id: shadow
width: root.isHorizontal ? shadowRoot.width + 2*shadowSize : shadowSize
height: root.isHorizontal ? shadowSize: shadowRoot.height + 2*shadowSize
opacity: shadowOpacity
clip: true
Rectangle{
id: editShadow
width: shadowRoot.width
height: shadowRoot.height
color: "white"
layer.enabled: true
layer.effect: DropShadow {
radius: shadowSize
fast: true
samples: 2 * radius
color: "#040404"
}
}
states: [
///topShadow
State {
name: "topShadow"
when: (shadowDirection === PlasmaCore.Types.BottomEdge)
AnchorChanges {
target: editShadow
anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined;
horizontalCenter:parent.horizontalCenter; verticalCenter:parent.undefined}
}
PropertyChanges{
target: editShadow
anchors{ leftMargin: 0; rightMargin:0; topMargin:shadowSize; bottomMargin:0}
}
},
///bottomShadow
State {
name: "bottomShadow"
when: (shadowDirection === PlasmaCore.Types.TopEdge)
AnchorChanges {
target: editShadow
anchors{ top:undefined; bottom:parent.bottom; left:undefined; right:undefined;
horizontalCenter:parent.horizontalCenter; verticalCenter:undefined}
}
PropertyChanges{
target: editShadow
anchors{ leftMargin: 0; rightMargin:0; topMargin:0; bottomMargin:shadowSize}
}
},
///leftShadow
State {
name: "leftShadow"
when: (shadowDirection === PlasmaCore.Types.RightEdge)
AnchorChanges {
target: editShadow
anchors{ top:undefined; bottom:undefined; left:parent.left; right:undefined;
horizontalCenter:undefined; verticalCenter:undefined}
}
PropertyChanges{
target: editShadow
anchors{ leftMargin: shadowSize; rightMargin:0; topMargin:0; bottomMargin:0}
}
},
///rightShadow
State {
name: "rightShadow"
when: (shadowDirection === PlasmaCore.Types.LeftEdge)
AnchorChanges {
target: editShadow
anchors{ top:undefined; bottom:undefined; left:undefined; right:parent.right;
horizontalCenter:undefined; verticalCenter:undefined}
}
PropertyChanges{
target: editShadow
anchors{ leftMargin: 0; rightMargin:shadowSize; topMargin:0; bottomMargin:0}
}
}
]
}
}

View File

@ -3,6 +3,7 @@ plugin latte2plugin
GlowPoint 0.2 GlowPoint.qml
BadgeText 0.2 BadgeText.qml
ExternalShadow 0.2 ExternalShadow.qml
LatteIndicator 0.2 indicators/LatteIndicator.qml
PlasmaIndicator 0.2 indicators/PlasmaIndicator.qml
UnityIndicator 0.2 indicators/UnityIndicator.qml