@@ -129,7 +129,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
129129 __selectedItemId : null ,
130130 __startHint : null ,
131131 __toolHint : null ,
132- __dropHereNodeUI : null ,
132+ __dropHereUI : null ,
133133 __selectionRectInitPos : null ,
134134 __selectionRectRepr : null ,
135135 __panning : null ,
@@ -1685,7 +1685,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
16851685 this . setDroppable ( true ) ;
16861686 const stopDragging = e => {
16871687 this . __isDraggingLink = null ;
1688- this . __updateWidgets ( false ) ;
1688+ this . __updateDropHere ( false ) ;
16891689 } ;
16901690 const startDragging = e => {
16911691 this . addListenerOnce ( "dragleave" , stopDragging , this ) ;
@@ -1786,7 +1786,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
17861786
17871787 const posX = e . offsetX + 2 ;
17881788 const posY = e . offsetY + 2 ;
1789- this . __updateWidgets ( dragging , posX , posY ) ;
1789+ this . __updateDropHere ( dragging , posX , posY ) ;
17901790 } ,
17911791
17921792 __draggingLink : function ( e , dragging ) {
@@ -1802,34 +1802,36 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
18021802 }
18031803
18041804 const pos = this . __pointerEventToWorkbenchPos ( e ) ;
1805- this . __updateWidgets ( dragging , pos . x , pos . y ) ;
1805+ this . __updateDropHere ( dragging , pos . x , pos . y ) ;
18061806 } ,
18071807
1808- __updateWidgets : function ( dragging , posX , posY ) {
1808+ __updateDropHere : function ( show , posX , posY ) {
18091809 const boxWidth = 120 ;
18101810 const boxHeight = 60 ;
1811- if ( this . __dropHereNodeUI === null ) {
1812- const dropHereNodeUI = this . __dropHereNodeUI = new qx . ui . basic . Label ( this . tr ( "Drop here" ) ) . set ( {
1811+ if ( this . __dropHereUI === null ) {
1812+ const dropHereNodeUI = this . __dropHereUI = new qx . ui . basic . Label ( this . tr ( "Drop here" ) ) . set ( {
18131813 font : "workbench-start-hint" ,
18141814 textColor : "workbench-start-hint"
18151815 } ) ;
18161816 dropHereNodeUI . exclude ( ) ;
18171817 this . __workbenchLayout . add ( dropHereNodeUI ) ;
18181818 dropHereNodeUI . rect = this . __svgLayer . drawDashedRect ( boxWidth , boxHeight ) ;
18191819 }
1820- const dropMe = this . __dropHereNodeUI ;
1821- if ( dragging ) {
1822- dropMe . show ( ) ;
1823- const dropMeBounds = dropMe . getBounds ( ) || dropMe . getSizeHint ( ) ;
1824- dropMe . setLayoutProperties ( {
1820+ let dropHere = this . __dropHereUI ;
1821+ if ( show ) {
1822+ dropHere . show ( ) ;
1823+ const dropMeBounds = dropHere . getBounds ( ) || dropHere . getSizeHint ( ) ;
1824+ dropHere . setLayoutProperties ( {
18251825 left : posX - parseInt ( dropMeBounds . width / 2 ) - parseInt ( boxWidth / 2 ) ,
18261826 top : posY - parseInt ( dropMeBounds . height / 2 ) - parseInt ( boxHeight / 2 )
18271827 } ) ;
1828- if ( "rect" in dropMe ) {
1829- osparc . wrapper . Svg . updateItemPos ( dropMe . rect , posX - boxWidth , posY - boxHeight ) ;
1828+ if ( "rect" in dropHere ) {
1829+ osparc . wrapper . Svg . updateItemPos ( dropHere . rect , posX - boxWidth , posY - boxHeight ) ;
18301830 }
18311831 } else {
1832- this . __removeDropHint ( ) ;
1832+ dropHere . exclude ( ) ;
1833+ osparc . wrapper . Svg . removeItem ( dropHere . rect ) ;
1834+ dropHere = null ;
18331835 }
18341836 } ,
18351837
@@ -2017,14 +2019,14 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
20172019 this . __draggingLink ( e , false ) ;
20182020
20192021 if ( this . __isDraggingLink && "dragData" in this . __isDraggingLink ) {
2022+ const data = this . __isDraggingLink [ "dragData" ] ;
2023+ this . __isDraggingLink = null ;
20202024 const pos = this . __pointerEventToWorkbenchPos ( e , false ) ;
20212025 const service = qx . data . marshal . Json . createModel ( osparc . service . Utils . getFilePicker ( ) ) ;
20222026 const nodeUI = await this . __addNode ( service , pos ) ;
20232027 if ( nodeUI ) {
20242028 const node = nodeUI . getNode ( ) ;
2025- const data = this . __isDraggingLink [ "dragData" ] ;
20262029 osparc . file . FilePicker . setOutputValueFromStore ( node , data . getLocation ( ) , data . getDatasetId ( ) , data . getFileId ( ) , data . getLabel ( ) ) ;
2027- this . __isDraggingLink = null ;
20282030 }
20292031 }
20302032 } ,
@@ -2047,11 +2049,5 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
20472049 } ) ;
20482050 }
20492051 } ,
2050-
2051- __removeDropHint : function ( ) {
2052- this . __dropHereNodeUI . setVisibility ( "excluded" ) ;
2053- osparc . wrapper . Svg . removeItem ( this . __dropHereNodeUI . rect ) ;
2054- this . __dropHereNodeUI = null ;
2055- }
20562052 }
20572053} ) ;
0 commit comments