Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix removing of a not selected label instead of selected #1255

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 24 additions & 23 deletions qucs/schematic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1318,19 +1318,19 @@ Schematic::Selection Schematic::currentSelection() const {

// find boundings of all wires
for (auto* pw : *a_Wires) {
if (!pw->isSelected) {
continue;
if (pw->isSelected) {
isAnySelected = true;
selection.wires.push_back(pw);
xmin = std::min(pw->x1, xmin);
xmax = std::max(pw->x2, xmax);
ymin = std::min(pw->y1, ymin);
ymax = std::max(pw->y2, ymax);
}
isAnySelected = true;
selection.wires.push_back(pw);
xmin = std::min(pw->x1, xmin);
xmax = std::max(pw->x2, xmax);
ymin = std::min(pw->y1, ymin);
ymax = std::max(pw->y2, ymax);

if (auto* pl = pw->Label; pl) { // check position of wire label
selection.labels.push_back(pl);
pl->getLabelBounding(x1, y1, x2, y2);
if (pw->Label != nullptr && pw->Label->isSelected) { // check position of wire label
isAnySelected = true;
selection.labels.push_back(pw->Label);
pw->Label->getLabelBounding(x1, y1, x2, y2);
xmin = std::min(x1, xmin);
xmax = std::max(x2, xmax);
ymin = std::min(y1, ymin);
Expand All @@ -1344,10 +1344,10 @@ Schematic::Selection Schematic::currentSelection() const {
selection.nodes.push_back(pn);
}

if (auto* pl = pn->Label; pl) { // check position of node label
selection.labels.push_back(pl);
if (pn->Label != nullptr && pn->Label->isSelected) { // check position of node label
selection.labels.push_back(pn->Label);
isAnySelected = true;
pl->getLabelBounding(x1, y1, x2, y2);
pn->Label->getLabelBounding(x1, y1, x2, y2);
xmin = std::min(x1, xmin);
xmax = std::max(x2, xmax);
ymin = std::min(y1, ymin);
Expand All @@ -1357,20 +1357,21 @@ Schematic::Selection Schematic::currentSelection() const {

// find boundings of all diagrams
for (auto* pd : *a_Diagrams) {
if (!pd->isSelected) {
continue;
if (pd->isSelected) {
selection.diagrams.push_back(pd);
isAnySelected = true;
pd->Bounding(x1, y1, x2, y2);
xmin = std::min(x1, xmin);
xmax = std::max(x2, xmax);
ymin = std::min(y1, ymin);
ymax = std::max(y2, ymax);
}
selection.diagrams.push_back(pd);
isAnySelected = true;
pd->Bounding(x1, y1, x2, y2);
xmin = std::min(x1, xmin);
xmax = std::max(x2, xmax);
ymin = std::min(y1, ymin);
ymax = std::max(y2, ymax);

for (Graph* pg : pd->Graphs) {
// test all markers of diagram
for (Marker* pm : pg->Markers) {
if (!pm->isSelected) continue;
isAnySelected = true;
selection.markers.push_back(pm);
pm->Bounding(x1, y1, x2, y2);
xmin = std::min(x1, xmin);
Expand Down
Loading