Skip to content

Commit

Permalink
List constrained requests when selecting a constraint.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Jan 17, 2017
1 parent 4aae229 commit 5d9356a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ New sketch features:
New constraint features:
* When dragging an arc or rectangle point, it will be automatically
constrained to other points with a click.
* When selecting a constraint, the requests it constraints can be selected
in the text window.

New export/import features:
* Three.js: allow configuring projection for exported model, and initially
Expand Down
29 changes: 29 additions & 0 deletions src/describescreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,35 @@ void TextWindow::DescribeSelection() {
Printf(false, "%FtSELECTED:%E %s",
c->DescriptionString().c_str());
}

std::vector<hEntity> lhe = {};
lhe.push_back(c->ptA);
lhe.push_back(c->ptB);
lhe.push_back(c->entityA);
lhe.push_back(c->entityB);
lhe.push_back(c->entityC);
lhe.push_back(c->entityD);

auto it = std::remove_if(lhe.begin(), lhe.end(),
[](hEntity he) {
return he.v == Entity::NO_ENTITY.v || !he.isFromRequest();
});
lhe.erase(it, lhe.end());

if(!lhe.empty()) {
Printf(true, "%FtCONSTRAINED REQUESTS:%E");

int a = 0;
for(hEntity he : lhe) {
Request *r = SK.GetRequest(he.request());
std::string s = r->DescriptionString();
Printf(false, "%Bp %Fl%Ll%D%f%h%s%E",
(a & 1) ? 'd' : 'a',
r->h.v, (&TextWindow::ScreenSelectRequest),
&(TextWindow::ScreenHoverRequest), s.c_str());
a++;
}
}
} else {
int n = SS.GW.selection.n;
Printf(false, "%FtSELECTED:%E %d item%s", n, n == 1 ? "" : "s");
Expand Down

0 comments on commit 5d9356a

Please sign in to comment.