function draw(zoom, mousePosition) {
            if (!this.loaded) {
                this.fail('Attempting to draw tile ' + this.toString() + ' when it\'s not yet loaded.');
            }

            var context = this.canvasContext,
                position = this.position,
                size = this.size,
                image = this.image;

            if (zoom != null && zoom !== 1) {
                position = position
                    .minus(mousePosition)
                    .multiply(zoom)
                    .plus(mousePosition);
                size.x *= zoom;
                size.y *= zoom;
            }

            if (!this.subpixelTileParameters) {
                position.x = Math.floor(position.x);
                position.y = Math.floor(position.y);
                size.x = Math.ceil(size.x);
                size.y = Math.ceil(size.y);
            }

            context.globalAlpha = this.opacity;
            try {
                context.drawImage(image, position.x, position.y, size.x, size.y);
            } catch (e) {
                console.error('context.drawImage error.', image, position.x, position.y, size.x, size.y);
                throw e;
            }
            if (this.config.debugTileBorders) {
                context.strokeRect(position.x, position.y, size.x, size.y);
            }
            context.globalAlpha = 1;

            return this;
        }
/**
         * Draws the tile on canvas. Optionally applies zoom needed for magnifier support
         * and in that case makes it so both the usual and enlarged tile is identical
         * around <code>mousePosition</code>.
         *
         * @param {number} [zoom=1]
         * @param {Malakh.Point} [mousePosition]
         */
Draws the tile on canvas. Optionally applies zoom needed for magnifier support
and in that case makes it so both the usual and enlarged tile is identical
around mousePosition.

@param {number} [zoom=1]
@param {Malakh.Point} [mousePosition]
Draws the tile on canvas . Optionally applies zoom needed for magnifier support and in that case makes it so both the usual and enlarged tile is identical around mousePosition . @param { number } [ zoom = 1 ] @param { Malakh . Point } [ mousePosition ]
function draw(zoom, mousePosition) {
            if (!this.loaded) {
                this.fail('Attempting to draw tile ' + this.toString() + ' when it\'s not yet loaded.');
            }
            var context = this.canvasContext,
                position = this.position,
                size = this.size,
                image = this.image;
            if (zoom != null && zoom !== 1) {
                position = position
                    .minus(mousePosition)
                    .multiply(zoom)
                    .plus(mousePosition);
                size.x *= zoom;
                size.y *= zoom;
            }
            if (!this.subpixelTileParameters) {
                position.x = Math.floor(position.x);
                position.y = Math.floor(position.y);
                size.x = Math.ceil(size.x);
                size.y = Math.ceil(size.y);
            }
            context.globalAlpha = this.opacity;
            try {
                context.drawImage(image, position.x, position.y, size.x, size.y);
            } catch (e) {
                console.error('context.drawImage error.', image, position.x, position.y, size.x, size.y);
                throw e;
            }
            if (this.config.debugTileBorders) {
                context.strokeRect(position.x, position.y, size.x, size.y);
            }
            context.globalAlpha = 1;
            return this;
        }
function draw ( zoom , mousePosition ) { if ( ! this . loaded ) { this . fail ( 'Attempting to draw tile ' + this . toString ( ) + ' when it\'s not yet loaded.' ) ; } var context = this . canvasContext , position = this . position , size = this . size , image = this . image ; if ( zoom != null && zoom !== 1 ) { position = position . minus ( mousePosition ) . multiply ( zoom ) . plus ( mousePosition ) ; size . x *= zoom ; size . y *= zoom ; } if ( ! this . subpixelTileParameters ) { position . x = Math . floor ( position . x ) ; position . y = Math . floor ( position . y ) ; size . x = Math . ceil ( size . x ) ; size . y = Math . ceil ( size . y ) ; } context . globalAlpha = this . opacity ; try { context . drawImage ( image , position . x , position . y , size . x , size . y ) ; } catch ( e ) { console . error ( 'context.drawImage error.' , image , position . x , position . y , size . x , size . y ) ; throw e ; } if ( this . config . debugTileBorders ) { context . strokeRect ( position . x , position . y , size . x , size . y ) ; } context . globalAlpha = 1 ; return this ; }
Draws the tile on canvas.
Draws the tile on canvas .