Why GetBoundingRect isn't instance of cr.rect

For developers using the Construct 2 Javascript SDK

Post » Fri May 13, 2016 8:09 am

Hello,
I wrote a method for cr.rect class (in edittime.js):
Code: Select all
cr.rect.prototype.height = function () {
    return Math.abs(this.top - this.bottom)
}

But I can't access this method from result of [i]instance.GetBoundingRect()[i]

I wrote this test code:
Code: Select all
var x = 0;

IDEInstance.prototype.Draw = function(renderer)
{
    var rect = this.instance.GetBoundingRect()
    if (x == 0) {
        alert(rect instanceof cr.rect);
        x = 1;
    }
}

And it alerted false :shock: while in documentation is written:
instance.GetBoundingRect()
Return a cr.rect object specifying the object's axis-aligned bounding rectangle.
B
26
S
6
G
3
Posts: 14
Reputation: 3,138

Post » Fri May 13, 2016 11:01 am

There isn't a method called GetBoundingRect(), so I'm not sure how that code even ran? Nor is that quote in the documentation. What exactly are you looking at?
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,351


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests