Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8333551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:04:27+00:00 2026-06-09T03:04:27+00:00

Is it possible to make elements inside a HTML5 Canvas element draggable and resizable.

  • 0

Is it possible to make elements inside a HTML5 Canvas element draggable and resizable. Is there any way to make the dynamic image in the following code to be movable:

var ctx, imgArray;

function initAll() {
    ctx = document.getElementById("canvas").getContext("2d");
    imgArray = ["http://i46.tinypic.com/nqe1dt.jpg", 
                    "http://i50.tinypic.com/i21phi.jpg", 
                    "http://i49.tinypic.com/1zmfcrq.jpg", 
                    "http://i50.tinypic.com/v8g6mo.jpg", 
                    "http://i49.tinypic.com/21kh7ah.jpg"];
    drawCanvas();
    document.getElementById("checkgroup").onchange = drawCanvas;
}

function drawCanvas() {
   ctx.clearRect(0, 0, 600, 400);
   for(var i=0; i < imgArray.length; ++i) {
      var img = new Image();
      img.posX = (i < 3) ? i*200 : (i-2.5)*200;
      img.posY = (i < 3) ? 0 : 200;
      img.src = imgArray[i];
      img.onload = function() {
        ctx.drawImage(this, this.posX, this.posY, 150, 150);
      } 
   }
}
window.onload = initAll;

The project is found at JSBin: http://jsbin.com/welcome/7209/edit

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:04:31+00:00Added an answer on June 9, 2026 at 3:04 am

    Use KineticJS which provides shape object support for canvas.

    KineticJS will provide mouse events for its shapes and thus you can implement drag-like functionality more easily:

    http://www.html5canvastutorials.com/kineticjs/html5-canvas-drag-and-drop-tutorial/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How is it possible to make knockout data-bind work on dynamically generated elements? For
Is it possible to make form elements unusable without setting the disabled property for
I am adding some elements inside a ListView, I know it is possible in
I'm developing a complicated page containing some widgets, some 'draggable' elements and a <canvas>
Possible Duplicate: Javascript closure inside loops - simple practical example How can I make
Is it possible to make the elements within a WPF toolbar have a HorizontalAlignment
Is it possible to make an HTML element non-focusable ? I understand that a
Is it possible onHover to make HTML dropdown elements adopt a new background color
Is there any way I can achieve this functionality, I have select all type
Is it possible make some handler that will do something when user shutdown computer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.