arc graphics

Need help with a script? This is the place to discuss how to get your code running!

arc graphics

Postby sctell » Thu Jan 19, 2017 11:37 am

When you create a graphic with this.

put createArcGrc(tRect,tStartAngle,tArcAngle,tColor) into tObj

Initially the graphic conforms to tRect with the startAngle and arcAngle in the colour specified.

As soon as you move it on screen the rect of tObj changes to dimensions that only enclose the coloured element of the graphic.

Here are two images of the same graphic before and after being moved by the cursors.

Why does it do this?

Is this normal?

This behaviour is making it difficult if not impossible for me to calculate sizes and locations for a pie chart.

All the best

Terry

Screen Shot.png
Immediately after creation
Screen Shot.png (14.14 KiB) Viewed 410 times


Screen Shot 1.png
After being moved with the arrow keys
Screen Shot 1.png (12.02 KiB) Viewed 410 times
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: arc graphics

Postby codegreen » Thu Jan 26, 2017 7:20 pm

Why does it do this?

To economize the bounds to what's required to enclose the arc (which reduces memory use, speeds hit/collision testing, and avoids various constraints on the dimensions of QD primitives and pixmaps).

Is this normal?

Yes. It happens whenever an arc is moved or otherwise has its geometry modified (and always has).

-Mark
codegreen
 
Posts: 1504
Joined: Mon Jul 14, 2008 11:03 pm

Re: arc graphics

Postby sctell » Fri Jan 27, 2017 12:28 am

sctell wrote:Yes. It happens whenever an arc is moved or otherwise has its geometry modified (and always has).


Yes, I understand but unless you move/resize the object first in SC having created with the Xfcn it does not return the correct width and height so I have to force it with something like.


set the width of tObj to the width of tObj + 1
set the width of tObj to the width of tObj - 1

It's not a problem to do this but it is not an obvious solution to start with.


All the best

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am


Return to Scripting in SuperTalk

Who is online

Users browsing this forum: No registered users and 1 guest