demos/js/demo_multiparty.js
function setThumbSizeAspect(percentSize, percentLeft, percentTop, parentw, parenth, aspect) {

    var width, height;
    if( parentw < parenth*aspectRatio){
        width = parentw * percentSize;
        height = width/aspect;
    }
    else {
        height = parenth * percentSize;
        width = height*aspect;
    }
    var left;
    if( percentLeft < 0) {
        left = parentw - width;
    }
    else {
        left = 0;
    }
    left += Math.floor(percentLeft*parentw);
    var top = 0;
    if( percentTop < 0) {
        top = parenth - height;
    }
    else {
        top = 0;
    }
    top += Math.floor(percentTop*parenth);
    return {
        left:left,
        top:top,
        width:width,
        height:height
    };
}
function setThumbSizeAspect(percentSize, percentLeft, percentTop, parentw, parenth, aspect) {

    var width, height;
    if( parentw < parenth*aspectRatio){
        width = parentw * percentSize;
        height = width/aspect;
    }
    else {
        height = parenth * percentSize;
        width = height*aspect;
    }
    var left;
    if( percentLeft < 0) {
        left = parentw - width;
    }
    else {
        left = 0;
    }
    left += Math.floor(percentLeft*parentw);
    var top = 0;
    if( percentTop < 0) {
        top = parenth - height;
    }
    else {
        top = 0;
    }
    top += Math.floor(percentTop*parenth);
    return {
        left:left,
        top:top,
        width:width,
        height:height
    };
}
function setThumbSizeAspect ( percentSize , percentLeft , percentTop , parentw , parenth , aspect ) { var width , height ; if ( parentw < parenth * aspectRatio ) { width = parentw * percentSize ; height = width / aspect ; } else { height = parenth * percentSize ; width = height * aspect ; } var left ; if ( percentLeft < 0 ) { left = parentw - width ; } else { left = 0 ; } left += Math . floor ( percentLeft * parentw ) ; var top = 0 ; if ( percentTop < 0 ) { top = parenth - height ; } else { top = 0 ; } top += Math . floor ( percentTop * parenth ) ; return { left : left , top : top , width : width , height : height } ; }
a negative percentLeft is interpreted as setting the right edge of the object that distance from the right edge of the parent. Similar for percentTop.
a negative percentLeft is interpreted as setting the right edge of the object that distance from the right edge of the parent . Similar for percentTop .