lib/componentmanager.js
function _deriveComponent(def, basic) {
        var derived = _shallowCopy(basic);

        if (def.hasOwnProperty("folder")) {
            if (derived.hasOwnProperty("folder")) {
                var folder = def.folder.concat(basic.folder);
                derived.folder = folder;
            } else {
                derived.folder = def.folder;
            }
        }

        if (def.hasOwnProperty("suffix")) {
            var index = basic.file.lastIndexOf("."),
                filename = basic.file.substring(0, index),
                extension = basic.file.substring(index);

            derived.file = filename + def.suffix + extension;
        }

        if (def.hasOwnProperty("scale") ||
                def.hasOwnProperty("width") ||
                def.hasOwnProperty("height")) {
            if (!derived.hasOwnProperty("scale") &&
                    !derived.hasOwnProperty("width") &&
                    !derived.hasOwnProperty("height")) {

                if (def.hasOwnProperty("scale")) {
                    derived.scale = def.scale;
                }

                if (def.hasOwnProperty("width")) {
                    derived.width = def.width;
                }

                if (def.hasOwnProperty("height")) {
                    derived.height = def.height;
                }
            }
        }
        
        if (def.hasOwnProperty("canvasWidth") ||
                def.hasOwnProperty("canvasHeight") ||
                def.hasOwnProperty("canvasOffsetX") ||
                def.hasOwnProperty("canvasOffsetY")) {
            if (!derived.hasOwnProperty("canvasWidth") &&
                    !derived.hasOwnProperty("canvasHeight") &&
                    !derived.hasOwnProperty("canvasOffsetX") &&
                    !derived.hasOwnProperty("canvasOffsetY")) {

                if (def.hasOwnProperty("canvasWidth")) {
                    derived.canvasWidth = def.canvasWidth;
                }

                if (def.hasOwnProperty("canvasHeight")) {
                    derived.canvasHeight = def.canvasHeight;
                }

                if (def.hasOwnProperty("canvasOffsetX")) {
                    derived.canvasOffsetX = def.canvasOffsetX;
                }

                if (def.hasOwnProperty("canvasOffsetY")) {
                    derived.canvasOffsetY = def.canvasOffsetY;
                }
            }
        }


        if (def.hasOwnProperty("quality")) {
            if (!derived.hasOwnProperty("quality")) {
                derived.quality = def.quality;
            }
        }

        derived.id = def.id + ":" + basic.id;
        derived.assetPath = _getAssetPath(derived);
        derived.default = def;

        return derived;
    }
function _deriveComponent(def, basic) {
        var derived = _shallowCopy(basic);

        if (def.hasOwnProperty("folder")) {
            if (derived.hasOwnProperty("folder")) {
                var folder = def.folder.concat(basic.folder);
                derived.folder = folder;
            } else {
                derived.folder = def.folder;
            }
        }

        if (def.hasOwnProperty("suffix")) {
            var index = basic.file.lastIndexOf("."),
                filename = basic.file.substring(0, index),
                extension = basic.file.substring(index);

            derived.file = filename + def.suffix + extension;
        }

        if (def.hasOwnProperty("scale") ||
                def.hasOwnProperty("width") ||
                def.hasOwnProperty("height")) {
            if (!derived.hasOwnProperty("scale") &&
                    !derived.hasOwnProperty("width") &&
                    !derived.hasOwnProperty("height")) {

                if (def.hasOwnProperty("scale")) {
                    derived.scale = def.scale;
                }

                if (def.hasOwnProperty("width")) {
                    derived.width = def.width;
                }

                if (def.hasOwnProperty("height")) {
                    derived.height = def.height;
                }
            }
        }
        
        if (def.hasOwnProperty("canvasWidth") ||
                def.hasOwnProperty("canvasHeight") ||
                def.hasOwnProperty("canvasOffsetX") ||
                def.hasOwnProperty("canvasOffsetY")) {
            if (!derived.hasOwnProperty("canvasWidth") &&
                    !derived.hasOwnProperty("canvasHeight") &&
                    !derived.hasOwnProperty("canvasOffsetX") &&
                    !derived.hasOwnProperty("canvasOffsetY")) {

                if (def.hasOwnProperty("canvasWidth")) {
                    derived.canvasWidth = def.canvasWidth;
                }

                if (def.hasOwnProperty("canvasHeight")) {
                    derived.canvasHeight = def.canvasHeight;
                }

                if (def.hasOwnProperty("canvasOffsetX")) {
                    derived.canvasOffsetX = def.canvasOffsetX;
                }

                if (def.hasOwnProperty("canvasOffsetY")) {
                    derived.canvasOffsetY = def.canvasOffsetY;
                }
            }
        }


        if (def.hasOwnProperty("quality")) {
            if (!derived.hasOwnProperty("quality")) {
                derived.quality = def.quality;
            }
        }

        derived.id = def.id + ":" + basic.id;
        derived.assetPath = _getAssetPath(derived);
        derived.default = def;

        return derived;
    }
function _deriveComponent ( def , basic ) { var derived = _shallowCopy ( basic ) ; if ( def . hasOwnProperty ( "folder" ) ) { if ( derived . hasOwnProperty ( "folder" ) ) { var folder = def . folder . concat ( basic . folder ) ; derived . folder = folder ; } else { derived . folder = def . folder ; } } if ( def . hasOwnProperty ( "suffix" ) ) { var index = basic . file . lastIndexOf ( "." ) , filename = basic . file . substring ( 0 , index ) , extension = basic . file . substring ( index ) ; derived . file = filename + def . suffix + extension ; } if ( def . hasOwnProperty ( "scale" ) || def . hasOwnProperty ( "width" ) || def . hasOwnProperty ( "height" ) ) { if ( ! derived . hasOwnProperty ( "scale" ) && ! derived . hasOwnProperty ( "width" ) && ! derived . hasOwnProperty ( "height" ) ) { if ( def . hasOwnProperty ( "scale" ) ) { derived . scale = def . scale ; } if ( def . hasOwnProperty ( "width" ) ) { derived . width = def . width ; } if ( def . hasOwnProperty ( "height" ) ) { derived . height = def . height ; } } } if ( def . hasOwnProperty ( "canvasWidth" ) || def . hasOwnProperty ( "canvasHeight" ) || def . hasOwnProperty ( "canvasOffsetX" ) || def . hasOwnProperty ( "canvasOffsetY" ) ) { if ( ! derived . hasOwnProperty ( "canvasWidth" ) && ! derived . hasOwnProperty ( "canvasHeight" ) && ! derived . hasOwnProperty ( "canvasOffsetX" ) && ! derived . hasOwnProperty ( "canvasOffsetY" ) ) { if ( def . hasOwnProperty ( "canvasWidth" ) ) { derived . canvasWidth = def . canvasWidth ; } if ( def . hasOwnProperty ( "canvasHeight" ) ) { derived . canvasHeight = def . canvasHeight ; } if ( def . hasOwnProperty ( "canvasOffsetX" ) ) { derived . canvasOffsetX = def . canvasOffsetX ; } if ( def . hasOwnProperty ( "canvasOffsetY" ) ) { derived . canvasOffsetY = def . canvasOffsetY ; } } } if ( def . hasOwnProperty ( "quality" ) ) { if ( ! derived . hasOwnProperty ( "quality" ) ) { derived . quality = def . quality ; } } derived . id = def . id + ":" + basic . id ; derived . assetPath = _getAssetPath ( derived ) ; derived . default = def ; return derived ; }
Create a single derived component from a given default component and basic
component.

@private
@param {Component} def A default component
@param {Component} basic A basic component
@return {Component} The derived component
Create a single derived component from a given default component and basic component .