@@ -116,16 +116,92 @@ Window {
116116 }
117117 }
118118
119+ SequentialAnimation {
120+ id: dockAnimation
121+ property bool useTransformBasedAnimation: Qt .platform .pluginName === " xcb"
122+ property bool isShowing: false
123+ property var target: useTransformBasedAnimation ? dockTransform : dock
124+ property string animProperty: {
125+ if (useTransformBasedAnimation) return dock .useColumnLayout ? " x" : " y" ;
126+ return dock .useColumnLayout ? " width" : " height" ;
127+ }
128+
129+ function startAnimation (showing ) {
130+ isShowing = showing;
131+ start ();
132+ }
133+
134+ PropertyAnimation {
135+ target: dockAnimation .target
136+ property: dockAnimation .animProperty
137+ from: {
138+ if (dockAnimation .isShowing ) {
139+ if (dockAnimation .useTransformBasedAnimation ) {
140+ return (Panel .position === Dock .Left || Panel .position === Dock .Top ) ? - Panel .dockSize : Panel .dockSize ;
141+ }
142+ return 1 ;
143+ }
144+ return 0 ;
145+ }
146+ to: {
147+ if (dockAnimation .isShowing ) {
148+ return 0 ;
149+ } else {
150+ if (dockAnimation .useTransformBasedAnimation ) {
151+ return (Panel .position === Dock .Left || Panel .position === Dock .Top ) ? - Panel .dockSize : Panel .dockSize ;
152+ }
153+ return 1 ;
154+ }
155+ }
156+ duration: 250
157+ easing .type : Easing .OutCubic
158+ }
159+
160+ onStarted: {
161+ dock .visible = true ;
162+ }
163+
164+ onStopped: {
165+ if (useTransformBasedAnimation) {
166+ dock .visible = true ;
167+ } else {
168+ dock .visible = ((dock .useColumnLayout ? dock .width : dock .height ) != 1 );
169+ }
170+ }
171+ }
172+
119173 component EnumPropertyMenuItem: LP .MenuItem {
120174 required property string name
121175 required property string prop
122176 required property int value
123177 text: name
124- onTriggered: {
125- Applet[prop] = value
178+
179+ property var positionChangeCallback : function () {
180+ // Disconnect any existing callback first
181+ dockAnimation .onStopped .disconnect (positionChangeCallback);
182+ // Stop any running animations first --fix bug with do not show dock
183+ dockAnimation .stop ();
184+ // Reset transform before starting new animation--fix bug with change position,will have a blank area
185+ dockTransform .x = 0 ;
186+ dockTransform .y = 0 ;
187+
188+ Applet[prop] = value;
126189 checked = Qt .binding (function () {
127- return Applet[prop] === value
128- })
190+ return Applet[prop] === value;
191+ });
192+ dockAnimation .startAnimation (true );
193+ }
194+ onTriggered: {
195+ if (prop === " position" ) {
196+ // Connect the callback and start the hide animation
197+ dockAnimation .onStopped .connect (positionChangeCallback);
198+ dockAnimation .startAnimation (false );
199+ } else {
200+ Applet[prop] = value
201+ checked = Qt .binding (function () {
202+ return Applet[prop] === value
203+ })
204+ }
129205 }
130206 checked: Applet[prop] === value
131207 }
0 commit comments