Disallow element movement


#1

Need to do a bit viewer from modeler. Programmatically disallow to move element.


#2

Please share a running / prototypical example that clearly shows what you’re trying to achieve, what is working and what is not.

Use our existing starter projects to quickly hack it or share your existing, partial solution on GitHub. Provide the necessary pointers that allow us to quickly understand where you got stuck.

This way we may be able to help you in a constructive manner.

Thanks :heart:


#3

Only few hard hacks that are making viewer from modeler like this (".group"->not visible) that disable creating new elements on diagram.

The goal is to switch between viewer and modeler with one button. The last thing i need is to disable ability to move elements with mouse. Remove events f.e. but safe.


#4

A simple search for “disable modeling” would have brought you to this topic where this problem has already been solved.


#5

thx to all. for me solution was:

var css = document.createElement("style");    
css.type = "text/css";    
css.innerHTML = ".group { display: none; }";
css.innerHTML = "#canvas .djs-shape .djs-hit { pointer-events: none !important;}";   
document.body.appendChild(css);