objective-cmacosquartz-2dquartz-composer

Quartz scaling sprite vertical range but not horizontal when go to fullscreen mode / increase window size


I have create a Quartz composition for use in MAC OS program as part of my interface. I am relying on the fact that when you have composition sprite movement (a text bullet point in my case) is limited both in the X plane and Y plane to minimum -1 and maximum +1.

When I scale up the window / make my window full screen, I find that the horizontal plane (X axis) remains the same, with -1 being my far left point and +1 being my far right point. However the vertical plane (Y axis) changes, in full screen mode it goes from -0.7 to +0.7.

This scaling is screwing with my calculations. Is there anyway to get the application to keep the scale as -1 to +1 for both horizontal and vertical planes? Or is there a way of determining the upper and lower limits?

Appreciate any help/pointers


Solution

  • Quartz Composer viewer Y limits are usually -0.75 -> 0.75 but it's only a matter of aspect ratio. X limits are allways -1 -> 1, Y ones are dependents on them.

    You might want to assign dynamically customs width and heigth variables, capturing the context bounds size. For example :

    double myWidth = context.bounds.size.width;
    double myHeight = context.bounds.size.height;
    

    Where "context" is your viewer context object.

    If you're working directly with the QC viewer : you should use the Rendering Destination Dimensions patch that will give you the width and the height. Divide Height by 2, then multiply the result by -1 to have the other side.