Skip to content

Commit 3425d21

Browse files
committed
drag indicator
1 parent 03f7f0f commit 3425d21

File tree

1 file changed

+33
-0
lines changed
  • services/static-webserver/client/source/class/osparc/dashboard

1 file changed

+33
-0
lines changed

services/static-webserver/client/source/class/osparc/dashboard/StudyBrowser.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,13 +657,46 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {
657657

658658
__attachDragHandlers: function(card) {
659659
card.setDraggable(true);
660+
660661
card.addListener("dragstart", e => {
661662
e.addAction("move");
662663
e.addType("osparc-moveStudy");
663664
e.addData("osparc-moveStudy", {
664665
"studyDataOrigin": card.getResourceData(),
665666
});
666667
});
668+
669+
// Create drag indicator
670+
const indicator = new qx.ui.core.Widget().set({
671+
width: 200,
672+
height: 100,
673+
opacity: 0.7,
674+
zIndex: 100,
675+
});
676+
indicator.setDecorator(
677+
new qx.ui.decoration.Decorator().set({
678+
width: 3,
679+
style: "solid",
680+
color: "green",
681+
})
682+
);
683+
// Move indicator away
684+
indicator.setLayoutProperties({
685+
left: -1000,
686+
top: -1000
687+
});
688+
qx.core.Init.getApplication().getRoot().add(indicator);
689+
690+
card.addListener("drag", e => {
691+
const orig = e.getOriginalTarget();
692+
const origCoords = orig.getContentLocation();
693+
indicator.setDomPosition(origCoords.left, origCoords.top);
694+
});
695+
696+
card.addListener("dragend", () => {
697+
// Move indicator away
698+
indicator.setDomPosition(-1000, -1000);
699+
});
667700
},
668701

669702
__studyCardClicked: function(item, isShiftPressed) {

0 commit comments

Comments
 (0)