Browse Source

usingTransforms is now a instance-specific property, not plugin wide

pull/14/head
David DeSandro 14 years ago
parent
commit
81baa7ffcb
  1. 38
      src/jquery.molequul.js

38
src/jquery.molequul.js

@ -29,8 +29,6 @@
sortDir : 1 sortDir : 1
}, },
usingTransforms : Modernizr.csstransforms && Modernizr.csstransitions,
isNewProp : function( property, props ) { isNewProp : function( property, props ) {
if ( !props.initialized ) { if ( !props.initialized ) {
return true; return true;
@ -61,7 +59,7 @@
setupAtoms : function( props ) { setupAtoms : function( props ) {
// base style for atoms // base style for atoms
var atomStyle = { position: 'absolute' }; var atomStyle = { position: 'absolute' };
if ( $.molequul.usingTransforms ) { if ( props.usingTransforms ) {
atomStyle.left = 0; atomStyle.left = 0;
atomStyle.top = 0; atomStyle.top = 0;
} }
@ -93,7 +91,7 @@
return this; return this;
}, },
append : function( $content ) { insert : function( $content ) {
// console.log('appedning') // console.log('appedning')
this.append( $content ); this.append( $content );
$content.molequul( 'addTo', this ); $content.molequul( 'addTo', this );
@ -167,7 +165,7 @@
// ====================== Layout ====================== // ====================== Layout ======================
pushPosition : function( x, y, props ) { pushPosition : function( x, y, props ) {
var position = $.molequul.position( x, y ); var position = props.positionFn( x, y );
props.styleQueue.push({ $el: this, style: position }); props.styleQueue.push({ $el: this, style: position });
return this; return this;
}, },
@ -428,15 +426,7 @@
position : 'relative' position : 'relative'
}); });
// sorting var jQueryAnimation = false;
var originalOrderSorter = {
'original-order' : function( $elem ) {
return props.elemCount;
}
};
props.opts.getSortData = $.extend( originalOrderSorter, props.opts.getSortData );
props.atoms.$all.molequul( 'setupAtoms', props );
// get applyStyleFnName // get applyStyleFnName
switch ( props.opts.animationEngine.toLowerCase().replace( /[ _\-]/g, '') ) { switch ( props.opts.animationEngine.toLowerCase().replace( /[ _\-]/g, '') ) {
@ -445,12 +435,28 @@
break; break;
case 'jquery' : case 'jquery' :
props.applyStyleFnName = 'animate'; props.applyStyleFnName = 'animate';
jQueryAnimation = true;
break; break;
case 'bestavailable' : case 'bestavailable' :
default : default :
props.applyStyleFnName = Modernizr.csstransitions ? 'css' : 'animate'; props.applyStyleFnName = Modernizr.csstransitions ? 'css' : 'animate';
} }
props.usingTransforms = Modernizr.csstransforms && Modernizr.csstransitions && !jQueryAnimation;
props.positionFn = props.usingTransforms ? $.molequul.translate : $.molequul.positionAbs;
// sorting
var originalOrderSorter = {
'original-order' : function( $elem ) {
return props.elemCount;
}
};
props.opts.getSortData = $.extend( originalOrderSorter, props.opts.getSortData );
props.atoms.$all.molequul( 'setupAtoms', props );
// get top left position of where the bricks should be // get top left position of where the bricks should be
var $cursor = $( document.createElement('div') ); var $cursor = $( document.createElement('div') );
this.prepend( $cursor ); this.prepend( $cursor );
@ -526,7 +532,7 @@
} else if ( !props.opts.resizeable && !!props.prevOpts.resizeable ) { } else if ( !props.opts.resizeable && !!props.prevOpts.resizeable ) {
$(window).unbind('smartresize.molequul'); $(window).unbind('smartresize.molequul');
} }
props.appending = false; props.appending = false;
// set all data so we can retrieve it for appended appendedContent // set all data so we can retrieve it for appended appendedContent
@ -553,8 +559,6 @@
}; };
$.molequul.position = $.molequul.usingTransforms ? $.molequul.translate : $.molequul.positionAbs;
// molequul code begin // molequul code begin
$.fn.molequul = function( firstArg ) { $.fn.molequul = function( firstArg ) {

Loading…
Cancel
Save