Skip to content

Commit

Permalink
Graph elements not animating when dragged with mouse (#2265)
Browse files Browse the repository at this point in the history
* Update DefaultInteractionEventHandler.java

Flush operation while interacting with graph

* Update DefaultInteractionEventHandler.java

Reduce complexity (if/else) within the method
  • Loading branch information
andromeda-224 authored Feb 2, 2025
1 parent b3497bb commit 2201019
Showing 1 changed file with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ public void startHandlingEvents() {

if (interactionGraph == null) {
manager.addOperation(visualAnnotator.flagBusy(true));
} else {
interactionGraph = interactionGraph.flush(false);
}

long waitTime = 0;
Expand All @@ -229,20 +227,15 @@ public void startHandlingEvents() {
if (interactionGraph != null) {
nextWaitTime = Math.max(0, beforeProcessing + handler.processEvent(interactionGraph) - System.currentTimeMillis());
} else {
// info log for race condition when running animations
final GraphNode gn = GraphNode.getGraphNode(graph.getId());
final AnimationManager animationManager = ((VisualGraphTopComponent) gn.getTopComponent()).getAnimationManager();

if (!animationManager.isAnimating()) {
LOGGER.log(Level.WARNING, "Unable to obtain lock on interactionGraph, event is queued");
} else {
LOGGER.log(Level.INFO, "Unable to obtain lock on interactionGraph during animation, event is queued");
}
logNullInteractionGraph();
}
// Add any visual operations that need to occur after a graph flush.
final List<VisualOperation> operations = new LinkedList<>();
operationQueue.drainTo(operations);
operations.forEach(op -> manager.addOperation(op));
if (!operations.isEmpty() && interactionGraph != null) {
interactionGraph = interactionGraph.flush(false);
}
final boolean waitForever = eventState.isMousePressed() || (eventState.getCurrentAction().equals(SceneAction.CREATING) && eventState.getCurrentCreationMode().equals(CreationMode.CREATING_TRANSACTION));
waitTime = Math.max(nextWaitTime, time + waitTime - System.currentTimeMillis());
time = System.currentTimeMillis();
Expand Down Expand Up @@ -274,6 +267,18 @@ public void startHandlingEvents() {
eventHandlingThread.start();
}

private void logNullInteractionGraph() {
// info log for race condition when running animations
final GraphNode gn = GraphNode.getGraphNode(graph.getId());
final AnimationManager animationManager = ((VisualGraphTopComponent) gn.getTopComponent()).getAnimationManager();

if (!animationManager.isAnimating()) {
LOGGER.log(Level.WARNING, "Unable to obtain lock on interactionGraph, event is queued");
} else {
LOGGER.log(Level.INFO, "Unable to obtain lock on interactionGraph during animation, event is queued");
}
}

@Override
public void stopHandlingEvents() {
handleEvents = false;
Expand Down

0 comments on commit 2201019

Please sign in to comment.