bonjour, je suis confronté à un plantage de firefox à chaque chargement d'une image dans mon canvas.
voici le code utilisé:
Picture.js:
Comme vous le voyez la classe picture étend de Item. je pourrais la détailler si besoin.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 fonction Picture(src, x, y, width, height){ Picture.call(this,x, y); this.src = src; this.width = width; this.height =height; } Picture.prototype = new Item(); Picture.prototype.constructor = Picture; Picture.prototype.draw = function() { var img = new Image(); img.src = this.src; img.onload = function() { this.ctx.drawImage(img, this.x, this.y, this.width, this.height); } }
Quelqu'un a une idée du pourquoi firefox plante?
Partager