mirror of
https://github.com/nasa/openmct.git
synced 2024-12-19 13:17:53 +00:00
[Layout] Fix errors in mct-drag
Properly reset the initial drag position tracked by the mct-drag position so that multiple drags upon the same element are correctly offset from an initial position. Also, preventDefault from events to avoid selection highlights during drag. Supports editing Layout objects, for WTD-535.
This commit is contained in:
parent
479aaa09fb
commit
b941557b41
@ -28,6 +28,10 @@ define(
|
||||
function continueDrag(event) {
|
||||
updatePosition(event);
|
||||
fireListener("mctDrag");
|
||||
|
||||
// Don't show selection highlights, etc
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function endDrag(event) {
|
||||
@ -37,14 +41,27 @@ define(
|
||||
continueDrag(event);
|
||||
|
||||
fireListener("mctDragUp");
|
||||
|
||||
// Clear out start-of-drag position
|
||||
initialPosition = undefined;
|
||||
|
||||
// Don't show selection highlights, etc
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function startDrag(event) {
|
||||
body.on("mouseup", endDrag);
|
||||
body.on("mousemove", continueDrag);
|
||||
|
||||
updatePosition(event);
|
||||
|
||||
fireListener("mctDragDown");
|
||||
fireListener("mctDrag");
|
||||
|
||||
// Don't show selection highlights, etc
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
element.on("mousedown", startDrag);
|
||||
|
Loading…
Reference in New Issue
Block a user