mirror of
https://github.com/scratchfoundation/scratch-render.git
synced 2025-07-28 06:59:23 -04:00
Expose skin/costume size (#45)
* Expose skin/costume size * Return skin size as a copy
This commit is contained in:
parent
a62d52a2d0
commit
1fa97d248b
2 changed files with 17 additions and 0 deletions
|
@ -380,6 +380,14 @@ Drawable.prototype._setSkinSize = function (width, height, costumeResolution) {
|
|||
this.setConvexHullDirty();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the size of the Drawable's current skin.
|
||||
* @return {Array.<number>} 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
|
||||
|
|
|
@ -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.<number>} 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue