How to change AutoPlace DEFAULT_DISTANCE

It doesn’t work when I push the ''autoPlace" service into "–init–

The “autoPlace” is the “–depends–” of “bpmnAutoPlace”,and how to custom it

Let’s start with what you’re trying to achieve. Can you explain?

OK , thanks a lot .
I want to change the DEFAULT_DISTANCE in “diagram-js/lib/features/auto-place/AutoPlace.js” value from 50 to 100

In my case , if use 50(DEFAULT_DISTANCE), the node task is covered by context-pad .image

:joy: I need your help…

As you can see the default distance is hard-coded. You have to override the entire module to change it.

Yes ,and I have injected my ‘CustomAutoPlace’ to override 'autoPlace‘,but it’s doesn’t work.
The injected code is like follow

And I found that the autoPlace moudle in diagram-js is used as the bpmnAutoPlace’s –depends–. Does this mean I can only override the bpmnAutoPlace module instead of overriding the autoPlace module?

So how to override the modules in –depends–.? :rofl:

First of all, please use code blocks instead of screenshots. :laughing:

You don’t want to override diagram-js’s auto place, you want to override bpmn-js’s auto place. Therefore, there’s no need to override an __depends__. So the result would be something similar to:

  __init__: [ 'customAutoPlace' ],
  __depends__: [ 'autoPlace' ],
  bpmnAutoPlace: [ 'value', null ],
  customAutoPlace: [ 'type', CustomAutoPlace ]


1 Like