3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
17 * Animation Queue mixin to handle chaining and queueing by target.
21 Ext.define('Ext.fx.Queue', {
23 requires: ['Ext.util.HashMap'],
25 constructor: function() {
26 this.targets = Ext.create('Ext.util.HashMap');
31 getFxDefaults: function(targetId) {
32 var target = this.targets.get(targetId);
34 return target.fxDefaults;
40 setFxDefaults: function(targetId, obj) {
41 var target = this.targets.get(targetId);
43 target.fxDefaults = Ext.apply(target.fxDefaults || {}, obj);
48 stopAnimation: function(targetId) {
50 queue = me.getFxQueue(targetId),
60 * Returns current animation object if the element has any effects actively running or queued, else returns false.
62 getActiveAnimation: function(targetId) {
63 var queue = this.getFxQueue(targetId);
64 return (queue && !!queue.length) ? queue[0] : false;
68 hasFxBlock: function(targetId) {
69 var queue = this.getFxQueue(targetId);
70 return queue && queue[0] && queue[0].block;
73 // @private get fx queue for passed target, create if needed.
74 getFxQueue: function(targetId) {
79 queue = me.fxQueue[targetId],
80 target = me.targets.get(targetId);
87 me.fxQueue[targetId] = [];
88 // GarbageCollector will need to clean up Elements since they aren't currently observable
89 if (target.type != 'element') {
90 target.target.on('destroy', function() {
91 me.fxQueue[targetId] = [];
95 return me.fxQueue[targetId];
99 queueFx: function(anim) {
101 target = anim.target,
108 queue = me.getFxQueue(target.getId());
112 if (anim.concurrent) {
116 queue[ln - 1].on('afteranimate', function() {
124 anim.on('afteranimate', function() {
125 Ext.Array.remove(queue, anim);
127 if (target.type == 'element') {
128 var el = Ext.get(target.id);