#3857 closed defect (fixed)
dojox.gfx.group.clear does not work
Reported by: | guest | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | 0.9 |
Component: | DojoX GFX | Version: | 0.9 |
Keywords: | Cc: | [email protected]… | |
Blocked By: | Blocking: |
Description
I see the following issues in FF/Opera/Safari when using clear() on a Group: #1: In Firefox/Opera/Safari?, calling clear() does not remove a Rect. An Image is removed #2: Removing the Rect by calling group.remove() removes it #3: In Safari 3 (beta), the Image is added, but not visible till u switch to a different tab and return. Must be some sort of refresh issue.
Works fine in IE.
The following code is a simple test case I put together to test these.
<!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01EN" "http://www.w3.org/TR/html4/strict.dtd"> <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>dojox.gfx.Group</title>
<script type="text/javascript"
src="../../../js/dojo-0.9.0beta/dojo/dojo.js.uncompressed.js"></script>
<script type="text/javascript">
dojo.require("dojox.gfx");
var surface, root, rect, image; function init() {
create surface surface = dojox.gfx.createSurface(dojo.byId("div"), 400, 400); create root group to add all graphics into root = surface.createGroup();
}
function addRect() {
if (! rect) {
rect = root.createRect({ x:100, y:100, width:100, height:100 }); rect.setFill([255, 0, 0]);
}
}
function removeRect() {
root.remove(rect); rect = null;
}
function addImage() {
if (! image) {
image = root.createImage({ x:200, y:200, width:100,
height:100, src:"http://dojotoolkit.org/sites/all/themes/dojotoolkit/logo.png" });
}
}
function removeImage() {
root.remove(image); image = null;
}
function clearRoot() {
surface = root.clear(); rect = image = null;
}
dojo.addOnLoad(init);
</script>
</head> <body>
<div id="div" style="width:400px; height:400px; border:1px solid
#000;"></div>
<input type="button" value="Add Rect" onclick="addRect()" /> <input type="button" value="Remove Rect" onclick="removeRect()" /> <input type="button" value="Add Image" onclick="addImage()" /> <input type="button" value="Remove Image" onclick="removeImage()" /> <input type="button" value="Clear" onclick="clearRoot()" />
</body>
</html>
Attachments (1)
Change History (4)
comment:1 Changed 14 years ago by
Status: | new → assigned |
---|
Changed 14 years ago by
Attachment: | dojox_gfx_group.html added |
---|
comment:2 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:3 Changed 14 years ago by
I could not reproduce Safari 3 Beta bug. It works as expected.
BTW, some .png images don't work properly on IE. Try to use .gif or .jpg if possible.
Code sample