Comparing version 2.0.1 to 2.0.2
97
index.js
@@ -103,2 +103,4 @@ function ViewManager( settings ) { | ||
var oldContent = this.cContent; | ||
var onOldOut; | ||
var onNewIn = function() { | ||
@@ -114,42 +116,21 @@ | ||
}; | ||
var onOldOut; | ||
// resize the newContent if it has a resize method | ||
if( newContent.resize ) { | ||
newContent.resize( s.width, s.height ); | ||
} | ||
var bringInNewContent = function() { | ||
// call a callback that we're starting to animatein content | ||
if( s.onStartAniIn ) { | ||
s.onStartAniIn( newContent, this.cContent ); | ||
} | ||
if( s.onStartAniIn ) { | ||
s.onStartAniIn( newContent, this.cContent ); | ||
} | ||
// check if there's content on screen already | ||
if( this.cContent ) { | ||
this.cContent = newContent; | ||
this.nContent = null; | ||
// setup the old out function | ||
onOldOut = function() { | ||
if( newContent.animateIn ) { | ||
newContent.animateIn( this.data, onNewIn ); | ||
} else { | ||
onNewIn(); | ||
} | ||
}.bind( this ); | ||
if( s.onEndAniOut ) { | ||
s.onEndAniOut( newContent, oldContent ); | ||
} | ||
var takeOutOldContent = function() { | ||
if( oldContent.destroy ) { | ||
oldContent.destroy( this.data, function() { } ); | ||
} | ||
if( !s.overlap ) { | ||
if( newContent.animateIn ) { | ||
newContent.animateIn( this.data, onNewIn ); | ||
} else { | ||
onNewIn(); | ||
} | ||
} | ||
}.bind(this); | ||
// call a callback that we're starting to animateout content | ||
if( s.onStartAniOut ) { | ||
@@ -159,2 +140,3 @@ s.onStartAniOut( newContent, oldContent ); | ||
// if there's an animateOut function execute it on oldContent | ||
if( oldContent.animateOut ) { | ||
@@ -165,22 +147,47 @@ oldContent.animateOut( this.data, onOldOut ); | ||
} | ||
}.bind( this ); | ||
if( s.overlap ) { | ||
var destroyOldContent = function() { | ||
if( newContent.animateIn ) { | ||
newContent.animateIn( this.data, onNewIn ); | ||
} else { | ||
onNewIn(); | ||
} | ||
if( s.onEndAniOut ) { | ||
s.onEndAniOut( newContent, oldContent ); | ||
} | ||
} else { | ||
this.cContent = newContent; | ||
this.nContent = null; | ||
if( oldContent.destroy ) { | ||
oldContent.destroy( this.data, function() { } ); | ||
} | ||
}.bind( this ); | ||
// just bring new content | ||
if( newContent.animateIn ) { | ||
newContent.animateIn( this.data, onNewIn ); | ||
// resize the newContent if it has a resize method | ||
if( newContent.resize ) { | ||
newContent.resize( s.width, s.height ); | ||
} | ||
// check if there's content on screen already | ||
if( this.cContent ) { | ||
if( s.overlap ) { | ||
onOldOut = destroyOldContent; | ||
} else { | ||
onNewIn(); | ||
onOldOut = function() { | ||
destroyOldContent(); | ||
bringInNewContent(); | ||
}.bind(this); | ||
} | ||
// call the callback to notify that we've started animating out | ||
takeOutOldContent(); | ||
if( s.overlap ) { | ||
bringInNewContent(); | ||
} | ||
// else we don't have current content just bring in the new | ||
} else { | ||
bringInNewContent(); | ||
} | ||
@@ -187,0 +194,0 @@ } |
{ | ||
"name": "bw-vm", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "This is a view manager for bigwheel (it brings in out content)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12710