@@ -129,7 +129,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
129
129
__selectedItemId : null ,
130
130
__startHint : null ,
131
131
__toolHint : null ,
132
- __dropHereNodeUI : null ,
132
+ __dropHereUI : null ,
133
133
__selectionRectInitPos : null ,
134
134
__selectionRectRepr : null ,
135
135
__panning : null ,
@@ -1685,7 +1685,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
1685
1685
this . setDroppable ( true ) ;
1686
1686
const stopDragging = e => {
1687
1687
this . __isDraggingLink = null ;
1688
- this . __updateWidgets ( false ) ;
1688
+ this . __updateDropHere ( false ) ;
1689
1689
} ;
1690
1690
const startDragging = e => {
1691
1691
this . addListenerOnce ( "dragleave" , stopDragging , this ) ;
@@ -1786,7 +1786,7 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
1786
1786
1787
1787
const posX = e . offsetX + 2 ;
1788
1788
const posY = e . offsetY + 2 ;
1789
- this . __updateWidgets ( dragging , posX , posY ) ;
1789
+ this . __updateDropHere ( dragging , posX , posY ) ;
1790
1790
} ,
1791
1791
1792
1792
__draggingLink : function ( e , dragging ) {
@@ -1802,34 +1802,36 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
1802
1802
}
1803
1803
1804
1804
const pos = this . __pointerEventToWorkbenchPos ( e ) ;
1805
- this . __updateWidgets ( dragging , pos . x , pos . y ) ;
1805
+ this . __updateDropHere ( dragging , pos . x , pos . y ) ;
1806
1806
} ,
1807
1807
1808
- __updateWidgets : function ( dragging , posX , posY ) {
1808
+ __updateDropHere : function ( show , posX , posY ) {
1809
1809
const boxWidth = 120 ;
1810
1810
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 ( {
1813
1813
font : "workbench-start-hint" ,
1814
1814
textColor : "workbench-start-hint"
1815
1815
} ) ;
1816
1816
dropHereNodeUI . exclude ( ) ;
1817
1817
this . __workbenchLayout . add ( dropHereNodeUI ) ;
1818
1818
dropHereNodeUI . rect = this . __svgLayer . drawDashedRect ( boxWidth , boxHeight ) ;
1819
1819
}
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 ( {
1825
1825
left : posX - parseInt ( dropMeBounds . width / 2 ) - parseInt ( boxWidth / 2 ) ,
1826
1826
top : posY - parseInt ( dropMeBounds . height / 2 ) - parseInt ( boxHeight / 2 )
1827
1827
} ) ;
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 ) ;
1830
1830
}
1831
1831
} else {
1832
- this . __removeDropHint ( ) ;
1832
+ dropHere . exclude ( ) ;
1833
+ osparc . wrapper . Svg . removeItem ( dropHere . rect ) ;
1834
+ dropHere = null ;
1833
1835
}
1834
1836
} ,
1835
1837
@@ -2017,14 +2019,14 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
2017
2019
this . __draggingLink ( e , false ) ;
2018
2020
2019
2021
if ( this . __isDraggingLink && "dragData" in this . __isDraggingLink ) {
2022
+ const data = this . __isDraggingLink [ "dragData" ] ;
2023
+ this . __isDraggingLink = null ;
2020
2024
const pos = this . __pointerEventToWorkbenchPos ( e , false ) ;
2021
2025
const service = qx . data . marshal . Json . createModel ( osparc . service . Utils . getFilePicker ( ) ) ;
2022
2026
const nodeUI = await this . __addNode ( service , pos ) ;
2023
2027
if ( nodeUI ) {
2024
2028
const node = nodeUI . getNode ( ) ;
2025
- const data = this . __isDraggingLink [ "dragData" ] ;
2026
2029
osparc . file . FilePicker . setOutputValueFromStore ( node , data . getLocation ( ) , data . getDatasetId ( ) , data . getFileId ( ) , data . getLabel ( ) ) ;
2027
- this . __isDraggingLink = null ;
2028
2030
}
2029
2031
}
2030
2032
} ,
@@ -2047,11 +2049,5 @@ qx.Class.define("osparc.workbench.WorkbenchUI", {
2047
2049
} ) ;
2048
2050
}
2049
2051
} ,
2050
-
2051
- __removeDropHint : function ( ) {
2052
- this . __dropHereNodeUI . setVisibility ( "excluded" ) ;
2053
- osparc . wrapper . Svg . removeItem ( this . __dropHereNodeUI . rect ) ;
2054
- this . __dropHereNodeUI = null ;
2055
- }
2056
2052
}
2057
2053
} ) ;
0 commit comments