This commit is contained in:
Kiritan Flux 2018-12-05 13:22:41 +01:00
parent 05cf48534a
commit 83558f7bce
173 changed files with 1289 additions and 9312 deletions

View file

@ -133,13 +133,16 @@ proto.getPosition = function() {
var isOriginTop = this.layout._getOption('originTop');
var xValue = style[ isOriginLeft ? 'left' : 'right' ];
var yValue = style[ isOriginTop ? 'top' : 'bottom' ];
var x = parseFloat( xValue );
var y = parseFloat( yValue );
// convert percent to pixels
var layoutSize = this.layout.size;
var x = xValue.indexOf('%') != -1 ?
( parseFloat( xValue ) / 100 ) * layoutSize.width : parseInt( xValue, 10 );
var y = yValue.indexOf('%') != -1 ?
( parseFloat( yValue ) / 100 ) * layoutSize.height : parseInt( yValue, 10 );
if ( xValue.indexOf('%') != -1 ) {
x = ( x / 100 ) * layoutSize.width;
}
if ( yValue.indexOf('%') != -1 ) {
y = ( y / 100 ) * layoutSize.height;
}
// clean up 'auto' or other non-integer values
x = isNaN( x ) ? 0 : x;
y = isNaN( y ) ? 0 : y;
@ -202,9 +205,7 @@ proto._transitionTo = function( x, y ) {
var curX = this.position.x;
var curY = this.position.y;
var compareX = parseInt( x, 10 );
var compareY = parseInt( y, 10 );
var didNotMove = compareX === this.position.x && compareY === this.position.y;
var didNotMove = x == this.position.x && y == this.position.y;
// save end position
this.setPosition( x, y );
@ -247,8 +248,8 @@ proto.goTo = function( x, y ) {
proto.moveTo = proto._transitionTo;
proto.setPosition = function( x, y ) {
this.position.x = parseInt( x, 10 );
this.position.y = parseInt( y, 10 );
this.position.x = parseFloat( x );
this.position.y = parseFloat( y );
};
// ----- transition ----- //

View file

@ -1,5 +1,5 @@
/*!
* Outlayer v2.1.0
* Outlayer v2.1.1
* the brains and guts of a layout library
* MIT license
*/