Browse Source

Made DragAndDropContainer force mouse-cursor updates to help when using modifier keys to change the drag mode.

tags/2021-05-28
jules 12 years ago
parent
commit
4620d71816
2 changed files with 10 additions and 1 deletions
  1. +9
    -0
      modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp
  2. +1
    -1
      modules/juce_gui_basics/mouse/juce_DragAndDropContainer.h

+ 9
- 0
modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp View File

@@ -154,10 +154,14 @@ public:
else if (now > lastTimeOverTarget + RelativeTime::milliseconds (700)) else if (now > lastTimeOverTarget + RelativeTime::milliseconds (700))
checkForExternalDrag (details, screenPos); checkForExternalDrag (details, screenPos);
} }
forceMouseCursorUpdate();
} }
void timerCallback() override void timerCallback() override
{ {
forceMouseCursorUpdate();
if (sourceDetails.sourceComponent == nullptr) if (sourceDetails.sourceComponent == nullptr)
{ {
delete this; delete this;
@@ -201,6 +205,11 @@ private:
bool hasCheckedForExternalDrag; bool hasCheckedForExternalDrag;
Time lastTimeOverTarget; Time lastTimeOverTarget;
void forceMouseCursorUpdate()
{
Desktop::getInstance().getMainMouseSource().forceMouseCursorUpdate();
}
DragAndDropTarget* getCurrentlyOver() const noexcept DragAndDropTarget* getCurrentlyOver() const noexcept
{ {
return dynamic_cast <DragAndDropTarget*> (currentlyOverComp.get()); return dynamic_cast <DragAndDropTarget*> (currentlyOverComp.get());


+ 1
- 1
modules/juce_gui_basics/mouse/juce_DragAndDropContainer.h View File

@@ -110,7 +110,7 @@ public:
It's useful when a component wants to call startDragging but doesn't know It's useful when a component wants to call startDragging but doesn't know
the DragAndDropContainer it should to use. the DragAndDropContainer it should to use.
Obviously this may return 0 if it doesn't find a suitable component.
Obviously this may return nullptr if it doesn't find a suitable component.
*/ */
static DragAndDropContainer* findParentDragContainerFor (Component* childComponent); static DragAndDropContainer* findParentDragContainerFor (Component* childComponent);


Loading…
Cancel
Save