MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / dragSource

Method dragSource

Gui/Edge.cpp:699–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

697}
698
699void
700Edge::dragSource(const QPointF & src)
701{
702 setLine( QLineF(line().p1(), src) );
703
704 double a = std::acos( line().dx() / std::max( EDGE_LENGTH_MIN, line().length() ) );
705 if (line().dy() < 0) {
706 a = 2 * M_PI - a;
707 }
708
709 double arrowSize = TO_DPIX(ARROW_SIZE_DISCONNECTED);
710 QPointF arrowP1 = line().p1() + QPointF(std::cos(a + ARROW_HEAD_ANGLE / 2) * arrowSize,
711 std::sin(a + ARROW_HEAD_ANGLE / 2) * arrowSize);
712 QPointF arrowP2 = line().p1() + QPointF(std::cos(a - ARROW_HEAD_ANGLE / 2) * arrowSize,
713 std::sin(a - ARROW_HEAD_ANGLE / 2) * arrowSize);
714 _imp->arrowHead.clear();
715 _imp->arrowHead << line().p1() << arrowP1 << arrowP2;
716
717
718 if (_imp->label) {
719 QPointF pos( ( ( line().p1().x() + src.x() ) / 2. ) - 5, ( ( line().p1().y() + src.y() ) / 2. ) - 5 );
720 //qDebug() << pos;
721 _imp->label->setPos(pos);
722 }
723}
724
725void
726Edge::dragDest(const QPointF & dst)

Callers 1

mouseMoveEventMethod · 0.80

Calls 10

maxFunction · 0.85
p1Method · 0.80
lengthMethod · 0.80
QPointFClass · 0.70
acosFunction · 0.50
cosFunction · 0.50
sinFunction · 0.50
clearMethod · 0.45
xMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected