fix fx schematic links disappear
This commit is contained in:
parent
fb88fabf54
commit
0a55a9b170
2 changed files with 32 additions and 7 deletions
|
@ -1616,13 +1616,25 @@ void FxSchematicPort::mouseMoveEvent(QGraphicsSceneMouseEvent *me) {
|
||||||
if (!m_ghostLinks.isEmpty() && !m_ghostLinks[0]->isVisible())
|
if (!m_ghostLinks.isEmpty() && !m_ghostLinks[0]->isVisible())
|
||||||
m_ghostLinks[0]->show();
|
m_ghostLinks[0]->show();
|
||||||
bool cntr = me->modifiers() == Qt::ControlModifier;
|
bool cntr = me->modifiers() == Qt::ControlModifier;
|
||||||
|
|
||||||
|
if (!m_linkingTo) {
|
||||||
|
if (m_currentTargetPort) {
|
||||||
|
m_currentTargetPort->resetSnappedLinksOnDynamicPortFx();
|
||||||
|
m_currentTargetPort = 0;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FxSchematicPort *targetPort = dynamic_cast<FxSchematicPort *>(m_linkingTo);
|
||||||
|
assert(targetPort);
|
||||||
|
|
||||||
|
if (m_currentTargetPort == targetPort) return;
|
||||||
|
|
||||||
if (m_currentTargetPort) {
|
if (m_currentTargetPort) {
|
||||||
m_currentTargetPort->resetSnappedLinksOnDynamicPortFx();
|
m_currentTargetPort->resetSnappedLinksOnDynamicPortFx();
|
||||||
m_currentTargetPort = 0;
|
m_currentTargetPort = 0;
|
||||||
}
|
}
|
||||||
if (!m_linkingTo) return;
|
|
||||||
FxSchematicPort *targetPort = dynamic_cast<FxSchematicPort *>(m_linkingTo);
|
|
||||||
assert(targetPort);
|
|
||||||
m_currentTargetPort = targetPort;
|
m_currentTargetPort = targetPort;
|
||||||
TFx *targetFx = targetPort->getOwnerFx();
|
TFx *targetFx = targetPort->getOwnerFx();
|
||||||
TZeraryColumnFx *colFx = dynamic_cast<TZeraryColumnFx *>(targetFx);
|
TZeraryColumnFx *colFx = dynamic_cast<TZeraryColumnFx *>(targetFx);
|
||||||
|
@ -1643,8 +1655,16 @@ void FxSchematicPort::mouseMoveEvent(QGraphicsSceneMouseEvent *me) {
|
||||||
targetFx->dynamicPortGroup(groupId)->ports();
|
targetFx->dynamicPortGroup(groupId)->ports();
|
||||||
int portId = getIndex(targetFxPort, groupedPorts);
|
int portId = getIndex(targetFxPort, groupedPorts);
|
||||||
if (portId == -1) return;
|
if (portId == -1) return;
|
||||||
if (targetFx != m_ownerFx && cntr && getType() == eFxOutputPort)
|
if (targetFx != m_ownerFx && getType() == eFxOutputPort) {
|
||||||
targetPort->handleSnappedLinksOnDynamicPortFx(groupedPorts, portId);
|
// inserting a link above
|
||||||
|
if (cntr)
|
||||||
|
targetPort->handleSnappedLinksOnDynamicPortFx(groupedPorts, portId);
|
||||||
|
// replacing a link
|
||||||
|
else
|
||||||
|
targetPort->handleSnappedLinksOnDynamicPortFx(groupedPorts, portId,
|
||||||
|
portId);
|
||||||
|
}
|
||||||
|
// switching links in the connected ports
|
||||||
else if (targetFx == m_ownerFx && getType() == eFxInputPort) {
|
else if (targetFx == m_ownerFx && getType() == eFxInputPort) {
|
||||||
if (!m_ghostLinks.isEmpty()) {
|
if (!m_ghostLinks.isEmpty()) {
|
||||||
for (SchematicLink *ghostLink : m_ghostLinks)
|
for (SchematicLink *ghostLink : m_ghostLinks)
|
||||||
|
|
|
@ -853,6 +853,7 @@ void SchematicPort::mouseMoveEvent(QGraphicsSceneMouseEvent *me) {
|
||||||
|
|
||||||
// Snapping
|
// Snapping
|
||||||
SchematicPort *linkingTo = searchPort(me->scenePos());
|
SchematicPort *linkingTo = searchPort(me->scenePos());
|
||||||
|
|
||||||
if (!linkingTo) {
|
if (!linkingTo) {
|
||||||
for (SchematicLink *ghostLink : m_ghostLinks) {
|
for (SchematicLink *ghostLink : m_ghostLinks) {
|
||||||
ghostLink->updateEndPos(me->scenePos());
|
ghostLink->updateEndPos(me->scenePos());
|
||||||
|
@ -864,8 +865,12 @@ void SchematicPort::mouseMoveEvent(QGraphicsSceneMouseEvent *me) {
|
||||||
m_linkingTo = nullptr;
|
m_linkingTo = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if to be connected something
|
// if to be connected something new
|
||||||
else if (linkingTo != this) {
|
else if (linkingTo != this && m_linkingTo != linkingTo) {
|
||||||
|
if (m_linkingTo) {
|
||||||
|
m_linkingTo->highLight(false);
|
||||||
|
m_linkingTo->update();
|
||||||
|
}
|
||||||
m_linkingTo = linkingTo;
|
m_linkingTo = linkingTo;
|
||||||
for (SchematicLink *ghostLink : m_ghostLinks) {
|
for (SchematicLink *ghostLink : m_ghostLinks) {
|
||||||
ghostLink->updatePath(ghostLink->getStartPort(), linkingTo);
|
ghostLink->updatePath(ghostLink->getStartPort(), linkingTo);
|
||||||
|
|
Loading…
Reference in a new issue