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
WIP draw_newshape_test
  • Loading branch information
my-tien committed Jul 17, 2025
commit 13e3cc18ea153246210c569d30327cb981b51fcc
37 changes: 37 additions & 0 deletions test/jasmine/tests/draw_newshape_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,43 @@ describe('Activate and edit editable shapes', function() {

.then(done, done.fail);
});

it('should be possible to drag shapes referencing non-categorical axes', function(done) {
Plotly.newPlot(gd, {
data: [
{
x: ["2015-02-01", "2015-02-02", "2015-02-03"],
y: [14, 17, 8],
mode: "line",
},
],
layout: {
xaxis: { title: { text: "Date" }, type: "date" },
dragmode: "drawline",
shapes: [
{
type: "rect",
xref: "x",
yref: "paper",
x0: "2015-02-02",
y0: 0,
x1: "2015-02-08",
y1: 1,
opacity: 0.2,
editable: true,
},
],
},
})
.then(function() { drag([[257.64, 370], [250, 300]]); }) // move lower left corner up and left
.then(function () {
var shapes = gd._fullLayout.shapes;
var obj = shapes[0]._input;
print(obj);
assertPos(obj.path, 'M250,300H1019V100H257.64Z');
})
.then(done, done.fail);
});
});
});

Expand Down