JointJS - Playground

prevent contextmenu. https://github.com/clientIO/joint/issues/2658

by Roman Bruckner

HTML

<script src="https://cdn.jsdelivr.net/npm/@joint/core@4.2.1/dist/joint.min.js"></script>
<div id="paper"></div>

JavaScript

const { dia, shapes, mvc } = joint;

const graph = new dia.Graph({}, { cellNamespace: shapes });

const paper = new dia.Paper({
    model: graph,
    background: {
        color: '#F8F9FA',
    },
    async: true,
    cellViewNamespace: shapes
});

document.getElementById('paper').appendChild(paper.el);

const rect1 = new shapes.standard.Rectangle({
    position: { x: 100, y: 50 },
    size: { width: 100, height: 50 },
    attrs: {
        label: {
            text: 'Hello'
        }
    }
});

const rect2 = new shapes.standard.Rectangle({
    position: { x: 100, y: 200 },
    size: { width: 100, height: 50 },
    attrs: {
        label: {
            text: 'World'
        }
    }
});

graph.addCell([rect1, rect2]);