Add line length in status bar (fix #915)

This commit is contained in:
David Capello 2016-04-19 15:08:36 -03:00
parent 065188aea3
commit 0993069e0b
3 changed files with 7 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -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>

View File

@ -201,12 +201,15 @@ public:
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;