From 937fe8f62ce4eb75a01bd740ed6fe9c71532bb63 Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Aug 18 2023 06:47:55 +0000 Subject: #assistants: improve ruler marks --- diff --git a/toonz/sources/tnztools/assistants/assistantline.cpp b/toonz/sources/tnztools/assistants/assistantline.cpp index a306f7b..1b464aa 100644 --- a/toonz/sources/tnztools/assistants/assistantline.cpp +++ b/toonz/sources/tnztools/assistants/assistantline.cpp @@ -159,13 +159,14 @@ public: private: void drawRuler(const TPointD &a, const TPointD &b, double pixelSize, bool perspective) const { double minStep = 10.0*pixelSize; - double alpha = getDrawingGridAlpha(); + double alpha = getDrawingAlpha(); TPointD direction = b - a; double l2 = norm2(direction); if (l2 <= TConsts::epsilon*TConsts::epsilon) return; double dirLen = sqrt(l2); TPointD dirProj = direction*(1.0/l2); + TPointD markOffset = TPointD(-direction.y, direction.x)*(5*pixelSize/dirLen); double xg0 = dirProj*(m_grid0.position - a); double xg1 = dirProj*(m_grid1.position - a); @@ -175,14 +176,18 @@ private: double xa0 = dirProj*(m_a.position - a); double k = 0.0, begin = 0.0, end = 0.0; if (!calcPerspectiveStep(minStep/dirLen, 0.0, 1.0, xa0, xg0, xg1, k, begin, end)) return; - for(double x = begin; fabs(x) < fabs(end); x *= k) - drawDot(a + direction*(xa0 + x), alpha); + for(double x = begin; fabs(x) < fabs(end); x *= k) { + TPointD p = a + direction*(xa0 + x); + drawSegment(p - markOffset, p + markOffset, pixelSize, alpha); + } } else { // draw linear double dx = fabs(xg1 - xg0); if (dx*dirLen < minStep) return; - for(double x = xg0 - floor(xg0/dx)*dx; x < 1.0; x += dx) - drawDot(a + direction*x, alpha); + for(double x = xg0 - floor(xg0/dx)*dx; x < 1.0; x += dx) { + TPointD p = a + direction*x; + drawSegment(p - markOffset, p + markOffset, pixelSize, alpha); + } } }