Opened 9 years ago

Closed 3 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: edurocher@…, chrism1@…
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)

visibility.patch (1.2 KB) - added by Chris Mitchell 9 years ago.
visibility.2.patch (1.2 KB) - added by Chris Mitchell 9 years ago.
test of shape visibility.html (1.0 KB) - added by Chris Mitchell 9 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 9 years ago by liyang

How about add two API to shape:

setVisible: function(/*Boolean*/show) isVisible: function() /* return boolean */

I'm working on the impl.

Changed 9 years ago by Chris Mitchell

Attachment: visibility.patch added

Changed 9 years ago by Chris Mitchell

Attachment: visibility.2.patch added

Changed 9 years ago by Chris Mitchell

comment:2 Changed 9 years ago by Chris Mitchell

Cc: chrism1@… added
Summary: visibility API needed[patch][cla] visibility API needed to hide/show GFX shape or group
Version: 1.4.31.5.0rc1

comment:3 Changed 9 years ago by Chris Mitchell

IBM#145312

comment:4 Changed 9 years ago by Eugene Lazutkin

Milestone: tbdfuture
Status: newassigned

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 3 years ago by dylan

Milestone: future1.12
Resolution: patchwelcome
Status: assignedclosed

Given that no one has shown interest in creating a patch in the past 5+ years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.