简体   繁体   中英

how to make the parent mxcell in mxgraph javascript library

I am using mxgraph javascript library. Scenario: one swim lane is added to the graph. Any shapes can be added as a child to the swimlane (drag and drop).We can add 'n' number of childs. how to make the swimlane size fixed irrespective of number of childs.When i insert more child vertex in different places, parent mxcell size getting changed.

expected child as below:

在此处输入图像描述

Tried with extendParentsOnAdd/autoextend property. Objects in child are overlap on each other as below在此处输入图像描述

I suggest you to give a try to the mxgraph.extendParentsOnAdd property which seems to configure exactly what you are looking for: https://jgraph.github.io/mxgraph/docs/js-api/files/view/mxGraph-js.html#mxGraph.extendParentsOnAdd and set it to false

Specifies if parents should be extended according to the extendParents switch if cells are added. Default is true.

You may also have to configure https://jgraph.github.io/mxgraph/docs/js-api/files/view/mxGraph-js.html#mxGraph.extendParents

Specifies if a parent should contain the child bounds after a resize of the child. Default is true. This has precedence over constrainChildren.

There are also other configuration properties about auto extend, like https://jgraph.github.io/mxgraph/docs/js-api/files/view/mxGraph-js.html#mxGraph.autoExtend (this one is generally useful at graph load time when you provide the intial graph definition)

Notice that this question seems very close to Set mxgraph cell only draggable within the canvas width

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM