Book a Demo

Author Topic: Shape Script: rotating half circle connector  (Read 3443 times)

Thomas H.

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Shape Script: rotating half circle connector
« on: November 21, 2008, 05:42:11 am »
I am trying to create a "half circle" shape for the end of a connector as follows:

shape main
{
  // draw a dashed line
  noshadow=true;
  setlinestyle("SOLID");
  moveto(0,0);
  lineto(100,0);
}
 
shape target
{
  startpath();
  setfillcolor(0,0,0);
  setpencolor(0,0,0);
  moveto(0,0);
  arc(-8, 8, 8, -8, 0, 8, 0, -8);
  endpath();
  fillandstrokepath();
}


I expected that the half circle rotates as it is done for example with the normal arrows, but the half circle does not.

Has anyone an idea how this can be done?


KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Shape Script: rotating half circle connector
« Reply #1 on: November 21, 2008, 09:19:36 am »
I gave your shape script a go, and the result really wasn't what I was expecting. Without looking at the source (I probably wouldn't understand it if I did) I suspect that the arc() function uses absolute positioning and can't take into account the direction of the line.

Can you Report the Bug to Sparx support please. At the very least we should be able to provide "sourceedge" and "targetedge" properties to allow you to test whether the line attaches to the left, right, top or bottom edge, so you can change the arc parameters accordingly.
« Last Edit: November 21, 2008, 09:21:13 am by KP »
The Sparx Team
[email protected]