diff --git a/src/Drawable.js b/src/Drawable.js index bc4028ae..23c1ad82 100644 --- a/src/Drawable.js +++ b/src/Drawable.js @@ -380,6 +380,14 @@ Drawable.prototype._setSkinSize = function (width, height, costumeResolution) { this.setConvexHullDirty(); }; +/** + * Get the size of the Drawable's current skin. + * @return {Array.} Skin size, width and height. + */ +Drawable.prototype.getSkinSize = function () { + return this._uniforms.u_skinSize.slice(); +}; + /** * Calculate the transform to use when rendering this Drawable. * @private diff --git a/src/RenderWebGL.js b/src/RenderWebGL.js index 3bd2a3aa..d54540a9 100644 --- a/src/RenderWebGL.js +++ b/src/RenderWebGL.js @@ -225,6 +225,15 @@ RenderWebGL.prototype.getBounds = function (drawableID) { return bounds; }; +/** + * Get the current skin (costume) size of a Drawable. + * @param {int} drawableID The ID of the Drawable to measure. + * @return {Array.} Skin size, width and height. + */ +RenderWebGL.prototype.getSkinSize = function (drawableID) { + const drawable = Drawable.getDrawableByID(drawableID); + return drawable.getSkinSize(); +}; /** * Check if a particular Drawable is touching a particular color.