locked
Win 8 store app RRS feed

  • Question

  • can anyone help me in following scenario
    I have one image on canvas.This image i have added from following code

     var myCanvas = document.getElementById("the-canvas");
            var myContext = myCanvas.getContext("2d");
            var Img1 = new Image();
            //Img.id = "myimg1";
            Img1.src = 'checkbox.jpg';
            //Img1.setAttribute("src", "images/checkbox.jpg");
            //myContext.drawImage(Img1, 50, 50, 20, 20);
            myContext.save();
            //canvas.
            //Img1.onload = function () { ctx.drawImage(Img1, 100, 100);  }
            Img1.onload = function () {
                myContext.drawImage(Img1, 100, 100, Img1.width, Img1.height);
                myContext.restore();


    I need to move this image to new location on canvas using mouse or with help of touch.
    can anyone guide me how to move this new added images within canvas.
    I have tried one code in which content on canvas is disapper when i move images on canvas.


    shreedhar

    • Moved by Jesse JiangModerator Friday, December 14, 2012 9:06 AM (From:Building Windows Store apps with C# or VB )
    Wednesday, December 12, 2012 2:34 PM

All replies

  • Implement drag and drop functionality using javascript and HTML 5, with draggable=true attribute and ondrop attribute.
    Thursday, January 3, 2013 12:46 PM