Disable interactivity paper property is not woking properly

This issue has been tracked since 2022-05-12.

When setting interactivity page property = false it still allows to add links. Please see the example below.
joint-3.5.3

var graph = new joint.dia.Graph
var paper = new joint.dia.Paper
({
    el: $('#paper'),
    width: 600,
    height: 400,
    gridSize: 10,
    model: graph,
	 highlighting: false
});

paper.setInteractivity(false);

paper.on({
  'blank:pointerdown': function(evt, x, y) {
    var link = new joint.dia.Link();
    link.set('source', { x: x, y: y });
    link.set('target', { x: x, y: y });
    link.addTo(this.model);
    evt.data = { link: link, x: x, y: y };
  },
  'blank:pointermove': function(evt, x, y) {
    evt.data.link.set('target', { x: x, y: y });
  },
  'blank:pointerup': function(evt) {
    var target = evt.data.link.get('target');
    if (evt.data.x === target.x && evt.data.y === target.y) {
        // remove zero-length links
        evt.data.link.remove();
    }
  }
});
kumilingus wrote this answer on 2022-05-12

As per docs:

Configure which of the default interactions with elements and links should be enabled.

It won't stop events (blank:pointerdown, blank:pointermove, blank:pointerup) from triggering.

When you want to stop a custom interaction you can do it this way:

var isInteractive = false;

paper.setInteractivity(isInteractive);

paper.on({
  'blank:pointerdown': function(evt, x, y) {
    if (!isInteractive) return;
    var link = new joint.dia.Link();
    link.set('source', { x: x, y: y });
    link.set('target', { x: x, y: y });
    link.addTo(this.model);
    evt.data = { link: link, x: x, y: y };
  },
  'blank:pointermove': function(evt, x, y) {
     if (!evt.data.link) return;
    evt.data.link.set('target', { x: x, y: y });
  },
  'blank:pointerup': function(evt) {
    if (!evt.data.link) return;
    var target = evt.data.link.get('target');
    if (evt.data.x === target.x && evt.data.y === target.y) {
        // remove zero-length links
        evt.data.link.remove();
    }
  }
});
More Details About Repo
Owner Name clientIO
Repo Name joint
Full Name clientIO/joint
Language JavaScript
Created Date 2009-09-11
Updated Date 2022-12-03
Star Count 3715
Watcher Count 155
Fork Count 817
Issue Count 51

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date