Skip to content

Commit

Permalink
update standard shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
kumilingus committed Aug 14, 2024
1 parent a04b7e7 commit 9805974
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 3 additions & 4 deletions packages/joint-core/docs/demo/shapes/shapes.standard.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ V.attributeNames['placeholderURL'] = 'placeholderURL';

// Custom attribute for retrieving image placeholder with specific size
dia.attributes.placeholderURL = {
qualify: function(url) {
return typeof url === 'string';
},
set: function(url, refBBox) {
if (typeof url !== 'string') return;
return { 'xlink:href': util.template(url)(refBBox.round().toJSON()) };
}
},
unset: 'xlink:href'
};

var graph = new dia.Graph({}, { cellNamespace: joint.shapes });
Expand Down
9 changes: 8 additions & 1 deletion packages/joint-core/src/shapes/standard.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,8 @@ export const Cylinder = Element.define('standard.Cylinder', {
'Z'
];
return { d: data.join(' ') };
}
},
unset: 'd'
}
}
});
Expand Down Expand Up @@ -613,6 +614,12 @@ export const TextBlock = Element.define('standard.TextBlock', {
return { fill: style.color || null };
}
},
unset: function(node) {
node.textContent = '';
if (node instanceof SVGElement) {
return 'fill';
}
},
position: function(text, refBBox, node) {
// No foreign object
if (node instanceof SVGElement) return refBBox.center();
Expand Down

0 comments on commit 9805974

Please sign in to comment.