Skip to content

Commit 4ab3783

Browse files
committed
Fixed mousepad dragging
1 parent 822c8a8 commit 4ab3783

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Source/Box.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ void Box::changeListenerCallback(ChangeBroadcaster* source)
7373
// If the object has graphics, we hide the draggable name object
7474
if (graphics && !graphics->fakeGui() && (locked || cnv->isGraph))
7575
{
76-
// textLabel.setVisible(false);
7776
resizer.setVisible(false);
7877
}
7978
else
@@ -382,6 +381,7 @@ void Box::updatePorts()
382381

383382
edge->edgeIdx = input ? numIn : numOut;
384383
edge->isSignal = isSignal;
384+
edge->setAlwaysOnTop(true);
385385

386386
numIn += input;
387387
numOut += !input;

Source/Connection.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ void Connection::mouseMove(const MouseEvent& e)
215215

216216
void Connection::mouseDown(const MouseEvent& e)
217217
{
218+
219+
if(currentPlan.empty()) return;
220+
218221
const auto scaledPlan = scalePath(currentPlan);
219222

220223
if (scaledPlan.size() <= 2) return;
@@ -254,6 +257,8 @@ void Connection::mouseDown(const MouseEvent& e)
254257

255258
void Connection::mouseDrag(const MouseEvent& e)
256259
{
260+
if(currentPlan.empty()) return;
261+
257262
auto& first = start->isInput ? start : end;
258263
auto& last = start->isInput ? end : start;
259264

Source/GUIObjects.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,6 @@ GraphOnParent::GraphOnParent(const pd::Gui& pdGui, Box* box) : GUIComponent(pdGu
10091009
GraphOnParent::~GraphOnParent()
10101010
{
10111011
box->textLabel.setVisible(true);
1012-
removeMouseListener(&box->textLabel);
10131012
closeOpenedSubpatchers();
10141013
}
10151014

@@ -1020,7 +1019,7 @@ void GraphOnParent::resized()
10201019
void GraphOnParent::lock(bool locked)
10211020
{
10221021
isLocked = locked;
1023-
setInterceptsMouseClicks(!box->locked, true);
1022+
setInterceptsMouseClicks(isLocked, true);
10241023
}
10251024

10261025
void GraphOnParent::mouseDown(const MouseEvent& e)
@@ -1150,13 +1149,17 @@ void CommentComponent::paint(Graphics& g)
11501149
MousePad::MousePad(const pd::Gui& gui, Box* box) : GUIComponent(gui, box)
11511150
{
11521151
Desktop::getInstance().addGlobalMouseListener(this);
1153-
// setInterceptsMouseClicks(false, true);
11541152

1153+
//setInterceptsMouseClicks(box->locked, box->locked);
1154+
1155+
addMouseListener(&box->textLabel, false);
11551156
box->textLabel.setVisible(false);
1157+
11561158
}
11571159

11581160
MousePad::~MousePad()
11591161
{
1162+
removeMouseListener(&box->textLabel);
11601163
box->textLabel.setVisible(true);
11611164
Desktop::getInstance().removeGlobalMouseListener(this);
11621165
}

0 commit comments

Comments
 (0)