Opened 9 years ago

Closed 7 years ago

#11241 closed defect (fixed)

getBoundingBox() returns reference instead of copy of shape's bounding box

Reported by: OldGuru Owned by: Eugene Lazutkin
Priority: high Milestone: 1.8
Component: DojoX GFX Version: 1.4.3
Keywords: dojox, gfx, getBoundingBox, shape Cc:
Blocked By: Blocking:

Description

var z=shape.getBoundingBox()

alert('x'+z.x+'y'+z.y+'w'+z.width+'h'+z.height);

z.x+=30;

z.y+=30;

z.width+=30;

z.height+=30;

z=shape.getBoundingBox()

alert('x'+z.x+'y'+z.y+'w'+z.width+'h'+z.height);

The second alert shows that x, y, width and height properties are each increased by 30.

I tested it for Ellipse and Image. On Firefox, Ellipse had the same problem while Image's bounding box remained unchanged.

On IE both Ellipse and Image were affected and, in the case of Image, its actual size was increased. Both shapes were displaced by (dx:30, dy:30}.

Change History (3)

comment:1 Changed 9 years ago by Eugene Lazutkin

Milestone: tbdfuture
Status: newassigned

Probably this is a documentation issue,rather than some erroneous behavior.

comment:2 Changed 7 years ago by Patrick Ruzand

Milestone: future1.8

The behavior seems correct for me too. getBoundingBox calls should be fast, no need to add extra cost. I have fixed the documentation accordingly.

comment:3 Changed 7 years ago by Patrick Ruzand

Resolution: fixed
Status: assignedclosed

In [27114]:

fix getBoundingBox documentation. fixes #11241

Note: See TracTickets for help on using tickets.