Don't crash after right-clicking on derived entities.

pull/4/head
whitequark 2016-04-17 01:16:47 +00:00
parent a4a353f01b
commit b3df595769
1 changed files with 19 additions and 25 deletions

View File

@ -573,24 +573,19 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
}
if(gs.comments > 0 || gs.points > 0) {
AddContextMenuItem("Snap to Grid", CMNU_SNAP_TO_GRID);
}
if(gs.points == 1) {
hRequest hr = gs.point[0].request();
if(hr.v != 0) {
Request *r = SK.GetRequest(hr);
if(gs.points == 1 && gs.point[0].isFromRequest()) {
Request *r = SK.GetRequest(gs.point[0].request());
int index = r->IndexOfPoint(gs.point[0]);
if((r->type == Request::CUBIC && (index > 1 && index < r->extraPoints + 2)) ||
r->type == Request::CUBIC_PERIODIC) {
AddContextMenuItem("Remove Spline Point", CMNU_REMOVE_SPLINE_PT);
}
}
}
}
if(gs.entities == 1) {
hRequest hr = gs.entity[0].request();
if(hr.v != 0) {
Request *r = SK.GetRequest(hr);
if(gs.entities == 1 && gs.entity[0].isFromRequest()) {
Request *r = SK.GetRequest(gs.entity[0].request());
if(r->type == Request::CUBIC || r->type == Request::CUBIC_PERIODIC) {
Entity *e = SK.GetEntity(gs.entity[0]);
e->GetDistance(Point2d::From(x, y));
@ -601,7 +596,6 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
AddContextMenuItem("Add Spline Point", CMNU_ADD_SPLINE_PT);
}
}
}
if(gs.points == 1) {
Entity *p = SK.GetEntity(gs.point[0]);