Fix cell dragbar gaps and offset

This commit is contained in:
manongjohn 2022-03-07 00:17:41 -05:00
parent 1e8832d06b
commit cfb361c1ea

View file

@ -1791,7 +1791,17 @@ void CellArea::drawDragHandle(QPainter &p, bool isStart, const QPoint &xy,
dragHandleRect.adjust(0, 1, 0, 0); dragHandleRect.adjust(0, 1, 0, 0);
else else
dragHandleRect.adjust(1, 0, 0, 0); dragHandleRect.adjust(1, 0, 0, 0);
} else {
if (xy.x() > 1 && !m_viewer->orientation()->isVerticalTimeline())
dragHandleRect.adjust(-1, 0, 0, 0);
else if (xy.y() > 1 && m_viewer->orientation()->isVerticalTimeline())
dragHandleRect.adjust(0, -1, 0, 0);
} }
// Adjust for 1st row
if (xy.x() <= 1 && !m_viewer->orientation()->isVerticalTimeline())
dragHandleRect.adjust(0, 0, -1, 0);
p.fillRect(dragHandleRect, QBrush(sideColor)); p.fillRect(dragHandleRect, QBrush(sideColor));
} }
@ -1799,10 +1809,17 @@ void CellArea::drawDragHandle(QPainter &p, bool isStart, const QPoint &xy,
void CellArea::drawEndOfDragHandle(QPainter &p, bool isEnd, const QPoint &xy, void CellArea::drawEndOfDragHandle(QPainter &p, bool isEnd, const QPoint &xy,
const QColor &cellColor) const { const QColor &cellColor) const {
if (!isEnd) return; if (!isEnd) return;
QPoint lxy = xy;
// Adjust left for 1st row
if (lxy.x() <= 1 && !m_viewer->orientation()->isVerticalTimeline())
lxy.setX(lxy.x() - 1);
QPoint frameAdj = m_viewer->getFrameZoomAdjustment(); QPoint frameAdj = m_viewer->getFrameZoomAdjustment();
QPainterPath corner = m_viewer->orientation() QPainterPath corner = m_viewer->orientation()
->path(PredefinedPath::DRAG_HANDLE_CORNER) ->path(PredefinedPath::DRAG_HANDLE_CORNER)
.translated(xy - frameAdj); .translated(lxy - frameAdj);
p.fillPath(corner, QBrush(cellColor)); p.fillPath(corner, QBrush(cellColor));
} }
@ -1811,17 +1828,36 @@ void CellArea::drawLockedDottedLine(QPainter &p, bool isLocked, bool isStart,
const QPoint &xy, const QPoint &xy,
const QColor &cellColor) const { const QColor &cellColor) const {
if (!isLocked) return; if (!isLocked) return;
QPoint lxy = xy;
int adjEndX = 0, adjEndY = 0;
if (!m_viewer->orientation()->isVerticalTimeline()) {
if (lxy.x() <= 1) {
lxy.setX(lxy.x() + 1); // Adjust for 1st row
adjEndX = -2;
} else
adjEndX = -1;
} else {
if (lxy.y() <= 1) {
lxy.setY(lxy.y() + 1);
adjEndY = -2;
} else
adjEndY = -1;
}
p.setPen(QPen(cellColor, 2, Qt::DotLine)); p.setPen(QPen(cellColor, 2, Qt::DotLine));
QPoint frameAdj = m_viewer->getFrameZoomAdjustment(); QPoint frameAdj = m_viewer->getFrameZoomAdjustment();
QLine dottedLine = QLine dottedLine =
m_viewer->orientation()->line(PredefinedLine::LOCKED).translated(xy); m_viewer->orientation()->line(PredefinedLine::LOCKED).translated(lxy);
if (isStart) { if (isStart) {
if (m_viewer->orientation()->isVerticalTimeline()) if (m_viewer->orientation()->isVerticalTimeline())
dottedLine.setP1(QPoint(dottedLine.x1(), dottedLine.y1() + 2)); dottedLine.setP1(QPoint(dottedLine.x1(), dottedLine.y1() + 2));
else else
dottedLine.setP1(QPoint(dottedLine.x1() + 2, dottedLine.y1())); dottedLine.setP1(QPoint(dottedLine.x1() + 2, dottedLine.y1()));
} }
dottedLine.setP2(QPoint(dottedLine.x2(), dottedLine.y2()) - frameAdj); dottedLine.setP2(QPoint(dottedLine.x2() + adjEndX, dottedLine.y2() + adjEndY) -
frameAdj);
p.drawLine(dottedLine); p.drawLine(dottedLine);
} }