mirror of
https://github.com/nasa/openmct.git
synced 2025-03-11 06:54:01 +00:00
[Drag-Drop] Prevent redundant drops
Mark default as prevented and check for prevention of default when handling mctDrop events (which allow views to follow up on drop gestures by positioning objects within themselves) avoiding redundant drops into embedded views. WTD-1233.
This commit is contained in:
parent
d3ff49b90b
commit
6f3d6ec12f
@ -249,6 +249,10 @@ define(
|
|||||||
|
|
||||||
// Position a panel after a drop event
|
// Position a panel after a drop event
|
||||||
function handleDrop(e, id, position) {
|
function handleDrop(e, id, position) {
|
||||||
|
// Don't handle this event if it has already been handled
|
||||||
|
if (e.isDefaultPrevented()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Store the position of this element.
|
// Store the position of this element.
|
||||||
addElement({
|
addElement({
|
||||||
type: "fixed.telemetry",
|
type: "fixed.telemetry",
|
||||||
|
@ -109,6 +109,9 @@ define(
|
|||||||
|
|
||||||
// Position a panel after a drop event
|
// Position a panel after a drop event
|
||||||
function handleDrop(e, id, position) {
|
function handleDrop(e, id, position) {
|
||||||
|
if (e.isDefaultPrevented()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Ensure that configuration field is populated
|
// Ensure that configuration field is populated
|
||||||
$scope.configuration = $scope.configuration || {};
|
$scope.configuration = $scope.configuration || {};
|
||||||
// Make sure there is a "panels" field in the
|
// Make sure there is a "panels" field in the
|
||||||
@ -129,6 +132,10 @@ define(
|
|||||||
}
|
}
|
||||||
// Populate template-facing position for this id
|
// Populate template-facing position for this id
|
||||||
populatePosition(id);
|
populatePosition(id);
|
||||||
|
// Layout may contain embedded views which will
|
||||||
|
// listen for drops, so call preventDefault() so
|
||||||
|
// that they can recognize that this event is handled.
|
||||||
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Position panes when the model field changes
|
// Position panes when the model field changes
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "ELASTIC_ROOT",
|
"key": "ELASTIC_ROOT",
|
||||||
"value": "/elastic",
|
"value": "http://localhost:9200",
|
||||||
"priority": "fallback"
|
"priority": "fallback"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user