diff options
author | talasila <talasila@research.att.com> | 2017-02-08 10:13:29 -0500 |
---|---|---|
committer | talasila <talasila@research.att.com> | 2017-02-08 10:15:00 -0500 |
commit | f8a8d5192b1e5013d9e2f699be54b072ef39d5f0 (patch) | |
tree | b7a65bb0a7d70a9dc24c064113868e5f3b8e6a09 /dcae_dmaapbc_webapp/src/main/webapp/app/fusion/ase/scripts/dragMoveListener.js | |
parent | 72a80fbff7120630576ccd5aa67c20818c2943c7 (diff) |
Initial OpenECOMP UI/DMaapBC commit
Change-Id: Ia492e1b88311b9bed4c31f593b28deaaad73b7e4
Signed-off-by: talasila <talasila@research.att.com>
Diffstat (limited to 'dcae_dmaapbc_webapp/src/main/webapp/app/fusion/ase/scripts/dragMoveListener.js')
-rw-r--r-- | dcae_dmaapbc_webapp/src/main/webapp/app/fusion/ase/scripts/dragMoveListener.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/dcae_dmaapbc_webapp/src/main/webapp/app/fusion/ase/scripts/dragMoveListener.js b/dcae_dmaapbc_webapp/src/main/webapp/app/fusion/ase/scripts/dragMoveListener.js new file mode 100644 index 0000000..138550c --- /dev/null +++ b/dcae_dmaapbc_webapp/src/main/webapp/app/fusion/ase/scripts/dragMoveListener.js @@ -0,0 +1,55 @@ + +//Called when an node is moved, translates the arrow and updates attributes + +x = 0, y = 0; //Define coordinates + +function dragMoveListener (event) { + var target = event.target, + uuid = target.id, + // keep the dragged position in the data-x/data-y attributes + x = (parseFloat(target.getAttribute('data_x')) || 0) + event.dx, + y = (parseFloat(target.getAttribute('data_y')) || 0) + event.dy; + // translate the element + target.style.webkitTransform = + target.style.transform = + 'translate(' + x + 'px, ' + y + 'px)'; + + + // update the position attributes + target.setAttribute('data_x', x); + target.setAttribute('data_y', y); + + if ($("#"+uuid).hasClass("drag-1")){ + storeXY(nodeArr,uuid); + } + if (y<30) { + moveSelection(event.dx,event.dy,event.target.id); + moveDependants(event.dx,event.dy,event.target.id); + } + else { + for (var i=0; i<arrowArr.length; i++){ + if (arrowArr[i][8] == target.id){ + arrowArr[i][8] = null; + } + if (arrowArr[i][9] == target.id){ + arrowArr[i][9] = null; + } + determineLRNode(arrowArr[i][1],"arrow"); + } + } + + if (isOverlapped(uuid) == true){ + document.getElementById(uuid).style.transition = "background .5s ease"; + document.getElementById(uuid).style.background = "rgba(255,255,0,.40)"; //yellow + //shiftRight(event.target); Include for real-time shifting + } + else { + document.getElementById(uuid).style.background = "#29e"; //remove yellow + } + while (x>$("#grid").width() - $("#sideBar").width()){ + addWidth(); + } +} + +// this is used in resizing +window.dragMoveListener = dragMoveListener;
\ No newline at end of file |