Skip to content

Commit

Permalink
Merge pull request #64 from jonmmease/jonmmease/clip_path
Browse files Browse the repository at this point in the history
Support clipping to arbitrary paths
  • Loading branch information
jonmmease authored Mar 2, 2024
2 parents 9f68ab5 + 1f2b095 commit 2094b05
Show file tree
Hide file tree
Showing 30 changed files with 3,318 additions and 231 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,903 changes: 1,903 additions & 0 deletions avenger-vega-test-data/vega-scenegraphs/clip/bar_rounded.sg.json

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
254 changes: 254 additions & 0 deletions avenger-vega-test-data/vega-scenegraphs/clip/clip_rounded.sg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
{
"width": 210,
"height": 410,
"origin": [
5,
5
],
"scenegraph": {
"clip": false,
"interactive": true,
"items": [
{
"items": [
{
"clip": false,
"interactive": true,
"items": [
{
"items": [
{
"clip": true,
"interactive": true,
"items": [
{
"fill": "crimson",
"x": -10,
"width": 50,
"y": 10,
"height": 50
}
],
"marktype": "rect",
"role": "mark",
"zindex": 0
},
{
"clip": false,
"interactive": true,
"items": [
{
"fill": "crimson",
"x": -10,
"width": 50,
"y": 70,
"height": 50
}
],
"marktype": "rect",
"role": "mark",
"zindex": 0
},
{
"clip": true,
"interactive": true,
"items": [
{
"stroke": "blue",
"strokeWidth": 10,
"strokeCap": "round",
"x": 130,
"x2": 165,
"y": 30,
"y2": 50
}
],
"marktype": "rule",
"role": "mark",
"zindex": 0
},
{
"clip": false,
"interactive": true,
"items": [
{
"stroke": "blue",
"strokeWidth": 10,
"strokeCap": "round",
"x": 130,
"x2": 165,
"y": 50,
"y2": 70
}
],
"marktype": "rule",
"role": "mark",
"zindex": 0
},
{
"clip": false,
"interactive": true,
"items": [
{
"x": 160,
"y": 280,
"fill": "green",
"scaleX": 15,
"scaleY": 15,
"path": "M0,.5L.6,.8L.5,.1L1,-.3L.3,-.4L0,-1L-.3,-.4L-1,-.3L-.5,.1L-.6.8L0,.5Z"
}
],
"marktype": "path",
"role": "mark",
"zindex": 0
},
{
"clip": true,
"interactive": true,
"items": [
{
"x": 150,
"y": 320,
"fill": "green",
"scaleX": 15,
"scaleY": 15,
"path": "M0,.5L.6,.8L.5,.1L1,-.3L.3,-.4L0,-1L-.3,-.4L-1,-.3L-.5,.1L-.6.8L0,.5Z"
}
],
"marktype": "path",
"role": "mark",
"zindex": 0
},
{
"clip": false,
"interactive": true,
"items": [
{
"x": 70,
"y": 260,
"outerRadius": 80,
"innerRadius": 20,
"startAngle": -1.5,
"endAngle": -1.8,
"fill": "lightblue",
"stroke": "deeppink",
"strokeWidth": 3
}
],
"marktype": "arc",
"role": "mark",
"zindex": 0
},
{
"clip": true,
"interactive": true,
"items": [
{
"x": 70,
"y": 300,
"outerRadius": 80,
"innerRadius": 20,
"startAngle": -1.5,
"endAngle": -1.8,
"fill": "lightblue",
"stroke": "deeppink",
"strokeWidth": 3
}
],
"marktype": "arc",
"role": "mark",
"zindex": 0
},
{
"clip": false,
"interactive": true,
"items": [
{
"x": 30,
"y": 320,
"width": 50,
"height": 50,
"url": "data/ffox.png"
}
],
"marktype": "image",
"role": "mark",
"zindex": 0
},
{
"clip": true,
"interactive": true,
"items": [
{
"x": 90,
"y": 320,
"width": 50,
"height": 50,
"url": "data/ffox.png"
}
],
"marktype": "image",
"role": "mark",
"zindex": 0
},
{
"clip": false,
"interactive": true,
"items": [
{
"x": 60,
"y": 3,
"fill": "orange",
"size": 350,
"shape": "cross"
}
],
"marktype": "symbol",
"role": "mark",
"zindex": 0
},
{
"clip": true,
"interactive": true,
"items": [
{
"x": 120,
"y": 10,
"fill": "orange",
"size": 350,
"shape": "cross"
}
],
"marktype": "symbol",
"role": "mark",
"zindex": 0
}
],
"x": 20,
"y": 20,
"width": 160,
"height": 360,
"stroke": "gray",
"strokeWidth": 2,
"cornerRadius": 70
}
],
"marktype": "group",
"role": "scope",
"zindex": 0
}
],
"fill": "transparent",
"stroke": "#ddd",
"x": 0,
"y": 0,
"width": 200,
"height": 400
}
],
"marktype": "group",
"name": "root",
"role": "frame",
"zindex": 0
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
139 changes: 139 additions & 0 deletions avenger-vega-test-data/vega-scenegraphs/clip/text_clip_rounded.sg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"width": 210,
"height": 210,
"origin": [
5,
5
],
"scenegraph": {
"clip": false,
"interactive": true,
"items": [
{
"items": [
{
"clip": false,
"interactive": true,
"items": [
{
"items": [
{
"clip": true,
"interactive": true,
"items": [
{
"font": "sans-serif",
"fill": "crimson",
"text": "Hello",
"fontSize": 30,
"x": -10,
"width": 50,
"y": 30,
"height": 50
}
],
"marktype": "text",
"role": "mark",
"zindex": 0
},
{
"clip": false,
"interactive": true,
"items": [
{
"font": "sans-serif",
"fill": "crimson",
"text": "Hello",
"fontSize": 30,
"x": -10,
"y": 70
}
],
"marktype": "text",
"role": "mark",
"zindex": 0
},
{
"clip": true,
"interactive": true,
"items": [
{
"font": "sans-serif",
"fill": "crimson",
"text": "Hello",
"fontSize": 30,
"x": 100,
"y": 80
}
],
"marktype": "text",
"role": "mark",
"zindex": 0
},
{
"clip": true,
"interactive": true,
"items": [
{
"font": "sans-serif",
"fill": "crimson",
"text": "Hello",
"fontSize": 30,
"x": 80,
"width": 50,
"y": 15,
"height": 50
}
],
"marktype": "text",
"role": "mark",
"zindex": 0
},
{
"clip": true,
"interactive": true,
"items": [
{
"font": "sans-serif",
"fill": "crimson",
"text": "Hello",
"fontSize": 30,
"x": 90,
"width": 50,
"y": 160,
"height": 50
}
],
"marktype": "text",
"role": "mark",
"zindex": 0
}
],
"x": 20,
"y": 20,
"width": 160,
"height": 160,
"stroke": "gray",
"strokeWidth": 2,
"cornerRadius": 50
}
],
"marktype": "group",
"role": "scope",
"zindex": 0
}
],
"fill": "transparent",
"stroke": "#ddd",
"x": 0,
"y": 0,
"width": 200,
"height": 200
}
],
"marktype": "group",
"name": "root",
"role": "frame",
"zindex": 0
}
}
Binary file modified avenger-vega-test-data/vega-scenegraphs/vl-convert/geoScale.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2094b05

Please sign in to comment.