src/cm/media/js/client/c_icomment.js
changeset 329 00df963f91fb
parent 294 c2c262ac1273
child 330 db7616686c57
--- a/src/cm/media/js/client/c_icomment.js	Tue Nov 02 16:31:20 2010 +0100
+++ b/src/cm/media/js/client/c_icomment.js	Mon Nov 08 12:41:44 2010 +0100
@@ -423,9 +423,19 @@
 		if (gIComments.animationsEnded())
 			gIComments.whenAnimationsEnd() ;		
 	},
+	onAnimationEndFocus : function() {
+		if (!CY.Lang.isUndefined(this['animation-handle']) && !CY.Lang.isNull(this['animation-handle'])) { 
+			this['animation-handle'].detach() ;
+			this['animation-handle'] = null ;
+//			CY.log('detached...') ;
+		}
+		gIComments.signalAnimationEnd() ;
+		if (gIComments.animationsEnded())
+			gIComments.whenAnimationsEndFocus() ;		
+	},
 
 	//aa = new CY.Anim({node:gIComments._c[0].overlay.get('boundingBox'), to:{xy : [0,0]}, duration:2.0})
-	setAnimationToPosition : function(toXY) {
+	setAnimationToPosition : function(toXY, focus) {
 		var boundingBoxNode = this.overlay.get('boundingBox') ;
 		
 		// ANIMATION
@@ -435,7 +445,9 @@
 		
 		this.animation.set('to', { xy: toXY});
 		this.animation.set('duration', gPrefs.get('general','animduration')) ; // shouldn't be here really ...
-		this['animation-handle'] = this.animation.on('end', this.onAnimationEnd, this);
+    if (focus)
+    	this['animation-handle'] = this.animation.on('end', this.onAnimationEndFocus, this);
+    	this['animation-handle'] = this.animation.on('end', this.onAnimationEnd, this);
 		
 		return this.animation ;
 	},