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

  • SEARCH
  • Home
  • 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 7989335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:43:36+00:00 2026-06-04T12:43:36+00:00

I’m working on a canvas app, and I need to be able to create

  • 0

I’m working on a canvas app, and I need to be able to create bitmaps, lines, groups,and manage click events.

I tried:

  1. kinetic-v3.9.6.js
  2. easeljs-0.4.2.min.js

These are very nice tools but they don’t have a way to get the width of a group of bitmaps and lines. Picture this:

//init a image
var b = new Bitmap(...);
b.x ...
b.src ...

var l = Line(...);
l.x ...
l.y ...

//init group or layer or something like that
var g = Group(...);
g.add(b);
g.add(l);

var w = g.width;

This doesn’t work.

Right now I’m considering hacking the easeljs-0.4.2.min.js to accomplish this because it is a good starting point to port as3/as2 simple code, but I’m not sure if this is a good idea.

I really like the way Flash implements display objects, so if you know of some tool please let me know.

  • 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-04T12:43:38+00:00Added an answer on June 4, 2026 at 12:43 pm

    You could/should use SVG for what you are describing.

    Demo: http://jsfiddle.net/mNAd3/

    var svgNS = 'http://www.w3.org/2000/svg',
        svg   = document.body.appendChild(document.createElementNS(svgNS,'svg'));
    
    var l = document.createElementNS(svgNS,'line');
    line.setAttribute('x1',10); line.setAttribute('y1',50);
    line.setAttribute('x2',30); line.setAttribute('y2',150);
    
    var g = svg.appendChild(document.createElementNS(svgNS,'g'));
    g.appendChild(l);
    
    var bbox = g.getBBox();
    console.log(bbox);
    // SVGRect:
    //   height: 100
    //   width: 20
    //   x: 10
    //   y: 50
    
    var w = bbox.width;
    

    Note that you will need to ensure that your elements are visible on screen (adding the SVG to the document, adding the group to the SVG) to calculate the bounding box.

    I intentionally did not include an example of creating an image because with asynchronously-loaded resources you need to set an load handler to wait for the image to load, and I didn’t want to complicate the demo with those details.

    Because SVG is a retained-mode graphics API it has concepts for the sizes of objects and allows them to track and handle mouse events. This is not true for HTML5 canvas (because it is an immediate-mode graphics API.)

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need to clean up various Word 'smart' characters in user input, including but
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to

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.