Opened 11 years ago
Closed 9 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 11 years ago by
Milestone: | tbd → future |
---|---|
Status: | new → assigned |
comment:2 Changed 9 years ago by
Milestone: | future → 1.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.
Probably this is a documentation issue,rather than some erroneous behavior.