Ramu 0.7b doc
static bool
Rect.hasNegativeValueInWH(rect)
Parameters
Rect
rect: Rect that will be checked.
Return
bool
: True if it has a negative value or not in width
or height
.
Description
Checks if a rect has a negative value in width
or height
.
You can test this snippet of code here.
let gameObj = new GameObj(30, 50, 300, 20);
let txt = new Text('', 10, 10, 200);
gameObj.update = function(){
this.width -= 2;
const has = Rect.hasNegativeValueInWH(gameObj.toRect());
txt.text = (has ? 'has a negative value, width = ' : 'hasn\'t a negative value, width = ') + this.width;
if (has){
gameObj.destroy();
}
};
Ramu.init();
See also Rect.hasNegativeValue and Rect.hasNegativeValueInXY.