Skip to content

Commit

Permalink
Add line length in status bar (fix #915)
Browse files Browse the repository at this point in the history
  • Loading branch information
dacap committed Apr 19, 2016
1 parent 065188a commit 0993069
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Binary file modified data/skins/default/sheet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions data/skins/default/skin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@
<part id="icon_end" x="192" y="264" w="8" h="8" />
<part id="icon_angle" x="200" y="264" w="8" h="8" />
<part id="icon_key" x="208" y="264" w="8" h="8" />
<part id="icon_distance" x="216" y="264" w="8" h="8" />
</parts>

<stylesheet>
Expand Down
9 changes: 6 additions & 3 deletions src/app/tools/controllers.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,15 @@ class TwoPointsController : public MoveOriginCapability {
if (stroke.size() < 2)
return;

int w = ABS(stroke[1].x-stroke[0].x)+1;
int h = ABS(stroke[1].y-stroke[0].y)+1;

char buf[1024];
sprintf(buf, ":start: %3d %3d :end: %3d %3d :size: %3d %3d :angle: %.1f",
sprintf(buf, ":start: %3d %3d :end: %3d %3d :size: %3d %3d :distance: %.1f :angle: %.1f",
stroke[0].x, stroke[0].y,
stroke[1].x, stroke[1].y,
ABS(stroke[1].x-stroke[0].x)+1,
ABS(stroke[1].y-stroke[0].y)+1,
w, h,
std::sqrt(w*w + h*h),
180.0 * std::atan2(static_cast<double>(stroke[0].y-stroke[1].y),
static_cast<double>(stroke[1].x-stroke[0].x)) / PI);
text = buf;
Expand Down

0 comments on commit 0993069

Please sign in to comment.