@@ -87,6 +87,11 @@ class DragDrop extends Base {
8787 * @member {Number} initialScrollTop=0
8888 */
8989 initialScrollTop : 0 ,
90+ /**
91+ * @member {Boolean} isWindowDragging=false
92+ * @protected
93+ */
94+ isWindowDragging : false ,
9095 /**
9196 * @member {Boolean} moveHorizontal=true
9297 */
@@ -103,6 +108,11 @@ class DragDrop extends Base {
103108 * @member {Number} offsetY=0
104109 */
105110 offsetY : 0 ,
111+ /**
112+ * @member {String|null} popupName=null
113+ * @protected
114+ */
115+ popupName : null ,
106116 /**
107117 * Remote method access for other workers
108118 * @member {Object} remote
@@ -112,7 +122,8 @@ class DragDrop extends Base {
112122 app : [
113123 'requestWindowManagementPermission' ,
114124 'setConfigs' ,
115- 'setDragProxyElement'
125+ 'setDragProxyElement' ,
126+ 'startWindowDrag'
116127 ]
117128 } ,
118129 /**
@@ -247,24 +258,50 @@ class DragDrop extends Base {
247258 dropZoneIdentifier : null ,
248259 initialScrollLeft : 0 ,
249260 initialScrollTop : 0 ,
261+ isWindowDragging : false ,
250262 moveHorizontal : true ,
251263 moveVertical : true ,
264+ popupHeight : null ,
265+ popupName : null ,
266+ popupWidth : null ,
252267 scrollContainerElement : null ,
253268 scrollContainerRect : null ,
254269 setScrollFactorLeft : 1 ,
255- scrollFactorTop : 1
270+ scrollFactorTop : 1 ,
271+ windowName : null
256272 } )
257273 }
258274
259275 /**
260276 * @param {Event } event
261277 */
262278 onDragMove ( event ) {
263- let me = this ,
264- proxyRect = me . dragProxyRect ,
265- rect = me . boundaryContainerRect ,
279+ let me = this ,
280+ { originalEvent} = event . detail ,
281+ proxyRect = me . dragProxyRect ,
282+ rect = me . boundaryContainerRect ,
266283 data , left , top ;
267284
285+ if ( me . isWindowDragging ) {
286+ const
287+ x = originalEvent . screenX - ( me . offsetX || 0 ) ,
288+ y = originalEvent . screenY - ( me . offsetY || 0 ) ;
289+
290+ Neo . Main . windowMoveTo ( { windowName : me . popupName , x, y} ) ;
291+
292+ DomEvents . sendMessageToApp ( {
293+ ...me . getEventData ( event ) ,
294+ offsetX : me . offsetX ,
295+ offsetY : me . offsetY ,
296+ proxyRect : new DOMRect ( x , y , me . popupWidth , me . popupHeight ) ,
297+ screenX : originalEvent . screenX ,
298+ screenY : originalEvent . screenY ,
299+ type : 'drag:move'
300+ } ) ;
301+
302+ return
303+ }
304+
268305 if ( me . scrollContainerElement ) {
269306 data = me . scrollContainer ( {
270307 clientX : event . detail . clientX ,
@@ -542,6 +579,16 @@ class DragDrop extends Base {
542579 setDragProxyElement ( data ) {
543580 this . dragProxyElement = document . getElementById ( data . id )
544581 }
582+
583+ /**
584+ * @param {Object } data
585+ * @param {String } data.popupHeight
586+ * @param {String } data.popupName
587+ * @param {String } data.popupWidth
588+ */
589+ startWindowDrag ( { popupHeight, popupName, popupWidth} ) {
590+ Object . assign ( this , { isWindowDragging : true , popupHeight, popupName, popupWidth} )
591+ }
545592}
546593
547594export default Neo . setupClass ( DragDrop ) ;
0 commit comments