Commit 1bdf61d7 authored by Joe Mason's avatar Joe Mason Committed by Commit Bot

[PM] Leave nodes pinned after dragging

They can be un-pinned by dropping them outside their designated area.

R=siggi

Change-Id: I719d6be9509666f4387a4bba91946c3861b771eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2214913Reviewed-by: default avatarSigurður Ásgeirsson <siggi@chromium.org>
Reviewed-by: default avatardpapad <dpapad@chromium.org>
Auto-Submit: Joe Mason <joenotcharles@chromium.org>
Commit-Queue: dpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771910}
parent e11e3814
...@@ -993,9 +993,14 @@ class Graph { ...@@ -993,9 +993,14 @@ class Graph {
if (!d3.event.active) { if (!d3.event.active) {
this.simulation_.alphaTarget(0); this.simulation_.alphaTarget(0);
} }
// Leave the node pinned where it was dropped. Return it to free
// positioning if it's dropped outside its designated area.
const bounds = d.allowedYRange(this.height_);
if (d3.event.y < bounds[0] || d3.event.y > bounds[1]) {
d.fx = null; d.fx = null;
d.fy = null; d.fy = null;
} }
}
/** /**
* @param {!d3.ForceNode} d The node to position. * @param {!d3.ForceNode} d The node to position.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment