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 8686895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:58:49+00:00 2026-06-12T22:58:49+00:00

This is related to a previous question, and surprisingly, I couldn’t find an example

  • 0

This is related to a previous question, and surprisingly, I couldn’t find an example online. I am trying to pass a string through an embed in ExpressionEngine, and I would like for my rectangle button to expand horizontally based on the size of the text that gets passed through the embed. In Raphael, does text have the equivalent of a getWidth method?

Could someone please provide example code based on the following:

var contactTextPara = "{embed:quote}";
var rectHeight = 45;
var rectWidth;
// Create an object group
p.setStart();

var contactText = p.text(11,22,contactTextPara);
var contactRect= p.rect(0, 0, rectWidth, rectHeight);

UPDATE: Using the getBBox() method, I am able to achieve some relative which values which is definitely helpful. However, the values that I get are not particularly helpful.

For example, I used 120px x 45px as the dimensions of my previous rectangle, which fit the border of my text, but the new rectangle generated using getBBox() has dimensions of are about 27px x 12px respectively.

Am I supposed to use a multiplier?

UPDATE2: That was clearly due to the fact that I had not yet applied my attributes. However, I still need help creating an aesthetically pleasing text box.

  • 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-12T22:58:50+00:00Added an answer on June 12, 2026 at 10:58 pm

    You need to use the .getBBox():

    var contactText = p.text(11,22,contactTextPara);
    var dimensions = contactText.getBBox();
    var contactRect= p.rect(0, 0, dimensions.width, dimensions.height);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Surprisingly I was only able to find one previous question on SO about this
This is related to a previous question . What I'm trying to understand now
This is related to my previous question . I'm trying, in Excel, to update
this is related to my previous question. I'm trying to build Phone application from
This question is related to a previous question of mine to which I couldn't
This question is somewhat related to my previous question (not necessary to go through
This is related to my previous question, but will navigator.onLine work if there is
This question is related to this previous SO question I have fixed the string
This is related to my previous question I'm solving UVA's Edit Step Ladders and
This is related to my previous question More than 1 Left joins in MSAccess

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.