Skip to content

Commit

Permalink
drag indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
odeimaiz committed Dec 13, 2024
1 parent 03f7f0f commit 3425d21
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -657,13 +657,46 @@ qx.Class.define("osparc.dashboard.StudyBrowser", {

__attachDragHandlers: function(card) {
card.setDraggable(true);

card.addListener("dragstart", e => {
e.addAction("move");
e.addType("osparc-moveStudy");
e.addData("osparc-moveStudy", {
"studyDataOrigin": card.getResourceData(),
});
});

// Create drag indicator
const indicator = new qx.ui.core.Widget().set({
width: 200,
height: 100,
opacity: 0.7,
zIndex: 100,
});
indicator.setDecorator(
new qx.ui.decoration.Decorator().set({
width: 3,
style: "solid",
color: "green",
})
);
// Move indicator away
indicator.setLayoutProperties({
left: -1000,
top: -1000
});
qx.core.Init.getApplication().getRoot().add(indicator);

card.addListener("drag", e => {
const orig = e.getOriginalTarget();
const origCoords = orig.getContentLocation();
indicator.setDomPosition(origCoords.left, origCoords.top);
});

card.addListener("dragend", () => {
// Move indicator away
indicator.setDomPosition(-1000, -1000);
});
},

__studyCardClicked: function(item, isShiftPressed) {
Expand Down

0 comments on commit 3425d21

Please sign in to comment.