Marsu Posted January 20, 2016 Share Posted January 20, 2016 I am starting to go insane... All day I have tried to get this to work, but it doesn't. I am working on a drawing game which already works quite well. The drawing surface is a sprite with a BitmapData as texture and gets drawn on during move callbacks. It also has an undo-function which works fine on desktop and inside an android webview. But on iOS the "recording" of undo-states does not work at all. Essentially on starting the next stroke (input down) or on clearing the image, the whole BitmapData gets copied into a new BD which is pushed into an array (which gets shifted first if the number of undo-states exceeds X) on undo the last undo-state gets copied back to the main BD. if (this.undoSteps.length >= this.maxUndoSteps) { this.undoSteps.shift(); } var undoStepNew = this.game.add.bitmapData(this.drawImg.width, this.drawImg.height, '', true); undoStepNew.blendSourceOver(); undoStepNew.copyRect(this.drawImg, new Phaser.Rectangle(0, 0, this.drawImg.width, this.drawImg.height), 0, 0, 1, "source-over"); this.undoSteps.push(undoStepNew); I tried different blend-modes, tried copy, draw, pulling directly from the BD instead of the Sprite it is assigned to, pulling from the texture field, everything. Most of what I tried worked fine on desktop (chrome) and android (4.4.x), but never on this damn iPhone 5. Any Ideas what the problem could be? Link to comment Share on other sites More sharing options...
Marsu Posted January 22, 2016 Author Share Posted January 22, 2016 Through much trial and error I found a solution. If I copied not from the other Image, Sprite or BitmapData but directly from Object.texture.baseTexture.source (a DOM canvas), it works on the iPhone. Should I consider this a bug and report it? Link to comment Share on other sites More sharing options...
Recommended Posts