Page 1 of 1

clearRect not working on .apk export

Posted: Tue Jul 30, 2013 11:55 am
by ssquire

The clearRect command that I use to clear the canvas before I draw the next pitch count number seems to work in the browser when I test, but not when I create & install the .apk file (see shared Baseball_Tools_Pro project with Appery.io Support). I am using the following code to perform the clear and redraw canvas operation:

function drawPitchCountNumber(pCtr) {

var canvas = document.getElementById("pitchCountCanvas");

if (canvas.getContext) {
var ctx = canvas.getContext("2d");

Code: Select all

 // Clear the previously drawn image 
 ctx.clearRect( 0 , 0 , 250 , 100 ); 

//Draw the new image
ctx.fillStyle = "white";
ctx.font="bold 70px Arial";
ctx.fillText(pCtr,110,50);

}
}


clearRect not working on .apk export

Posted: Tue Jul 30, 2013 1:37 pm
by Maryna Brodina

Hello! Your shared app works for us. Could you please send us screenshot? Also clarify what device/version you use to test?


clearRect not working on .apk export

Posted: Tue Jul 30, 2013 6:48 pm
by ssquire

I'm using a Samsung Galaxy Note 3 running Android 4.1.2.

Something else I noticed, if the phone display gets a little dark just before the display shuts offs and I put my finger on the display - so that it lights up again it refreshes the screen and the pitch count appears correctly (i.e. not as shown in my attached graphic).

.jpg?1375210050]Image


clearRect not working on .apk export

Posted: Tue Jul 30, 2013 10:12 pm
by Alena Prykhodko

Instead of clearRect you can use color filling:

codectx.fillStyle = "black&quot
ctx.fillRect(0, 0, canvas.width, canvas.height);/code


clearRect not working on .apk export

Posted: Wed Jul 31, 2013 2:24 pm
by ssquire

That works Alena! Thank you!

Now can you tell me how to set backgrounds on all my screens to black. I'm currently using Swatch A and it is a little more gray than black. If I adjust all to black it will be perfect.


clearRect not working on .apk export

Posted: Wed Jul 31, 2013 2:34 pm
by Kateryna Grynko

Hi Steven,

You can create a custom theme in ThemeRoller and upload it into Appery.io.


clearRect not working on .apk export

Posted: Wed Jul 31, 2013 5:55 pm
by ssquire

That was down right FUN!