Browse Source

Shape: Adds feature to not show side if currently active

pull/1191/merge
jlukic 10 years ago
parent
commit
5377892a73
2 changed files with 43 additions and 12 deletions
  1. 1
      RELEASE NOTES.md
  2. 54
      src/definitions/modules/shape.js

1
RELEASE NOTES.md

@ -66,6 +66,7 @@
- **Rating** - Rating can use data attributes to specify individual ratings
- **Sidebar** - Sidebar now has tall / very tall variations for resizing top/bottom sidebars
- **Shape** - Shape now is better at calculating sizes when animating
- **Shape** - You can now disable repeated animations by setting, so animation wont queue if side is currently visible
- **Steps** - Steps can now have icons, descriptions and titles. Step default theme has been modified significantly to be more flexible.
- **Table** - Tables now have 'basic' and 'very' basic variations
- **Transition** - Transition will now keep block position of elements hidden with visibility hidden

54
src/definitions/modules/shape.js

@ -177,6 +177,9 @@ $.fn.shape = function(parameters) {
},
is: {
complete: function() {
return ($side.filter('.' + className.active)[0] == $nextSide[0]);
},
animating: function() {
return $module.hasClass(className.animating);
}
@ -265,8 +268,12 @@ $.fn.shape = function(parameters) {
flip: {
up: function() {
module.debug('Flipping up', $nextSide);
if( !module.is.animating() ) {
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
console.log('Side already visible', $nextSide);
return;
}
if( !module.is.animating()) {
module.debug('Flipping up', $nextSide);
module.set.stageSize();
module.stage.above();
module.animate( module.get.transform.up() );
@ -277,8 +284,12 @@ $.fn.shape = function(parameters) {
},
down: function() {
module.debug('Flipping down', $nextSide);
if( !module.is.animating() ) {
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
console.log('Side already visible', $nextSide);
return;
}
if( !module.is.animating()) {
module.debug('Flipping down', $nextSide);
module.set.stageSize();
module.stage.below();
module.animate( module.get.transform.down() );
@ -289,8 +300,12 @@ $.fn.shape = function(parameters) {
},
left: function() {
module.debug('Flipping left', $nextSide);
if( !module.is.animating() ) {
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
console.log('Side already visible', $nextSide);
return;
}
if( !module.is.animating()) {
module.debug('Flipping left', $nextSide);
module.set.stageSize();
module.stage.left();
module.animate(module.get.transform.left() );
@ -301,8 +316,12 @@ $.fn.shape = function(parameters) {
},
right: function() {
module.debug('Flipping right', $nextSide);
if( !module.is.animating() ) {
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
console.log('Side already visible', $nextSide);
return;
}
if( !module.is.animating()) {
module.debug('Flipping right', $nextSide);
module.set.stageSize();
module.stage.right();
module.animate(module.get.transform.right() );
@ -313,8 +332,12 @@ $.fn.shape = function(parameters) {
},
over: function() {
module.debug('Flipping over', $nextSide);
if( !module.is.animating() ) {
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
console.log('Side already visible', $nextSide);
return;
}
if( !module.is.animating()) {
module.debug('Flipping over', $nextSide);
module.set.stageSize();
module.stage.behind();
module.animate(module.get.transform.over() );
@ -325,8 +348,12 @@ $.fn.shape = function(parameters) {
},
back: function() {
module.debug('Flipping back', $nextSide);
if( !module.is.animating() ) {
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
console.log('Side already visible', $nextSide);
return;
}
if( !module.is.animating()) {
module.debug('Flipping back', $nextSide);
module.set.stageSize();
module.stage.behind();
module.animate(module.get.transform.back() );
@ -771,6 +798,9 @@ $.fn.shape.settings = {
beforeChange : function() {},
onChange : function() {},
// allow animation to same side
allowRepeats: false,
// animation duration
duration : 700,

Loading…
Cancel
Save