src/Display.js
function draw_layer(layer, x, y) {

            // Draw layer
            if (layer.width > 0 && layer.height > 0) {

                // Save and update alpha
                var initial_alpha = context.globalAlpha;
                context.globalAlpha *= layer.alpha / 255.0;

                // Copy data
                context.drawImage(layer.getCanvas(), x, y);

                // Draw all children
                var children = get_children(layer);
                for (var i=0; i<children.length; i++) {
                    var child = children[i];
                    draw_layer(child, x + child.x, y + child.y);
                }

                // Restore alpha
                context.globalAlpha = initial_alpha;

            }

        }
function draw_layer(layer, x, y) {

            // Draw layer
            if (layer.width > 0 && layer.height > 0) {

                // Save and update alpha
                var initial_alpha = context.globalAlpha;
                context.globalAlpha *= layer.alpha / 255.0;

                // Copy data
                context.drawImage(layer.getCanvas(), x, y);

                // Draw all children
                var children = get_children(layer);
                for (var i=0; i<children.length; i++) {
                    var child = children[i];
                    draw_layer(child, x + child.x, y + child.y);
                }

                // Restore alpha
                context.globalAlpha = initial_alpha;

            }

        }
function draw_layer ( layer , x , y ) { // Draw layer if ( layer . width > 0 && layer . height > 0 ) { // Save and update alpha var initial_alpha = context . globalAlpha ; context . globalAlpha *= layer . alpha / 255.0 ; // Copy data context . drawImage ( layer . getCanvas ( ) , x , y ) ; // Draw all children var children = get_children ( layer ) ; for ( var i = 0 ; i < children . length ; i ++ ) { var child = children [ i ] ; draw_layer ( child , x + child . x , y + child . y ) ; } // Restore alpha context . globalAlpha = initial_alpha ; } }
Draws the contents of the given layer at the given coordinates
Draws the contents of the given layer at the given coordinates