You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2022/09/12 10:33:37 UTC

[royale-asjs] branch develop updated: Emulation - basic DG drag support

This is an automated email from the ASF dual-hosted git repository.

yishayw pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 256b994a0c Emulation - basic DG drag support
256b994a0c is described below

commit 256b994a0cdb92ff2866e0a5342642082b543c50
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Mon Sep 12 13:33:30 2022 +0300

    Emulation - basic DG drag support
---
 .../src/main/royale/mx/controls/DataGrid.as        | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DataGrid.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DataGrid.as
index ff4c240a2c..b0f60702fa 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DataGrid.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DataGrid.as
@@ -111,6 +111,13 @@ import org.apache.royale.core.IDataGridModel;
 import org.apache.royale.html.beads.IDataGridView;
 import org.apache.royale.core.IDataGridPresentationModel;
 import org.apache.royale.core.ValuesManager;
+import org.apache.royale.html.beads.DataGridDrawingLayerBead;
+import mx.controls.beads.SingleSelectionDropTargetBead;
+import org.apache.royale.html.beads.SingleSelectionDropIndicatorBead;
+import mx.controls.beads.SingleSelectionDragSourceBead;
+import org.apache.royale.utils.getOrAddBeadByType;
+import org.apache.royale.core.DropType;
+import org.apache.royale.html.beads.SingleSelectionDragImageBead;
 
 //--------------------------------------
 //  Events
@@ -1412,6 +1419,33 @@ public class DataGrid extends DataGridListBase/*ListBase*/ implements IDataGrid/
     override protected function getHorizontalScrollElement():HTMLElement{
         return view is IDataGridView && IDataGridView(view).listArea ? IDataGridView(view).listArea.element : null;
     }
+    /**
+     *  @private
+     */
+    override protected function setDropEnabled():void
+    {
+        getOrAddBeadByType(DataGridDrawingLayerBead, this);
+        getOrAddBeadByType(SingleSelectionDropTargetBead, this);
+        getOrAddBeadByType(SingleSelectionDropIndicatorBead, this);
+    }
+
+    /**
+     *  @private
+     */
+    override protected function setDragMoveEnabled():void
+    {
+        var dragSourceBead:SingleSelectionDragSourceBead = getOrAddBeadByType(SingleSelectionDragSourceBead, this) as SingleSelectionDragSourceBead;
+        dragSourceBead.dragType = dragMoveEnabled ? DropType.MOVE : DropType.COPY;
+    }
+
+    /**
+     *  @private
+     */
+    override protected function setDragEnabled():void
+    {
+        getOrAddBeadByType(SingleSelectionDragSourceBead, this);
+        getOrAddBeadByType(SingleSelectionDragImageBead, this);
+    }
 }
 
 }