Skip to content

Commit

Permalink
Added help tip, shortcut command & corrected bug
Browse files Browse the repository at this point in the history
Help tip : when in mode "circle with center and radius", typing "radius"
in the command-line allow the user to set the radius without moving
hands off the keyboard, but the helper message didn't mentionned that
possibility.

Bug : when setting radius from commandline, pressing enter to validate
causes LibreCAD to draw a circle of selected radius at relative zero
position (if no mouse activity into the container) or crosshair
position (if mouse activity into the container).
I added a `switch` test to the `trigger()` method to test the mode, and
if the user is in mode "SetRadius", circle is not drawn & relative zero
is not moved.

Command shortcuts: `circlecr` and `cc`

Conflicts:
	librecad/src/cmd/rs_commands.cpp
  • Loading branch information
jerry-magnin committed Sep 16, 2015
1 parent 2ab2441 commit 684ab78
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 9 additions & 2 deletions librecad/src/actions/rs_actiondrawcirclecr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,15 @@ void RS_ActionDrawCircleCR::trigger() {
*data);
circle->setLayerToActive();
circle->setPenToActive();
container->addEntity(circle);

switch(getStatus()) {
case SetCenter:
container->addEntity(circle);
graphicView->moveRelativeZero(circle->getCenter());
break;
case SetRadius:
break;
}

// upd. undo list:
if (document) {
Expand All @@ -82,7 +90,6 @@ void RS_ActionDrawCircleCR::trigger() {
document->endUndoCycle();
}
graphicView->redraw(RS2::RedrawDrawing);
graphicView->moveRelativeZero(circle->getCenter());

setStatus(SetCenter);

Expand Down
9 changes: 9 additions & 0 deletions librecad/src/cmd/rs_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ RS_Commands::RS_Commands() {
{{"c3", QObject::tr("c3", "circle 3 points")}},
RS2::ActionDrawCircle3P
},
<<<<<<< HEAD
=======
//draw circle with point and radius
{
{{"circlecr", QObject::tr("circlepr", "circle with center and radius")}},
{{"cc", QObject::tr("cc", "circle with center and radius")}},
RS2::ActionDrawCircleCR
},
>>>>>>> 20d9ab4... Added help tip, shortcut command & corrected bug
//draw circle tangent to 3 objects
{
{{"tan3", QObject::tr("tan3", "circle tangent to 3")}},
Expand Down

0 comments on commit 684ab78

Please sign in to comment.