Browse Source

`initiated` -> `initialized`; trying to resolve multiple transforms

pull/14/head
desandro 15 years ago
parent
commit
f5ab896a54
  1. 48
      jquery.mercutio.js

48
jquery.mercutio.js

@ -24,6 +24,8 @@
continue; continue;
} }
console.log( props[i], m_style[ props[i] ] )
if ( m_style[ props[i] ] !== undefined ) { if ( m_style[ props[i] ] !== undefined ) {
return true; return true;
} }
@ -261,17 +263,33 @@
}); });
}, },
// parseTransformStyle : function( style ) {
// for ( prop in style ) {
// switch
// }
// return style;
// },
complete : function( props ) { complete : function( props ) {
// are we animating the layout arrangement? // are we animating the layout arrangement?
// use plugin-ish syntax for css or animate // use plugin-ish syntax for css or animate
var styleFn = ( props.initiated && props.opts.animate ) ? 'animate' : 'css', var styleFn = ( props.initialized && props.opts.animate ) ? 'animate' : 'css',
animOpts = props.opts.animationOptions; animOpts = props.opts.animationOptions;
// process styleQueue // process styleQueue
$.each( props.styleQueue, function( i, obj ){ $.each( props.styleQueue, function( i, obj ){
// have to extend animation to play nice with jQuery // var style = mercutioMethods.parseTransformStyle( obj.style );
for ( var prop in obj.style ) {
console.log( prop, obj.style[prop] )
// switch ( obj.style[prop] ) {
// case 'scale' :
// console.log( obj.style )
// break;
// }
}
// have to extend animation to play nice with jQuery
obj.$el[ styleFn ]( obj.style, $.extend( {}, animOpts ) ); obj.$el[ styleFn ]( obj.style, $.extend( {}, animOpts ) );
}); });
@ -295,6 +313,8 @@
var props = this.data('mercutio'); var props = this.data('mercutio');
// console.log( props.opts.hiddenStyle.scale )
// layout logic // layout logic
var layoutMode = props.opts.singleMode ? 'singleColumn' : 'multiColumn'; var layoutMode = props.opts.singleMode ? 'singleColumn' : 'multiColumn';
@ -328,13 +348,13 @@
var props = this.data('mercutio'), var props = this.data('mercutio'),
prevColCount = props.colCount; prevColCount = props.colCount;
props.initiated = true; props.initialized = true;
// get updated colCount // get updated colCount
this.mercutio( 'getColCount', props ); this.mercutio( 'getColCount', props );
if ( props.colCount !== prevColCount ) { if ( props.colCount !== prevColCount ) {
// if column count has changed, do a new column cound // if column count has changed, do a new column cound
var colYs = this.mercutio( 'resetColYs', props ); var colYs = mercutioMethods.resetColYs( props );
this.mercutio( 'layout', props.$cards.filtered, colYs ); this.mercutio( 'layout', props.$cards.filtered, colYs );
} }
@ -365,7 +385,7 @@
// if colW == 0, back out before divide by zero // if colW == 0, back out before divide by zero
if ( !props.colW ) { if ( !props.colW ) {
window.console && console.error('Column width calculated to be zero. Stopping Mercutio plugin before divide by zero. Check that the width of first child inside the masonry container is not zero.'); window.console && console.error('Column width calculated to be zero. Stopping Mercutio plugin before divide by zero. Check that the width of first child inside the mercutio container is not zero.');
return this; return this;
} }
@ -405,9 +425,9 @@
props = data || {}; props = data || {};
// checks if masonry has been called before on this object // checks if masonry has been called before on this object
props.initiated = !!data; props.initialized = !!data;
var previousOptions = props.initiated ? data.opts : {}; var previousOptions = props.initialized ? data.opts : {};
props.opts = $.extend( props.opts = $.extend(
{}, {},
@ -418,11 +438,11 @@
$this.data( 'mercutio', props ); $this.data( 'mercutio', props );
if ( !props.initiated ) { if ( !props.initialized ) {
$this.mercutio( 'setup' ); $this.mercutio( 'setup' );
} }
var colYs = $this.mercutio( 'resetColYs', props ); var colYs = mercutioMethods.resetColYs( props );
$this $this
.mercutio( 'filter', props.$cards.all ) .mercutio( 'filter', props.$cards.all )
.mercutio( 'layout', props.$cards.filtered, colYs ); .mercutio( 'layout', props.$cards.filtered, colYs );
@ -449,11 +469,11 @@
}, },
translate : function( x, y ) { translate : function( x, y ) {
return mercutioMethods.transform('translate(' + x + 'px, ' + y + 'px)') return mercutioMethods.transform('translate(' + x + 'px, ' + y + 'px) scale(1)')
}, },
translate3d : function( x, y ) { translate3d : function( x, y ) {
return mercutioMethods.transform('translate3d(' + x + 'px, ' + y + 'px, 0)') return mercutioMethods.transform('translate3d(' + x + 'px, ' + y + 'px, 0) scale(1)')
}, },
positionAbs : function( x, y ) { positionAbs : function( x, y ) {
@ -499,10 +519,12 @@
resizeable: true, resizeable: true,
hiddenClass : 'mercutio-hidden', hiddenClass : 'mercutio-hidden',
hiddenStyle : { hiddenStyle : {
opacity : 0 opacity : 0,
scale: 0.001
}, },
visibleStyle : { visibleStyle : {
opacity : 1 opacity : 1,
scale: 1
}, },
animationOptions: { animationOptions: {
queue: false queue: false

Loading…
Cancel
Save