wolverine2k / crunchy

Automatically exported from code.google.com/p/crunchy
0 stars 0 forks source link

Graphics display not cleared on execution #59

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. In an editor box, write a script that produces some graphics and run it
2. Then in the same box write a script without graphics and run it

What is the expected output? What do you see instead?
When "Execute" is clicked n step 2 the graphics display from step 1 should
disappear along with any text output from step 1, but it doesn't.

Original issue reported on code.google.com by johannes...@gmail.com on 24 Nov 2007 at 11:27

GoogleCodeExporter commented 8 years ago
With the current version of Crunchy (0.9.8+), an html canvas is created "on 
demand"
when the graphics module is used.  When executing code from an editor box, 
there is
no way (a priori) to know that an html canvas has been created by previous code
execution.  To find out whether or not an html canvas is displayed (so that it 
can be
cleared) I believe that it would be required to either scan the DOM (using
javascript) or importing the graphics module *each* time the code from an 
editor box
is executed.  This would add an unnecessary step most of the time as it is a 
rare
instance where a user will create graphics.  When a user does create a graphics 
using
an editor box, it will usually be the case that repeated execution will contain
graphics.  

If/when it is not the case, it is possible to clear the graphics (but not 
remove all
the "vertical space" where the graphics used to be) using init_graphics(0, 0).  
To
simplify matters, I have created an equivalent function in the graphics module; 
that
function is called clear_graphics().  

I will leave this issue open for now (at least for a few days), giving Johannes 
the
opportunity to comment - or close it himself.

Original comment by andre.ro...@gmail.com on 25 Nov 2007 at 4:23

GoogleCodeExporter commented 8 years ago

Original comment by andre.ro...@gmail.com on 7 Dec 2007 at 9:36