Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.javascript > #8052
| Path | csiph.com!aioe.org!bofh.it!tornado.fastwebnet.it!53ab2750!not-for-mail |
|---|---|
| Subject | Re: Canvas di HTML5, cancellazione contenuto |
| Newsgroups | it.comp.lang.javascript |
| References | <G8Imz.47842$pt.5792@tornado.fastwebnet.it> <e014mkFaqurU1@mid.individual.net> |
| From | "leonardo.1+++" <leonardo.1@fastwebnet.it> |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
| MIME-Version | 1.0 |
| In-Reply-To | <e014mkFaqurU1@mid.individual.net> |
| Content-Type | text/plain; charset=iso-8859-15; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Lines | 50 |
| Message-ID | <QOJmz.47847$pt.8740@tornado.fastwebnet.it> (permalink) |
| Date | Fri, 29 Jul 2016 16:33:19 +0200 |
| NNTP-Posting-Host | 2.236.249.115 |
| X-Complaints-To | newsmaster@fastweb.it |
| X-Trace | tornado.fastwebnet.it 1469802800 2.236.249.115 (Fri, 29 Jul 2016 16:33:20 CEST) |
| NNTP-Posting-Date | Fri, 29 Jul 2016 16:33:20 CEST |
| Xref | csiph.com it.comp.lang.javascript:8052 |
Show key headers only | View raw
Il 29/07/2016 15:40, Alessandro Pellizzari ha scritto:
> On 29/07/2016 13:40, leonardo.1+++ wrote:
>
>> perché disegna di nuovo anche il segmento precedentemente cancellato?
>
>> $(document).ready(function() {
>>
>> var canvas = document.getElementById("myCanvas");
>> var ctx = canvas.getContext("2d");
>
> Qui stai ottenendo un context
>
>> $("#Cancella").click(function(){ // alert("fatto click sul Cancella");
>> ctx.clearRect(0, 0, canvas.width, canvas.height);
>
> E qui lo usi.
>
>> });
>>
>> $("#Esegui").click(function(){// alert("fatto click sul Esegui");
>>
>> var canvas = document.getElementById("myCanvas");
>> var ctx = canvas.getContext("2d");
>
> Qui ne chiedi un altro. Puoi usare lo stesso che hai già creato fuori
> dalla funzione.
>
> Ma non è qui il tuo problema, questa è solo "ottimizzazione". :)
>
>> ctx.moveTo($x1,$y1);
>> ctx.lineTo($x2,$y1);
>> ctx.stroke();
>
> Qui non stai svuotando il buffer dei segmenti.
> Prima di fare il moveTo() devi chiamare beginPath() per svuotare il
> buffer, altrimenti ti ridisegna tutto ogni volta.
>
> Bye.
>
>
Come sempre conciso ed esauriente.
Ti ringrazio
Leonardo
--
Non sono su facebook
Se anche tu vuoi cancellarti
http://www.giardiniblog.com/come-cancellarsi-da-facebook-eliminare-account/
Back to it.comp.lang.javascript | Previous | Next — Previous in thread | Find similar
Canvas di HTML5, cancellazione contenuto "leonardo.1+++" <leonardo.1@fastwebnet.it> - 2016-07-29 14:40 +0200
Re: Canvas di HTML5, cancellazione contenuto Alessandro Pellizzari <shuriken@amiran.it> - 2016-07-29 14:40 +0100
Re: Canvas di HTML5, cancellazione contenuto "leonardo.1+++" <leonardo.1@fastwebnet.it> - 2016-07-29 16:33 +0200
csiph-web