Segment intersection value calculation has been fixed

This commit is contained in:
fralx 2022-01-12 16:52:01 +03:00
parent 476254e009
commit c11e47b1cb
2 changed files with 3 additions and 6 deletions

View File

@ -6,14 +6,12 @@ namespace LimeReport {
bool Segment::intersect(Segment value) bool Segment::intersect(Segment value)
{ {
return ((value.m_end>=m_begin)&&(value.m_end<=m_end)) || return (value.m_begin <= m_end) && (value.m_end >= m_begin);
((value.m_begin>=m_begin)&&(value.m_end>=m_end)) ||
((value.m_begin>=m_begin)&&(value.m_end<=m_end)) ||
((value.m_begin<m_begin)&&(value.m_end>m_end)) ;
} }
qreal Segment::intersectValue(Segment value) qreal Segment::intersectValue(Segment value)
{ {
if (!intersect(value)) return 0;
if ((value.m_end >= m_begin) && (value.m_end <= m_end)){ if ((value.m_end >= m_begin) && (value.m_end <= m_end)){
return value.m_end-m_begin; return value.m_end-m_begin;
} }

View File

@ -804,7 +804,6 @@ void PageItemDesignIntf::initPageSize(const PageItemDesignIntf::PageSize &size)
m_sizeChainging = true; m_sizeChainging = true;
if (m_pageSize != Custom){ if (m_pageSize != Custom){
QSizeF pageSize = getRectByPageSize(size); QSizeF pageSize = getRectByPageSize(size);
qDebug() << pageSize;
setWidth(pageSize.width()); setWidth(pageSize.width());
setHeight(pageSize.height()); setHeight(pageSize.height());
} }