I managed to enhance my SVG-shape with ports via:
joint.shapes.devs.Element = joint.shapes.basic.Generic.extend(_.extend({},
joint.shapes.basic.PortsModelInterface, {
// SVG markup with ports
});
With this I get the output:
I want to enhance this shape with a delete button. For that I have:
joint.shapes.devs.toolElement = joint.shapes.basic.Generic.extend({
// markup for delete button
});
based on Mike Goodwin´s solution in How to give JointJS elements a remove tool?
My question: How can I combine the PortModelInterface with the delete tool? The solution should look like this:
Thanks for helping me out.
Solution
The key was this plugin. The author extended the PortsModelInterface with own code for a move-, resize- and ports-tool. I extended it further by implementing the delete functionality. This way the devs-model is open to any extension in case of functionality.
How it´s done
In
tooledViewPlugin.js
there isjoint.plugins.TooledModelInterface = {}
. In there I added:Below in
joint.plugins.TooledViewInterface = {}
I wroteAn example shape with special SVG markup other than a simple rectangle. Note the
<g class="deleteTool"/>
in the markup:The final part is instantiating the element with
new joint.shapes.devs.UnspecifiedProcess
. I present it to you with my drag and drop logic as it might be useful for you too: