The utilization of foreign objects as described above would not be feasible when using other rendering engines like canvas. On our blog, we will soon discuss other disadvantages of canvas compared to SVG. Stay tuned.
When you'll find this feature useful:
Generally, if you need to insert an HTML element (e.g. field input) into a diagram while taking advantage of the advanced interactivity functions of our library.
If you need to export a diagram to a PNG image with the HTML object content.
If you need to support accessibility.
If you need to control the stacking order of elements, links and ports.
If you need to integrate JointJS+ with JavaScript frameworks (such as inserting React HTML component inside an element using React portals).
👉 View the ROI calculator demo to see foreign objects in action: https://jointjs.com/demos/roi-calculator.
ထ Unlimited customization options thanks to the preventDefaultInteraction function
We have introduced a new API that allows dynamic prevention of default JointJS interactions. This includes actions such as preventing element and link movement during dragging, adding a link when clicking on a port, or dragging link labels. With this new API, you can now customize the default interactions based on specific event characteristics, such as whether the SHIFT key was pressed or what DOM element the user interacts with.
To illustrate this capability with concrete examples, let's explore two different use cases.
In the first example, we'll look at MindManager, a commercial mind mapping software application developed by Alludo. In the footage below, you can see a different interaction than you would normally expect when using JointJS+. When dragging and dropping an image or tag in an element, only the image/tag is transferred to another element. The original element itself does not change its position.
There are situations where you want to define different interactions for certain parts of an element, similar to what we have shown above. JointJS+ v3.7 offers great support in this regard.
Second, let's take a BPMN application as an example. Let's say you've used a visual editor to map out a business process for a defined department of your company (represented by a swimlane). Duplicating the process and moving it to another department (swimlane) would have been a challenging task. You would have to look for an empty space that does not interfere with the container so that you could select all the elements within the swimlane, duplicate them, and move them to the desired location. Today, you can set up an interaction that easily selects elements even within a container. See the new preventDefaultInteraction function in action below.
👉 Try out the new functionality with an interactive demo: