Skip to content

Commit

Permalink
fix tree-of-life example
Browse files Browse the repository at this point in the history
  • Loading branch information
kumilingus committed Aug 14, 2024
1 parent 35d425f commit ea3acc3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/tree-of-life/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class Branch extends dia.Link {
static attributes = {
// The `organicStroke` attribute is used to set the `d` attribute of the `<path>` element.
// It works similarly to the `connection` attribute of JointJS.
organicStroke: {
'organic-stroke': {
set: function (
_value: any,
_refBBox: g.Rect,
Expand Down Expand Up @@ -231,7 +231,7 @@ class Branch extends dia.Link {
// Using the `getStroke` function from the `perfect-freehand` library,
// we get the points that represent the outline of the stroke.
const outlinePoints = getStroke(points, {
size: attrs.organicStrokeSize || 20,
size: attrs['organic-stroke-size'] || 20,
thinning: 0.5,
simulatePressure: false,
last: true,
Expand All @@ -241,10 +241,11 @@ class Branch extends dia.Link {
// The `d` attribute is set on the `node` element.
return { d };
},
unset: 'd'
},
// Empty attributes definition to prevent the attribute from being set on the element.
// They are only meant to be used in the `organicStroke` function.
organicStrokeSize: {},
'organic-stroke-size': {},
};
}

Expand Down

0 comments on commit ea3acc3

Please sign in to comment.