Opened 11 years ago
Closed 5 years ago
#11252 closed enhancement (patchwelcome)
[patch][cla] visibility API needed to hide/show GFX shape or group
Reported by: | liyang | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | 1.13 |
Component: | DojoX GFX | Version: | 1.5.0rc1 |
Keywords: | Cc: | [email protected]…, [email protected]… | |
Blocked By: | Blocking: |
Description
There is currently no API to hide/show a GFX shape or group. All you can do is remove the shape from its parent using shape.removeShape() or parent.remove(shape), but there is no API like shape.setVisible(true/false)/shape.isVisible().
Removing a shape to hide it can be an acceptable workaround in some cases, but has the following cons:
- The shape is no more accessible in the child list of its parent, so this forces the caller to keep a reference to
the hidden shape in some way, which can complicate the code a lot.
- Shapes removed from their parent seem poorly supported and exhibit a number of problems, depending on the renderer:
for example, calling setFill() on an orphan shape fails (at least on the SVG renderer) because the GFX code tries to walk up the parent chain to the Surface; on VML, removed shapes seem to loose some of their properties (fill, stroke, ...); etc
So, all in all, a visibility API on shapes would be really useful.
Attachments (3)
Change History (8)
comment:1 Changed 11 years ago by
Changed 11 years ago by
Attachment: | visibility.patch added |
---|
Changed 11 years ago by
Attachment: | visibility.2.patch added |
---|
Changed 11 years ago by
Attachment: | test of shape visibility.html added |
---|
comment:2 Changed 11 years ago by
Cc: | [email protected]… added |
---|---|
Summary: | visibility API needed → [patch][cla] visibility API needed to hide/show GFX shape or group |
Version: | 1.4.3 → 1.5.0rc1 |
comment:4 Changed 11 years ago by
Milestone: | tbd → future |
---|---|
Status: | new → assigned |
The attached patch doesn't work with Canvas nor Silverlight renderers, which are not based on DOM nodes. As such it is a no-go.
comment:5 Changed 5 years ago by
Milestone: | future → 1.12 |
---|---|
Resolution: | → patchwelcome |
Status: | assigned → closed |
Given that no one has shown interest in creating a patch in the past 5+ years, I'm closing this as patchwelcome.
How about add two API to shape:
setVisible: function(/*Boolean*/show) isVisible: function() /* return boolean */
I'm working on the impl.