Skip to content

Fix NaN positions for shapes when dragging them. #7470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 21, 2025
Prev Previous commit
Next Next commit
Use .charAt(0) === 'x'/'y' to test for xref/yref pointing to an axis.
(as is being done at other locations to test this)
  • Loading branch information
my-tien committed Jul 17, 2025
commit c996699355d8e315ed6a8802d46d8892ae9044da
4 changes: 2 additions & 2 deletions src/components/shapes/draw_newshape/newshapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ function newShapes(outlines, dragOptions) {
case 'circle':

var xaxis = axis_ids.getFromId(gd, beforeEdit.xref);
if (beforeEdit.xref.includes('x') && xaxis.type.includes('category')) {
if (beforeEdit.xref.charAt(0) === 'x' && xaxis.type.includes('category')) {
modifyItem('x0', afterEdit.x0 - (beforeEdit.x0shift || 0));
modifyItem('x1', afterEdit.x1 - (beforeEdit.x1shift || 0));
} else {
modifyItem('x0', afterEdit.x0);
modifyItem('x1', afterEdit.x1);
}
var yaxis = axis_ids.getFromId(gd, beforeEdit.yref);
if (beforeEdit.yref.includes('y') && yaxis.type.includes('category')) {
if (beforeEdit.yref.charAt(0) === 'y' && yaxis.type.includes('category')) {
modifyItem('y0', afterEdit.y0 - (beforeEdit.y0shift || 0));
modifyItem('y1', afterEdit.y1 - (beforeEdit.y1shift || 0));
} else {
Expand Down