jgraph / mxgraph

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

Maybe a calculation error with function center() in mxGraph.js #506

Closed MorphZhou closed 3 years ago

MorphZhou commented 3 years ago

the same issue as one in the jgraph/mxgraph2 repo

the key code is here: https://github.com/jgraph/mxgraph/blob/master/javascript/src/js/view/mxGraph.js#L8008

this.view.setTranslate((horizontal) ? Math.floor(t.x - bounds.x * s + dx * cx / s) : t.x,
            (vertical) ? Math.floor(t.y - bounds.y * s + dy * cy / s) : t.y);

the expressionbounds.x * s and bounds.y * s should be bounds.x / s and bounds.y / s