jgraph / mxgraph

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

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

Closed MorphZhou closed 4 years ago

MorphZhou commented 4 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