[codenameone-discussions] Re: An exception occurred during transition paint this might be valid in case of a resize in the middle of a transition

2016-10-25 Thread Shai Almog
Sounds like a bug, I also think this method accepts radians but I don't 
recall for sure. Steve?

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/21497c08-9fff-4077-91e1-cff483140d3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: An exception occurred during transition paint this might be valid in case of a resize in the middle of a transition

2016-10-25 Thread Gareth Murfin
Looks like it happens when you pass something like this

pathStatic.arc(xPos, yPos, circleW, circleH , 180, 180); // *ie the same 
start and complete angle*

Turned out to be a bug in my logic as I should not have been passing the 
same value like that, but I think that still maybe qualifies as a bug 
somewhere :)

On Tuesday, October 25, 2016 at 10:44:55 AM UTC+8, Shai Almog wrote:
>
> It looks like this is triggered by one of the arc paths can you log these 
> calls and see which arguments trigger this?
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/ad037d86-1aa3-4f23-a86e-530646bfc75d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: An exception occurred during transition paint this might be valid in case of a resize in the middle of a transition

2016-10-24 Thread Shai Almog
It looks like this is triggered by one of the arc paths can you log these 
calls and see which arguments trigger this?

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to codenameone-discussions+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/3ba82085-986e-4035-9498-c4bfc6448653%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[codenameone-discussions] Re: An exception occurred during transition paint this might be valid in case of a resize in the middle of a transition

2016-10-24 Thread Gareth Murfin
Note, I do use general path and drawshape:

private void drawCircleBar(Graphics g, int pullToTheLeftPixels, int 
angleToStartOn, int angleToEndOn, int colour)
{
GeneralPath pathStatic  = new GeneralPath();//these should not be 
made each time but had repaint issues when I did, see 
https://groups.google.com/forum/embed/?place=forum/codenameone-discussions=true=true=en=http%3A%2F%2Fwww.codenameone.com%2Fdiscussion-forum.html#!topic/codenameone-discussions/Qb2uJtU82BY
GeneralPath pathDynamic = new GeneralPath();
strokeWidth= myWidth/17;
g.setColor(0xff);

if (stroke == null)
{
stroke = new Stroke(strokeWidth, Stroke.CAP_BUTT, 
Stroke.JOIN_ROUND, 1f);
}  

//for testing
/*
if (progress++>=100)
{
progress=0;
}*/

//debug:
//g.drawRect(getX(),getY(), myWidth, myHeight);
//draw in centre so we can see where it is
//g.drawRect( getX()+(myWidth/2)-5,getY()+(myHeight/2)-5, 10, 10);

g.setFont(f);
g.setAntiAliased(true);
int pixelsToMoveTextAndImageDown = getHeight()/14;

//draw full arc
int sideAngle = 50; //the amount of degrees less than a semi circle 
(180)
double startAngle   = 
Math.toRadians(angleToStartOn+sideAngle);//180 for perfect semi circle, but 
it isnt, so 220
double angleComplete= Math.toRadians(angleToEndOn-sideAngle);   
   
int circleW = myHeight;
if (circleW>myWidth)
{
circleW=myWidth;
}
  /no need  circleW-=strokeWidth*2;
circleW+=strokeWidth*3;

int circleH = circleW;
int xPos = getX()+((myWidth/2)-(circleW/2))-pullToTheLeftPixels;
int yPos = 
getY()+(myHeight/4);//getY()+myHeight/2;//getY()+strokeWidth;

pathStatic.arc(xPos, yPos, circleW, circleH , startAngle, 
angleComplete);
g.drawShape(pathStatic, stroke);

//_("progress:"+progress+" which is "+(progress*3.6));
String percentageStr = ""+progress+"%";
int stringWidth = f.stringWidth("XXX");

Image thumbImage = thumbsUp;
Image thumbImageSelected = thumbsUpSelected;
switch (myPos)
{
case PROGRESS_BAR_LEFT:
break;
case PROGRESS_BAR_RIGHT:
pullToTheLeftPixels = -(int)(stringWidth/1.1f);//so it sits 
a bit more right
thumbImage = thumbsDown;
thumbImageSelected = thumbsDownSelected;
pixelsToMoveTextAndImageDown = thumbsUp.getHeight()/3;
break;
}   
//tweaks for different rews, 

int yForThumb = 
f.getHeight()/3+yPos+thumbsUp.getHeight()/2;//(((getY()+myHeight/2)-f.getHeight()*2))-thumbsUp.getHeight()/2;//-thumbsUp.getHeight()/3)+pixelsToMoveTextAndImageDown;
//thumbsUp or down
g.drawImage(thumbImage, 
(((getX()+myWidth/2)-thumbsUp.getWidth()/2)-pullToTheLeftPixels)+stringWidth/3, 
yForThumb );

if (isSelected) //draw the pressed version if we know we have 
pressed it.
{
g.drawImage(thumbImageSelected, 
(((getX()+myWidth/2)-thumbsUp.getWidth()/2)-pullToTheLeftPixels)+stringWidth/3, 
yForThumb );
}

switch (myPos)
{
case PROGRESS_BAR_LEFT: 
pixelsToMoveTextAndImageDown = 
thumbsDown.getHeight();//-thumbsDown.getHeight()/8;
break;
case PROGRESS_BAR_RIGHT:
pullToTheLeftPixels = -(int)(stringWidth/1.1f);//so it sits 
a bit more right
pixelsToMoveTextAndImageDown = 
-((thumbsDown.getHeight()/3)+f.getHeight()/4);//*2; // the text is above 
the thumb
break;
}   
//add +stringWidth/3 here to nudge it to the right a touch, same 
with thumbs up image (since the circle is pulled left and we dont want 
//this stuff to loook too close to edge
g.setColor(0xff);
g.drawString(percentageStr, 
(((getX()+myWidth/2)-stringWidth/2)-pullToTheLeftPixels)+stringWidth/3, 
yForThumb+pixelsToMoveTextAndImageDown);//(getY()+myHeight/2)+pixelsToMoveTextAndImageDown);

//blue progress bit
float progressAngle = (float)((progress*1.3f));
angleComplete = Math.toRadians(progressAngle);
g.setColor(colour);
pathDynamic.arc(xPos, yPos, circleW, circleH , startAngle, 
angleComplete);
//draw actual progress arc
g.drawShape(pathDynamic, stroke);
}

On Monday, October 24, 2016 at 5:14:17 PM UTC+8, Gareth Murfin wrote:
>
> Ive come back to an app I have not touched in around 2 months. Suddenly it 
> is freezing and it is very hard to pin point. I just updated the libs to 
> see if it had been fixed,