Author: jmorliaguet Date: Sat Apr 15 16:49:23 2006 New Revision: 2854 Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Log:
- added a goBack() function to go back top the previous perspective - fixed fadein/fadeout visual artefact Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js ============================================================================== --- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original) +++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sat Apr 15 16:49:23 2006 @@ -861,7 +861,7 @@ if (this.def.dropping) { var highlight = this.def.dropping.highlight; - if (highlight) { + if (highlight && this._dropzones) { this._dropzones.each(function(el) { CPSSkins.Effects.activate(el, {'duration': highlight.duration || 1000} @@ -967,7 +967,7 @@ if (this.def.dropping) { var highlight = this.def.dropping.highlight; - if (highlight) { + if (highlight && this._dropzones) { this._dropzones.each(function(el) { CPSSkins.Effects.deactivate(el, {'duration': highlight.duration || 1000} @@ -1034,6 +1034,7 @@ }, switchTo: function(perspective) { + this._previous = this._current; this._current = perspective; var to_show = this._visible_views[perspective] || []; var to_hide = this.views.entries().select(function(v) { @@ -1041,6 +1042,10 @@ }); to_hide.each(function(v) { CPSSkins.getViewById(v).hide(); }); to_show.each(function(v) { CPSSkins.getViewById(v).show(); }); + }, + + goBack: function() { + this.switchTo(this._previous); } }); @@ -1322,19 +1327,20 @@ }, fadein: function(node, options) { - node.setOpacity(0); + var opacity = node.style.opacity; + if (!opacity) node.setOpacity(0); Object.extend(options, { - action: function(value) { node.setOpacity(value) }, + action: function(value) { if (value > opacity) node.setOpacity(value) }, onComplete: function() { node.show() } }); return new CPSSkins.Scheduler(options); }, fadeout: function(node, options) { - node.setOpacity(1); + var opacity = node.style.opacity; Object.extend(options, { - action: function(value) { node.setOpacity(1-value) }, - onComplete: function() { node.hide() } + action: function(value) { if (value < opacity) node.setOpacity(1-value) }, + onComplete: function() { node.hide(); node.style.opacity = '' } }); return new CPSSkins.Scheduler(options); }, -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins