Frame clipping

Talk about ManiaLink development in this forum

Moderator: NADEO

Post Reply
zocka
Posts: 205
Joined: 15 Jun 2010, 17:56

Frame clipping

Post by zocka » 25 Jan 2015, 18:53

I tried around a bit with the clip attributes on frames, but it seems somewhat strange to me.

I had the impression that the clipposn is aligned at the the center of the clipsizen, so I calculate

Code: Select all

container.ClipWindowSize = button.Size * button.AbsoluteScale;
container.ClipWindowRelativePosition = button.Size * button.AbsoluteScale;
container.ClipWindowRelativePosition.X *= 0.5;
container.ClipWindowRelativePosition.Y *= -0.5;
(with button being the frame's "bounding" element)
(whole code)

However it seems to be off a certain amount (additionally dependent on the frame's position it appears to me).
If you take a look at my example at [maniaplanet]zockaml?demo=ripple[/maniaplanet] you will notice that
  • it will cut off the frame when I move the cursor over it
  • it will cut off a bit the side (left three buttons are clipped right, right buttons are clipped left, more clipping with a bigger distance to the middle)
(You can see actually clipped area when clicking the buttons)

Is this still some experimental feature or did I make false assumptions regarding the usage?
manialink minigame shatter
my manialink: zockaml
my maniaflash: maniaflash?zocka

GabrielM
Posts: 243
Joined: 13 Jan 2012, 16:53

Re: Frame clipping

Post by GabrielM » 26 Jan 2015, 13:07

Well i tried using it a few times and it's indeed a bit baffling sometime and it's still not really clear in my head.
From what i've understood :
The clip is center aligned on vertical and horizontal axis.
So if you want your button to be fully visible in the clip it should be something like that :

Code: Select all

<frame id="Frame_Containter" posn="0 0" clip="True" clipposn="0 0" clipsizen="{{{ButtonSizeX}}} {{{ButtonSizeY}}}" >
   <quad id="Button_TheButton" posn="0 0" sizen="{{{ButtonSizeX}}} {{{ButtonSizeY}}}" valign="center" halign="center" />
</frame>
However, if you chose a different valign or halign, you have indeed to move the clip (or the button) of half of the size of the button, in the proper direction.

In your example i think there's something wrong here :
zocka wrote:

Code: Select all

container.ClipWindowRelativePosition.X *= 0.5;
container.ClipWindowRelativePosition.Y *= -0.5;
It should be (for a Top Left aligned button) :

Code: Select all

container.ClipWindowRelativePosition.X += button.Size.X * 0.5;
container.ClipWindowRelativePosition.Y -= button.Size.Y * 0.5;
And by the way, it felt a bit buggy for me too, like the positioning of the clip is not really precise, depending on the window resolution or something..
Also i had some issues using the .ClipWindowActive, so i never acces it by the script for now, meaning i never disable any clipping area.
The problem being that it's recommanded in terms of performance to disable all the clipping area you don't use anymore (hidden frames etc) to keep their count at a minimum. So if you don't have any bug, do the proper thing, but if you do, check by doing it "the dirty way".

zocka
Posts: 205
Joined: 15 Jun 2010, 17:56

Re: Frame clipping

Post by zocka » 26 Jan 2015, 19:54

Thank you for your detailed answer! :thumbsup:

Your

Code: Select all

container.ClipWindowRelativePosition.X += button.Size.X * 0.5;
container.ClipWindowRelativePosition.Y -= button.Size.Y * 0.5;
should actually be the same as my

Code: Select all

container.ClipWindowRelativePosition = button.Size * button.AbsoluteScale;
container.ClipWindowRelativePosition.X *= 0.5;
container.ClipWindowRelativePosition.Y *= -0.5;
(taking that it is <0., 0.> in the beginning and this scaling thing ofc)
(Another thing I haven't tested yet is, whether the clipwindow is scaled with the frame, which would ruin my calculations a bit)
In fact I would have shortened it to button.Size * <0.5, -0.5> but * is not overloaded like that :( ([suggestion] :D)

Specialcases for different alignments are handled a bit below in my complete code.

Unfortunately the idea with all this is to be script-based only, so I don't have many more options with generating fitting XML.

However since this whole thing was just a test of the feature in general I'm glad to see my assumptions confirmed since I didn't find anything about this feature by now :D
manialink minigame shatter
my manialink: zockaml
my maniaflash: maniaflash?zocka

GabrielM
Posts: 243
Joined: 13 Jan 2012, 16:53

Re: Frame clipping

Post by GabrielM » 28 Jan 2015, 10:37

zocka wrote: Your

Code: Select all

container.ClipWindowRelativePosition.X += button.Size.X * 0.5;
container.ClipWindowRelativePosition.Y -= button.Size.Y * 0.5;
should actually be the same as my

Code: Select all

container.ClipWindowRelativePosition = button.Size * button.AbsoluteScale;
container.ClipWindowRelativePosition.X *= 0.5;
container.ClipWindowRelativePosition.Y *= -0.5;
Oh yes you're right, i had not seen the

Code: Select all

container.ClipWindowRelativePosition = button.Size * button.AbsoluteScale;
;)

Post Reply

Return to “ManiaLink”

Who is online

Users browsing this forum: No registered users and 2 guests