separate edit shadow visual from its image

pull/2/head
Michail Vourlakos 7 years ago
parent 527fe54da7
commit 7bb2db306a

@ -25,13 +25,11 @@ import QtGraphicalEffects 1.0
import org.kde.latte 0.1 as Latte
Image{
Item{
id: editVisual
width: root.isHorizontal ? editLength : visibilityManager.thicknessNormalOriginal
height: root.isVertical ? editLength : visibilityManager.thicknessNormalOriginal
fillMode: Image.Tile
source: "../icons/"+layoutColor+"print.jpg"
opacity: 0
property int speed: root.durationTime*3*units.longDuration
@ -40,6 +38,8 @@ Image{
property int editLength: root.isHorizontal ? (root.behaveAsPlasmaPanel ? root.width - root.maxIconSize/4 : root.maxLength) :
(root.behaveAsPlasmaPanel ? root.height - root.maxIconSize/4 : root.maxLength)
property real editStateOpacity: root.behaveAsPlasmaPanel ? 0.5 : root.blurEnabled ? 0.8 : 0.9
property bool animationSent: false
property bool farEdge: (plasmoid.location===PlasmaCore.Types.BottomEdge) || (plasmoid.location===PlasmaCore.Types.RightEdge)
property bool editAnimationEnded: false
@ -48,11 +48,80 @@ Image{
property string layoutColor: root.dockManagedLayout ? root.dockManagedLayout.color : "blue"
layer.enabled: true
layer.effect: DropShadow {
radius: root.editShadow
samples: 2 * radius
color: "#aa080808"
Item{
id:topShadow
height: root.editShadow
width: imageTiler.width + 2*root.editShadow
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: imageTiler.top
clip: true
visible: !editTransition.running
EditShadow{
anchors.top: parent.top
anchors.topMargin: root.editShadow
anchors.horizontalCenter: parent.horizontalCenter
}
}
Item{
id:leftShadow
width: root.editShadow
height: imageTiler.height
anchors.right: imageTiler.left
anchors.verticalCenter: imageTiler.verticalCenter
clip: true
visible: !editTransition.running
EditShadow{
anchors.left: parent.left
anchors.leftMargin: root.editShadow
}
}
Item{
id:rightShadow
width: root.editShadow
height: imageTiler.height
anchors.left: imageTiler.right
anchors.verticalCenter: imageTiler.verticalCenter
clip: true
visible: !editTransition.running
EditShadow{
anchors.right: parent.right
anchors.rightMargin: root.editShadow
}
}
Item{
id:bottomShadow
height: root.editShadow
width: imageTiler.width + 2*root.editShadow
anchors.horizontalCenter: imageTiler.horizontalCenter
anchors.top: imageTiler.bottom
clip: true
visible: !editTransition.running
EditShadow{
anchors.bottom: parent.bottom
anchors.bottomMargin: root.editShadow
anchors.horizontalCenter: parent.horizontalCenter
}
}
Image{
id: imageTiler
anchors.centerIn: parent
width: parent.width
height: parent.height
opacity: editVisual.editStateOpacity
fillMode: Image.Tile
source: "../icons/"+editVisual.layoutColor+"print.jpg"
}
/*Behavior on width {
@ -222,6 +291,7 @@ Image{
to: "edit"
SequentialAnimation{
id:normalAnimationTransition
ScriptAction{
script:{
editVisual.opacity = 0
@ -240,7 +310,7 @@ Image{
PropertyAnimation {
target: editVisual
property: "opacity"
to: root.behaveAsPlasmaPanel ? 0.4 : root.blurEnabled ? 0.7 : 0.8
to: 1
duration: editVisual.speed / 2
easing.type: Easing.OutQuad
}

@ -0,0 +1,39 @@
/*
* 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.1 as Latte
Rectangle{
width: imageTiler.width
height: imageTiler.height
color: "white"
layer.enabled: true
layer.effect: DropShadow {
radius: root.editShadow
samples: 2 * radius
color: "#040404"
}
}

@ -63,11 +63,11 @@ Item{
//it is used to keep thickness solid e.g. when iconSize changes from auto functions
property int thicknessMidOriginal: Math.max(thicknessNormalOriginal, statesLineSizeOriginal + thickReverseAndGlowExtraSizeOriginal + (1 + (0.65 * (root.zoomFactor-1)))*(root.maxIconSize+root.thickMarginOriginal)) //needed in some animations
property int thicknessNormalOriginal: !root.behaveAsPlasmaPanel ?
Math.max(thicknessNormalOriginalValue + thickReverseAndGlowExtraSizeOriginal, root.realPanelSize + root.panelShadow) :
Math.max(thicknessNormalOriginalValue, root.realPanelSize + root.panelShadow) :
root.realPanelSize + root.panelShadow
property int thicknessNormalOriginalValue: statesLineSizeOriginal + thickReverseAndGlowExtraSizeOriginal +
root.maxIconSize + root.thickMarginOriginal + thickReverseAndGlowExtraSize + 1
root.maxIconSize + root.thickMarginOriginal + 1
property int thicknessZoomOriginal: Math.max(statesLineSizeOriginal + thickReverseAndGlowExtraSizeOriginal + ((root.maxIconSize+root.thickMarginOriginal) * root.zoomFactor) + 2,
root.realPanelSize + root.panelShadow)

@ -192,7 +192,7 @@ DragDrop.DropArea {
property int panelMargin: 0
property int panelMarginLength: 0
property int panelShadow: 0 //shadowsSize
property int editShadow: Math.max(7, root.maxIconSize / 6)
property int editShadow: behaveAsPlasmaPanel ? 5 : Math.max(7, root.maxIconSize / 4)
property int themePanelSize: {
//root.statesLineSize + root.iconSize + root.iconMargin + 1
var panelBase = root.statesLineSize + root.panelMargin;

Loading…
Cancel
Save