Almost working, no green to sink
This commit is contained in:
parent
3c1c86f952
commit
2208483123
4 changed files with 26 additions and 21 deletions
|
|
@ -43,8 +43,9 @@ void BezierConnectionPainter::paint(
|
|||
auto *model = dynamic_cast<WarpGraphModel *>(&scene->graphModel());
|
||||
if (model) {
|
||||
auto cId = cgo.connectionId();
|
||||
peakLevel = std::max(model->nodePeakLevel(cId.outNodeId),
|
||||
model->nodePeakLevel(cId.inNodeId));
|
||||
if (model->connectionExists(cId)) {
|
||||
peakLevel = model->nodePeakLevel(cId.outNodeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,16 +66,17 @@ QPainterPath SquareConnectionPainter::orthogonalPath(
|
|||
constexpr double kNodePad = 15.0;
|
||||
|
||||
auto const cId = cgo.connectionId();
|
||||
auto *sceneForChannel = cgo.nodeScene();
|
||||
auto *mdl = sceneForChannel
|
||||
? dynamic_cast<WarpGraphModel *>(&sceneForChannel->graphModel())
|
||||
: nullptr;
|
||||
bool connectionAlive = mdl ? mdl->connectionExists(cId) : true;
|
||||
|
||||
double spread = static_cast<double>(cId.outPortIndex) * kSpacing;
|
||||
auto *sceneForChannel = cgo.nodeScene();
|
||||
if (sceneForChannel) {
|
||||
auto *mdl = dynamic_cast<WarpGraphModel *>(&sceneForChannel->graphModel());
|
||||
if (mdl) {
|
||||
auto ch = mdl->connectionChannel(cId);
|
||||
spread = (static_cast<double>(ch.index) - (ch.count - 1) / 2.0)
|
||||
* kSpacing;
|
||||
}
|
||||
if (mdl && connectionAlive) {
|
||||
auto ch = mdl->connectionChannel(cId);
|
||||
spread = (static_cast<double>(ch.index) - (ch.count - 1) / 2.0)
|
||||
* kSpacing;
|
||||
}
|
||||
|
||||
double const dy = in.y() - out.y();
|
||||
|
|
@ -125,12 +126,9 @@ QPainterPath SquareConnectionPainter::orthogonalPath(
|
|||
//
|
||||
|
||||
double railOffset = 0.0;
|
||||
if (sceneForChannel) {
|
||||
auto *mdl2 = dynamic_cast<WarpGraphModel *>(&sceneForChannel->graphModel());
|
||||
if (mdl2) {
|
||||
auto ch = mdl2->connectionChannel(cId);
|
||||
railOffset = static_cast<double>(ch.index) * kSpacing;
|
||||
}
|
||||
if (mdl && connectionAlive) {
|
||||
auto ch = mdl->connectionChannel(cId);
|
||||
railOffset = static_cast<double>(ch.index) * kSpacing;
|
||||
}
|
||||
|
||||
double rightX = out.x() + kMinStub + railOffset;
|
||||
|
|
@ -205,8 +203,9 @@ void SquareConnectionPainter::paint(
|
|||
auto *model = dynamic_cast<WarpGraphModel *>(&scene->graphModel());
|
||||
if (model) {
|
||||
auto cId = cgo.connectionId();
|
||||
peakLevel = std::max(model->nodePeakLevel(cId.outNodeId),
|
||||
model->nodePeakLevel(cId.inNodeId));
|
||||
if (model->connectionExists(cId)) {
|
||||
peakLevel = model->nodePeakLevel(cId.outNodeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -343,6 +343,8 @@ bool WarpGraphModel::deleteConnection(
|
|||
}
|
||||
|
||||
m_connections.erase(it);
|
||||
m_connectionChannels.erase(connectionId);
|
||||
recomputeConnectionChannels();
|
||||
Q_EMIT connectionDeleted(connectionId);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -374,6 +376,7 @@ bool WarpGraphModel::deleteNode(QtNodes::NodeId const nodeId) {
|
|||
m_positions.erase(nodeId);
|
||||
m_sizes.erase(nodeId);
|
||||
m_volumeStates.erase(nodeId);
|
||||
m_peakLevels.erase(nodeId);
|
||||
m_styleCache.erase(nodeId);
|
||||
m_volumeWidgets.erase(nodeId);
|
||||
Q_EMIT nodeDeleted(nodeId);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue