[Bug]: Multiselection ignores interactive option

This issue has been tracked since 2022-11-09.

What happened?

We encountered an issue with the multiselection in our application and could reproduce it in this CodePen: https://codepen.io/jointjs/pen/VwMJGxQ

Steps to reproduce:

  1. Set the interactive option of the dia.Paper to false.
  2. Add multiple shapes to the paper.
  3. Press shift and multiselect two or more shapes.
  4. Drag the selection around.

Expected behaviour:
Since interactive is set to false, the shapes should not move on being dragged.

Actual behaviour:
The interactive option is ignored when more than one shape is selected, allowing the selection to be moved.

Motivation:
We want to display a graph in read-only mode, but still allow users to select shapes in order to copy and paste them to another tree in non-read-only mode.

Version

3.6.1

What browsers are you seeing the problem on?

Chrome

What operating system are you seeing the problem on?

Windows

kumilingus wrote this answer on 2022-12-03

Hi @ArthurWietzorek ,

For your particular use-case, there is an easy workaround:

new ui.Selection({ allowTranslate: !isViewMode, /* ... */ });

Or

selection.options.allowTranslate = !isViewMode;

The real question is what should happen when some of the selected elements are interactive and the rest is not. Should we translate only those which are interactive (i.e. elementMove: true)? Or should we move none? I think the earlier is more flexible.

ArthurWietzorek wrote this answer on 2022-12-03

Thank you, @kumilingus!

The workaround fulfilled our requirements perfectly fine.

Regarding the question, wether mixed selections of interactive and non-interactive elements should be partially moved or not at all, we are of an indifferent opinion, since we don't have a use case for that yet.

In any case, when all of the selected elements are not interactive, the selection should not move even without the allowTranslate: false option. We hope to see this in a future update, whenever it fits into your roadmap.

For now though, this issue is resolved for us.

kumilingus wrote this answer on 2022-12-03

We'll fix this real soon, making it ready for the JJ+ v3.6.2 patch.

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