ericdrowell / KineticJS

KineticJS is an HTML5 Canvas JavaScript framework that extends the 2d context by enabling canvas interactivity for desktop and mobile applications.
http://www.kineticjs.com
3.98k stars 753 forks source link

mutiple reload image on ios12 platform will be crash and the image will not show #1077

Open by2017 opened 5 years ago

by2017 commented 5 years ago

// version=5.1.1 var urls = [ "imge1", "imge2", "imge3", "imge1", "imge2", "imge3", ] var echo =0; var stage; init(); $("#ontainer").on("touchstart", function(e) { }); $("#ontainer").on("touchmove", function(e) { }); $("#ontainer").on("touchend", function(e) { init(); }); function init() { var imageUrl = urls[echo]; var stage = new Kinetic.Stage({ container: 'container', width: 729, height: 294 }); var layer = new Kinetic.Layer(); var imageObj = new Image(); imageObj.src = imageUrl; imageObj.onload = function() { setTimeout(function(){ var yoda = new Kinetic.Image({ x: 200, y: 200, image: imageObj, width: 106, height: 118 }); layer.add(yoda); stage.add(layer); layer.draw();

                $("#test").empty();
                $("#test").append(imageObj);
                // $("#img1").attr("src", imageUrl);

                var canvas = document.getElementById("canvas");
                var ctx = canvas.getContext('2d')
                ctx.drawImage(imageObj, 0, 0)
                echo += 1;
                if (echo > 11) {
                    echo = 0;
                }
            }, 1000);
        };