[TD]adjust breakline position

This commit is contained in:
wandererfan
2024-04-05 14:14:41 -04:00
committed by WandererFan
parent 33a3c84d92
commit 239d0423ec
3 changed files with 21 additions and 64 deletions

View File

@@ -74,28 +74,31 @@ void QGIBreakLine::draw()
// Base::Console().Message("QGIBL::draw()\n");
Base::Vector3d horizontal{1.0, 0.0, 0.0};
prepareGeometryChange();
double offset = zigzagWidth / 2.0;
if (m_direction.IsEqual(horizontal, EWTOLERANCE)) {
// m_direction connects the two cut points. The zigzags have
// to be perpendicular to m_direction
// 2x vertical zigzag from upper to lower
Base::Vector3d start = Base::Vector3d(m_left, m_bottom, 0.0);
// 2x vertical zigzag
Base::Vector3d start = Base::Vector3d(m_left - offset, m_bottom, 0.0);
m_line0->setPath(makeVerticalZigZag(start));
start = Base::Vector3d(m_right - zigzagWidth, m_bottom, 0.0);
start = Base::Vector3d(m_right - offset, m_bottom, 0.0);
m_line1->setPath(makeVerticalZigZag(start));
} else {
// m_top is lower than m_bottom due to Qt Y+ down coords
// the higher break line
// 2x horizontal zigszg from left to right
Base::Vector3d start = Base::Vector3d(m_left, m_bottom, 0.0);
// 2x horizontal zigszags
Base::Vector3d start = Base::Vector3d(m_left, m_bottom - offset, 0.0);
m_line0->setPath(makeHorizontalZigZag(start));
// the lower break line
start = Base::Vector3d(m_left, m_top - zigzagWidth, 0.0);
start = Base::Vector3d(m_left, m_top - offset, 0.0);
m_line1->setPath(makeHorizontalZigZag(start));
}
QRectF backgroundRect(m_left, m_bottom, std::fabs(m_right - m_left), std::fabs(m_top - m_bottom));
QRectF backgroundRect(m_left - offset, m_bottom - offset,
std::fabs(m_right - m_left + zigzagWidth),
std::fabs(m_top - m_bottom + zigzagWidth));
m_background->setRect(backgroundRect);
m_line0->show();