jgraph / mxgraph

mxGraph is a fully client side JavaScript diagramming library
Other
6.82k stars 2.06k forks source link

graph.moveCells does not respect STYLE_MOVABLE #447

Closed benwalch closed 4 years ago

benwalch commented 4 years ago

Thank you for this project!

moveCells implementation of graph does move all given cells - even the ones with style[mxConstants.STYLE_MOVABLE] set to false.

Why is this important? Some Layout mechanisms use updateGroupBounds which in turn calls moveCells with all children. If there is a child vertex in the group which is defined to not be movable (by setting mxConstants.STYLE_MOVABLE key in the cell style to false) it gets moved regardless of that setting.

PrudhviMadasu commented 4 years ago

use below function to decide which style can move and restrict

graph.isCellMovable = function (cell) { try {

            if (cell.style.includes('style name 1')) {
                return true;
            } else if (cell.style.includes('style name 2')) {
                return true;
            } else {
                return false;
            }
        } catch (e) {
        }
    };