function resizeIt() {
    if (theParent.clientWidth > theParent.clientHeight) {
        if (size == 'Default') {
            pixelDensity(2);
            theHeight = theParent.clientHeight;
            theWidth = theParent.clientWidth;
        } else if (size == 'Letter') {
            pixelDensity(6);
            theHeight = theParent.clientHeight;
            theWidth = theHeight / 11 * 8.5;       
       }  else if (size == 'Tabloid') {
            pixelDensity(6);
            theHeight = theParent.clientHeight;
            theWidth = theHeight / 17 * 11;
        } else if (size == 'Poster') {
            pixelDensity(12);
            theHeight = theParent.clientHeight;
            theWidth = theHeight / 4 * 3;
        } else if (size == 'Square') {
            pixelDensity(4);
            if (theParent.clientWidth < theParent.clientHeight) {
                theHeight = theParent.clientWidth;
                theWidth = theParent.clientWidth;
            } else if (theParent.clientWidth > theParent.clientHeight) {
                theHeight = theParent.clientHeight;
                theWidth = theParent.clientHeight;            
            }
        } else if (size == 'Portrait') {
            pixelDensity(2);
            theHeight = theParent.clientHeight;
            theWidth = theHeight * .8;
        } else if (size == 'Landscape') {
            pixelDensity(2);
            if (theParent.clientHeight < theParent.clientWidth * .559) {           
                theHeight = theParent.clientHeight;
                theWidth = theHeight * 1.789;
            } else {
                theWidth = theParent.clientWidth;
                theHeight = theWidth * .559;
            }
        }
        
    } else if (theParent.clientWidth < theParent.clientHeight) {
        if (size == 'Default') {
            pixelDensity(2);
            theHeight = theParent.clientHeight;
            theWidth = theParent.clientWidth;
        } else if (size == 'Letter') {
            pixelDensity(3);
            theWidth = theParent.clientWidth; 
            theHeight = theWidth / 8.5 * 11;
       }  else if (size == 'Tabloid') {
            pixelDensity(3);
            if ((theWidth / 11 * 17) < theParent.clientHeight) {
                theWidth = theParent.clientWidth; 
                theHeight = theWidth / 11 * 17;
            } else {
                theHeight = theParent.clientHeight;
                theWidth = theHeight / 17 * 11;
            }
        } else if (size == 'Poster') {
            pixelDensity(3);
            theWidth = theParent.clientWidth;
            theHeight = theWidth / 3 * 4;
        } else if (size == 'Square') {
            pixelDensity(2);
            theWidth = theParent.clientWidth;
            theHeight = theWidth;
        } else if (size == 'Portrait') {
            pixelDensity(2);
            theWidth = theParent.clientWidth;
            theHeight = theWidth * 1.2;
        } else if (size == 'Landscape') {
            pixelDensity(2);
                theWidth = theParent.clientWidth;
                theHeight = theWidth / 1.789;
        }
    }
    
    theWidth = floor(theWidth);
    theHeight = floor(theHeight);
    
    sizeChange = false;
    
    background(255);    resizeCanvas(theWidth, theHeight);    background(bgColor);
}
//    resize according to settings and limitations of the document
resize according to settings and limitations of the document
resize according to settings and limitations of the document
function resizeIt() {
    if (theParent.clientWidth > theParent.clientHeight) {
        if (size == 'Default') {
            pixelDensity(2);
            theHeight = theParent.clientHeight;
            theWidth = theParent.clientWidth;
        } else if (size == 'Letter') {
            pixelDensity(6);
            theHeight = theParent.clientHeight;
            theWidth = theHeight / 11 * 8.5;       
       }  else if (size == 'Tabloid') {
            pixelDensity(6);
            theHeight = theParent.clientHeight;
            theWidth = theHeight / 17 * 11;
        } else if (size == 'Poster') {
            pixelDensity(12);
            theHeight = theParent.clientHeight;
            theWidth = theHeight / 4 * 3;
        } else if (size == 'Square') {
            pixelDensity(4);
            if (theParent.clientWidth < theParent.clientHeight) {
                theHeight = theParent.clientWidth;
                theWidth = theParent.clientWidth;
            } else if (theParent.clientWidth > theParent.clientHeight) {
                theHeight = theParent.clientHeight;
                theWidth = theParent.clientHeight;            
            }
        } else if (size == 'Portrait') {
            pixelDensity(2);
            theHeight = theParent.clientHeight;
            theWidth = theHeight * .8;
        } else if (size == 'Landscape') {
            pixelDensity(2);
            if (theParent.clientHeight < theParent.clientWidth * .559) {           
                theHeight = theParent.clientHeight;
                theWidth = theHeight * 1.789;
            } else {
                theWidth = theParent.clientWidth;
                theHeight = theWidth * .559;
            }
        }
    } else if (theParent.clientWidth < theParent.clientHeight) {
        if (size == 'Default') {
            pixelDensity(2);
            theHeight = theParent.clientHeight;
            theWidth = theParent.clientWidth;
        } else if (size == 'Letter') {
            pixelDensity(3);
            theWidth = theParent.clientWidth; 
            theHeight = theWidth / 8.5 * 11;
       }  else if (size == 'Tabloid') {
            pixelDensity(3);
            if ((theWidth / 11 * 17) < theParent.clientHeight) {
                theWidth = theParent.clientWidth; 
                theHeight = theWidth / 11 * 17;
            } else {
                theHeight = theParent.clientHeight;
                theWidth = theHeight / 17 * 11;
            }
        } else if (size == 'Poster') {
            pixelDensity(3);
            theWidth = theParent.clientWidth;
            theHeight = theWidth / 3 * 4;
        } else if (size == 'Square') {
            pixelDensity(2);
            theWidth = theParent.clientWidth;
            theHeight = theWidth;
        } else if (size == 'Portrait') {
            pixelDensity(2);
            theWidth = theParent.clientWidth;
            theHeight = theWidth * 1.2;
        } else if (size == 'Landscape') {
            pixelDensity(2);
                theWidth = theParent.clientWidth;
                theHeight = theWidth / 1.789;
        }
    }
    theWidth = floor(theWidth);
    theHeight = floor(theHeight);
    sizeChange = false;
    background(255);    resizeCanvas(theWidth, theHeight);    background(bgColor);
}
function resizeIt ( ) { if ( theParent . clientWidth > theParent . clientHeight ) { if ( size == 'Default' ) { pixelDensity ( 2 ) ; theHeight = theParent . clientHeight ; theWidth = theParent . clientWidth ; } else if ( size == 'Letter' ) { pixelDensity ( 6 ) ; theHeight = theParent . clientHeight ; theWidth = theHeight / 11 * 8.5 ; } else if ( size == 'Tabloid' ) { pixelDensity ( 6 ) ; theHeight = theParent . clientHeight ; theWidth = theHeight / 17 * 11 ; } else if ( size == 'Poster' ) { pixelDensity ( 12 ) ; theHeight = theParent . clientHeight ; theWidth = theHeight / 4 * 3 ; } else if ( size == 'Square' ) { pixelDensity ( 4 ) ; if ( theParent . clientWidth < theParent . clientHeight ) { theHeight = theParent . clientWidth ; theWidth = theParent . clientWidth ; } else if ( theParent . clientWidth > theParent . clientHeight ) { theHeight = theParent . clientHeight ; theWidth = theParent . clientHeight ; } } else if ( size == 'Portrait' ) { pixelDensity ( 2 ) ; theHeight = theParent . clientHeight ; theWidth = theHeight * .8 ; } else if ( size == 'Landscape' ) { pixelDensity ( 2 ) ; if ( theParent . clientHeight < theParent . clientWidth * .559 ) { theHeight = theParent . clientHeight ; theWidth = theHeight * 1.789 ; } else { theWidth = theParent . clientWidth ; theHeight = theWidth * .559 ; } } } else if ( theParent . clientWidth < theParent . clientHeight ) { if ( size == 'Default' ) { pixelDensity ( 2 ) ; theHeight = theParent . clientHeight ; theWidth = theParent . clientWidth ; } else if ( size == 'Letter' ) { pixelDensity ( 3 ) ; theWidth = theParent . clientWidth ; theHeight = theWidth / 8.5 * 11 ; } else if ( size == 'Tabloid' ) { pixelDensity ( 3 ) ; if ( ( theWidth / 11 * 17 ) < theParent . clientHeight ) { theWidth = theParent . clientWidth ; theHeight = theWidth / 11 * 17 ; } else { theHeight = theParent . clientHeight ; theWidth = theHeight / 17 * 11 ; } } else if ( size == 'Poster' ) { pixelDensity ( 3 ) ; theWidth = theParent . clientWidth ; theHeight = theWidth / 3 * 4 ; } else if ( size == 'Square' ) { pixelDensity ( 2 ) ; theWidth = theParent . clientWidth ; theHeight = theWidth ; } else if ( size == 'Portrait' ) { pixelDensity ( 2 ) ; theWidth = theParent . clientWidth ; theHeight = theWidth * 1.2 ; } else if ( size == 'Landscape' ) { pixelDensity ( 2 ) ; theWidth = theParent . clientWidth ; theHeight = theWidth / 1.789 ; } } theWidth = floor ( theWidth ) ; theHeight = floor ( theHeight ) ; sizeChange = false ; background ( 255 ) ; resizeCanvas ( theWidth , theHeight ) ; background ( bgColor ) ; }
resize according to settings and limitations of the document
resize according to settings and limitations of the document