Getting the BBoxes of objects(shapes)

1 view
Skip to first unread message

voltron

unread,
Mar 2, 2010, 6:17:54 AM3/2/10
to jsvectoreditor
Hi!

I am trying to write custom functions for the editor, for this I would
need to get the dimensions of objects on the canvas.

I tried out a quick test:

// in editor.js line 297
if(shape){
shape.id = this.generateUUID();
shape.attr({
"fill": this.prop.fill,
"stroke": this.prop.stroke,
"stroke-width": this.prop["stroke-width"],
"fill-opacity": this.prop['fill-opacity'],
"stroke-opacity": this.prop["stroke-opacity"]
})
this.addShape(shape);
alert(shape.getBBox().width); ---> Does not alert proper values

Strangely, the values are always 0 or -1. Does anyone have an idea
what I am doing wrong?


Thanks

charles thomas

unread,
Mar 2, 2010, 6:43:31 AM3/2/10
to jsvecto...@googlegroups.com
Voltron

it might be a bug and also is this the same result on all primitives including path?

GETBBOX is not 100%

Take a look at this code (I include it in case it might spark some thought)

http://www.irunmywebsite.com/raphael/additionalhelp.html?q=plugingetbboxrotated

Charles

--- On Tue, 3/2/10, voltron <nhy...@googlemail.com> wrote:


Looking for the perfect gift? Give the gift of Flickr!

voltron

unread,
Mar 2, 2010, 8:54:34 AM3/2/10
to jsvectoreditor
Hmm, this is very strange, where could the bug be? The editor works,
so I take it that the object reference "shape" works too, the code
also has no typo errors compared to the code in the link you sent me:

var bBox = c.getBBox();

On Mar 2, 12:43 pm, charles thomas <charles...@yahoo.com> wrote:
> Voltron
>
> it might be a bug and also is this the same result on all primitives including path?
>
> GETBBOX is not 100%
>
> Take a look at this code (I include it in case it might spark some thought)
>

> http://www.irunmywebsite.com/raphael/additionalhelp.html?q=plugingetb...

>       __________________________________________________________________
> The new Internet Explorer® 8 - Faster, safer, easier.  Optimized for Yahoo!  Get it Now for Free! athttp://downloads.yahoo.com/ca/internetexplorer/

Reply all
Reply to author
Forward
0 new messages