[not a Bug] CMlFrame.Size is always <100.0, 100.0>

Moderator: English Moderator

Post Reply
reaby
Posts: 956
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

[not a Bug] CMlFrame.Size is always <100.0, 100.0>

Post by reaby »

I was calculating bounding boxes using CMlFrame size and position... but it seems not to work right atm.

See attached manialink for testing:

Code: Select all

<frame pos="0 0" id="test">
<quad pos="0 0" z-index="0" size="20 20" bgcolor="FFFA"/>
</frame>
<script>
log(Page.GetFirstChild("test").Size);  // defaults always to <100,100>  --> example value here should be <20,20>
</script>
Hopefully this could be fixed :)
Last edited by reaby on 24 Feb 2019, 23:10, edited 1 time in total.
cgdb
Nadeo
Nadeo
Posts: 16
Joined: 23 Oct 2018, 12:33

Re: [Bug] CMlFrame.Size is always <100.0, 100.0>

Post by cgdb »

The size of a frame is not the size of its elements. A CMlFrame has a (relative) size which is completely independent from the sizes of its controls, in the same way it has its own position, rotation and scale. You can try to create a ManiaLink with a frame which has a "size" attribute and see it implements a basic form of clipping (but please don't use that, the "clip", "clipposn" and "clipsizen" attributes are better for that kind of stuff).
It is in fact not that simple to define the overall size of multiple controls. And even if you mean bounding box, it's sometimes hard to compute, when each control has its own position, rotation and scale.
So long story short : The size of frame is not related to the bounding box of its controls but its own thing (granted, it's not often useful). Computing the bounding box of multiple controls can be unexpectedly hard and intensive in some cases so it's not implemented in ManiaScript to avoid abuse. <100, 100> is merely a default value when there is none specified for that frame.
I hope this answer the question.
reaby
Posts: 956
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: [Bug] CMlFrame.Size is always <100.0, 100.0>

Post by reaby »

Many thanks for detailed answer about the issue :thumbsup:, seems it apparently is not a bug then :)
You can try to create a ManiaLink with a frame which has a "size" attribute and see it implements a basic form of clipping...
Yeah, also i found it that defining size for the frame also updates the size not to be "100. 100." but then it indeed applies this frame clipping for the contents, which i wish not to have this time.

Actually I managed to find a way-around for my usecase using data-attributes for defining the contents size manually for the frame and then calculating the bounding boxes then at maniascript.. It allowed me to check if the two contents overlaps :)
Post Reply

Return to “MP4.1 REPORTS / BUGS / INFORMATION”

Who is online

Users browsing this forum: No registered users and 1 guest