src/util/ZRTextureAtlasSurface.js
function (el, spriteWidth, spriteHeight) {
        // TODO, inner text, shadow
        var rect = el.getBoundingRect();

        var scaleX = spriteWidth / rect.width;
        var scaleY = spriteHeight / rect.height;
        el.position = [-rect.x * scaleX, -rect.y * scaleY];
        el.scale = [scaleX, scaleY];
        el.update();
    }
function (el, spriteWidth, spriteHeight) {
        // TODO, inner text, shadow
        var rect = el.getBoundingRect();

        var scaleX = spriteWidth / rect.width;
        var scaleY = spriteHeight / rect.height;
        el.position = [-rect.x * scaleX, -rect.y * scaleY];
        el.scale = [scaleX, scaleY];
        el.update();
    }
function ( el , spriteWidth , spriteHeight ) { // TODO, inner text, shadow var rect = el . getBoundingRect ( ) ; var scaleX = spriteWidth / rect . width ; var scaleY = spriteHeight / rect . height ; el . position = [ - rect . x * scaleX , - rect . y * scaleY ] ; el . scale = [ scaleX , scaleY ] ; el . update ( ) ; }
Fit element size by correct its position and scaling
@param {module:zrender/graphic/Displayable} el
@param {number} spriteWidth
@param {number} spriteHeight
Fit element size by correct its position and scaling