Disallow element movement

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

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:

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.

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

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);
2 Likes