Opened 9 years ago

Closed 7 years ago

Last modified 7 years ago

#11296 closed enhancement (fixed)

[patch][cla] GFX: Add clipping API to clip children of a Group

Reported by: liyang Owned by: Patrick Ruzand
Priority: high Milestone: 1.8
Component: DojoX GFX Version: 1.5.0b2
Keywords: Cc:
Blocked By: Blocking: #14356

Description

There is currently no API to clip the children of a Group.

Clipping is important when you want a group to have a fixed size, regardless of the size of its children. For example, in a complex node/link graph, a node can contain a sub-graph, and it might be desirable to show only a subset of this sub-graph. This is not possible without clipping, since by default a GFX group always extends to the whole bounding box of its children.

Clipping could be defined by specifying a clipping shape, or at least a clipping rectangle.

Attachments (4)

svgClip.patch (2.3 KB) - added by Chris Mitchell 9 years ago.
testClip.html (2.5 KB) - added by Chris Mitchell 9 years ago.
vmlClip.patch (1.3 KB) - added by Chris Mitchell 9 years ago.
11296.patch (28.8 KB) - added by Patrick Ruzand 8 years ago.
patch by pruzand (IBM,CCLA) based on liyang initial patch

Download all attachments as: .zip

Change History (19)

comment:1 Changed 9 years ago by liyang

A patch created for SVG and VML renderers, plus a simple test case, tested on IE 7/8 FF3.6 chrome.

A new API setClip(clip) is added to group object. Function summary: sets and removes a rectangle clip (SVG) to this group; parameter 'clip' is a rectangle object {x, y, width, height}, or null to remove clip.

The code is written in a way that backport should be easy. It's under internal review and could be promoted here soon.

Changed 9 years ago by Chris Mitchell

Attachment: svgClip.patch added

Changed 9 years ago by Chris Mitchell

Attachment: testClip.html added

Changed 9 years ago by Chris Mitchell

Attachment: vmlClip.patch added

comment:2 Changed 9 years ago by Chris Mitchell

Summary: add clipping API[patch][cla] GFX: Add clipping API to clip children of a Group

comment:3 Changed 9 years ago by Chris Mitchell

IBM# 145314

comment:4 Changed 9 years ago by Eugene Lazutkin

Milestone: tbdfuture
Status: newassigned

comment:5 Changed 9 years ago by Eugene Lazutkin

Milestone: future1.6

We need to implement the same functionality in Canvas and Silverlight (both have provisions for true clipping unlike VML).

comment:6 Changed 9 years ago by Eugene Lazutkin

Milestone: 1.61.7

comment:7 Changed 8 years ago by Chris Mitchell

Milestone: 1.71.8

comment:8 Changed 8 years ago by Patrick Ruzand

#13948 is a duplicate of this ticket.

comment:9 Changed 8 years ago by Patrick Ruzand

Owner: changed from Eugene Lazutkin to Patrick Ruzand

comment:10 Changed 8 years ago by cjolif

Blocking: 14356 added

Changed 8 years ago by Patrick Ruzand

Attachment: 11296.patch added

patch by pruzand (IBM,CCLA) based on liyang initial patch

comment:11 Changed 8 years ago by Patrick Ruzand

Attached a new patch to add support for clipping. It introduces a new Shape.setClip() api and supports rectangular, ellipse, polyline and path clipping geometries (modulo renderer limitations, see below).

Here is an extract of the api doc:

The clipping area defines the shape area that will be effectively visible. Everything that would be drawn outside of the clipping area will not be rendered. The possible clipping area types are rectangle, ellipse, polyline and path, but all are not supported by all the renderers. vml only supports rectangle clipping, while the gfx silverlight renderer does notsupport path clipping. The clip parameter defines the clipping area geometry, and should be an object with the following properties:

  • {x:Number, y:Number, width:Number, height:Number} for rectangular clip
  • {cx:Number, cy:Number, rx:Number, ry:Number} for ellipse clip
  • {points:Array} for polyline clip
  • {d:String} for a path clip.

The clip geometry coordinates are expressed in the coordinate system used to draw the shape. In other words, the clipping area is defined in the shape parent coordinate system and the shape transform is automatically applied.

Includes a new unit test: gfx/tests/test_clip.html

comment:12 Changed 8 years ago by Patrick Ruzand

Resolution: fixed
Status: assignedclosed

In [28104]:

add clipping api. fixes #11296 !strict

comment:13 Changed 8 years ago by Patrick Ruzand

Resolution: fixed
Status: closedreopened

reopen as the vml impl has some issues (bad clipping coords).

comment:14 Changed 7 years ago by Patrick Ruzand

Resolution: fixed
Status: reopenedclosed

In [28387]:

fix clip coord computation. fixes #11296

comment:15 Changed 7 years ago by Patrick Ruzand

In [28388]:

add more tests for #11296, refs #11296

Note: See TracTickets for help on using tickets.