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/08/23 14:32:29 UTC

[royale-asjs] 01/03: Starting DragManagerImpl

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

commit 82ee0bd37a361beedb254e89aa68116c9a701a30
Author: Yishay Weiss <yi...@hotmail.com>
AuthorDate: Tue Aug 23 16:13:31 2022 +0300

    Starting DragManagerImpl
---
 .../MXRoyale/src/main/resources/defaults.css       |   1 +
 .../src/main/royale/mx/core/Application.as         |   2 +
 .../src/main/royale/mx/managers/DragManager.as     |  26 +
 .../src/main/royale/MXRoyaleBaseClasses.as         |   1 +
 .../src/main/royale/mx/managers/DragManagerImpl.as | 558 +++++++++++++++++++++
 .../src/main/royale/mx/managers/IDragManager.as    |  54 ++
 .../SparkRoyale/src/main/resources/defaults.css    |   1 +
 .../main/royale/spark/components/Application.as    |   2 +
 8 files changed, 645 insertions(+)

diff --git a/frameworks/projects/MXRoyale/src/main/resources/defaults.css b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
index 8aafb41356..a20ec45870 100644
--- a/frameworks/projects/MXRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/MXRoyale/src/main/resources/defaults.css
@@ -117,6 +117,7 @@ Application
 {
 	IBeadLayout: ClassReference("mx.containers.beads.ApplicationLayout");
 	ICursorManager: ClassReference("mx.managers.CursorManagerImpl");
+	IDragManager: ClassReference("mx.managers.DragManagerImpl");
 }
 
 AdvancedDataGrid
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
index 4ff24f7c06..7358db821c 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
@@ -66,6 +66,7 @@ import mx.managers.FocusManager;
 import mx.managers.ISystemManager;
 import mx.events.FlexEvent;
 import mx.managers.ICursorManager;
+import mx.managers.IDragManager;
 
 
 COMPILE::JS {
@@ -319,6 +320,7 @@ public class Application extends Container implements IStrand, IParent, IEventDi
 		addBead(new ContainerDataBinding()); // ApplicationDataBinding fires too soon
         addBead(new ClassAliasBead());
         loadBeadFromValuesManager(ICursorManager, "iCursorManager", FlexGlobals.topLevelApplication as IStrand);
+        loadBeadFromValuesManager(IDragManager, "iDragManager", FlexGlobals.topLevelApplication as IStrand);
 
         instanceParent = this;
         
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/DragManager.as b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/DragManager.as
index 8a944b6527..67c7266ef4 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/DragManager.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/DragManager.as
@@ -27,6 +27,8 @@ package mx.managers
 import mx.core.DragSource;
 import mx.core.IFlexDisplayObject;
 import mx.core.IUIComponent;
+import mx.core.FlexGlobals;
+import org.apache.royale.core.IStrand;
 //import mx.core.Singleton;
 import mx.core.mx_internal;
 //import mx.managers.dragClasses.DragProxy;
@@ -120,7 +122,31 @@ public class DragManager
     public static const LINK:String = "link";
     
    
+    /**
+     *  @private
+     *  Storage for the impl getter.
+     *  This gets initialized on first access,
+     *  not at static initialization time, in order to ensure
+     *  that the Singleton registry has already been initialized.
+     */
+    private static var _impl:IDragManager;
+    
+    /**
+     *  @private
+     *  The singleton instance of DragManagerImpl which was
+     *  registered as implementing the IDragManager interface.
+     */
+     private static function get impl():IDragManager
+    {
+        if (!_impl)
+        {
+            // _impl = IDragManager(
+            //     getInstance("mx.managers::IDragManager"));
+            _impl = (FlexGlobals.topLevelApplication as IStrand).getBeadByType(IDragManager) as IDragManager;
+        }
 
+        return _impl;
+    } 
     //--------------------------------------------------------------------------
     //
     //  Class properties
diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as b/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
index 76ba29d144..a78f4ef767 100644
--- a/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/MXRoyaleBaseClasses.as
@@ -172,6 +172,7 @@ internal class MXRoyaleBaseClasses
 	import mx.managers.CursorManager;CursorManager;
 	import mx.managers.CursorManagerPriority;CursorManagerPriority;
 	import mx.managers.ICursorManager;ICursorManager;
+	import mx.managers.IDragManager;IDragManager;
 	import mx.managers.ISystemManager;ISystemManager;
 	import mx.managers.SystemManagerGlobals;SystemManagerGlobals;
 
diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as
new file mode 100644
index 0000000000..7a4986c426
--- /dev/null
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/DragManagerImpl.as
@@ -0,0 +1,558 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.managers
+{
+
+import org.apache.royale.events.EventDispatcher;
+import org.apache.royale.events.IEventDispatcher;
+import org.apache.royale.core.IStrand;
+
+
+import mx.core.DragSource;
+import mx.core.IFlexDisplayObject;
+import mx.core.IFlexModule;
+import mx.core.IFlexModuleFactory;
+import mx.core.IUIComponent;
+import mx.core.LayoutDirection;
+import mx.core.UIComponentGlobals;
+import mx.core.mx_internal;
+// import mx.events.DragEvent;
+import mx.styles.CSSStyleDeclaration;
+import mx.styles.IStyleManager2;
+import mx.styles.StyleManager;
+import org.apache.royale.core.IBead;
+import org.apache.royale.html.beads.controllers.DragMouseController;
+import org.apache.royale.html.beads.DragDropListView;
+import org.apache.royale.events.DragEvent;
+import org.apache.royale.html.beads.controllers.DropMouseController;
+import org.apache.royale.html.accessories.RestrictTextInputBead;
+
+// use namespace mx_internal;
+
+// [ExcludeClass]
+
+/**
+ *  @private
+ */
+public class DragManagerImpl extends EventDispatcher implements IDragManager, IBead
+{
+//     include "../core/Version.as";
+
+	//--------------------------------------------------------------------------
+	//
+	//  Class variables
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	private static var sm:ISystemManager;
+
+	/**
+	 *  @private
+	 */
+	private static var instance:IDragManager;
+
+	/**
+	 * @private
+	 * 
+	 * Place to hook in additional classes
+	 */
+	public static var mixins:Array;
+
+	//--------------------------------------------------------------------------
+	//
+	//  Class methods
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	public static function getInstance():IDragManager
+	{
+		if (!instance)
+		instance = new DragManagerImpl();
+
+		return instance;
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Constructor
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	public function DragManagerImpl()
+	{
+		super();
+
+		if (instance)
+			throw new Error("Instance already exists.");
+			
+		if (mixins)
+		{
+			var n:int = mixins.length;
+			for (var i:int = 0; i < n; i++)
+			{
+				new mixins[i](this);
+			}
+		}
+
+		// sandboxRoot = sm.getSandboxRoot();
+
+		// if (sm.isTopLevelRoot())
+		// {
+		// 	sm.addEventListener(MouseEvent.MOUSE_DOWN, sm_mouseDownHandler, false, 0, true);
+		// 	sm.addEventListener(MouseEvent.MOUSE_UP, sm_mouseUpHandler, false, 0, true);
+		// }
+
+        if (hasEventListener("initialize"))
+		    dispatchEvent(new Event("initialize"));
+
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Variables
+	//
+	//--------------------------------------------------------------------------
+	
+
+	/**
+	 *  @private
+	 *  The highest place we can listen for events in our DOM
+	 */
+	private var sandboxRoot:IEventDispatcher;
+
+	/**
+	 *  @private
+	 *  Object that initiated the drag.
+	 */
+	private var dragInitiator:IUIComponent;
+
+	/**
+	 *  @private
+	 *  Object being dragged around.
+	 */
+	public var dragProxy:DragProxy;
+
+	/**
+	 *  @private
+	 */
+	public var bDoingDrag:Boolean = false;
+
+	/**
+	 *  @private
+	 */
+	private var mouseIsDown:Boolean = false;
+
+	//--------------------------------------------------------------------------
+	//
+	//  Properties
+	//
+	//--------------------------------------------------------------------------
+	
+	/**
+	 *  Read-only property that returns <code>true</code>
+	 *  if a drag is in progress.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function get isDragging():Boolean
+	{
+		return bDoingDrag;
+	}
+	
+	//--------------------------------------------------------------------------
+	//
+	//  Methods
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Initiates a drag and drop operation.
+	 *
+	 *  @param dragInitiator IUIComponent that specifies the component initiating
+	 *  the drag.
+	 *
+	 *  @param dragSource DragSource object that contains the data
+	 *  being dragged.
+	 *
+	 *  @param mouseEvent The MouseEvent that contains the mouse information
+	 *  for the start of the drag.
+	 *
+	 *  @param dragImage The image to drag. This argument is optional.
+	 *  If omitted, a standard drag rectangle is used during the drag and
+	 *  drop operation. If you specify an image, you must explicitly set a 
+	 *  height and width of the image or else it will not appear.
+	 *
+	 *  @param xOffset Number that specifies the x offset, in pixels, for the
+	 *  <code>dragImage</code>. This argument is optional. If omitted, the drag proxy
+	 *  is shown at the upper-left corner of the drag initiator. The offset is expressed
+	 *  in pixels from the left edge of the drag proxy to the left edge of the drag
+	 *  initiator, and is usually a negative number.
+	 *
+	 *  @param yOffset Number that specifies the y offset, in pixels, for the
+	 *  <code>dragImage</code>. This argument is optional. If omitted, the drag proxy
+	 *  is shown at the upper-left corner of the drag initiator. The offset is expressed
+	 *  in pixels from the top edge of the drag proxy to the top edge of the drag
+	 *  initiator, and is usually a negative number.
+	 *
+	 *  @param imageAlpha Number that specifies the alpha value used for the
+	 *  drag image. This argument is optional. If omitted, the default alpha
+	 *  value is 0.5. A value of 0.0 indicates that the image is transparent;
+	 *  a value of 1.0 indicates it is fully opaque. 
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function doDrag(
+			dragInitiator:IUIComponent, 
+			dragSource:DragSource, 
+			mouseEvent:MouseEvent,
+			dragImage:IFlexDisplayObject = null, // instance of dragged item(s)
+			xOffset:Number = 0,
+			yOffset:Number = 0,
+			imageAlpha:Number = 0.5,
+			allowMove:Boolean = true):void
+	{
+	// 	var proxyWidth:Number;
+	// 	var proxyHeight:Number;
+		
+	// 	// Can't start a new drag if we're already in the middle of one...
+	// 	if (bDoingDrag)
+	// 		return;
+		
+	// 	// Can't do a drag if the mouse isn't down
+	// 	if (!(mouseEvent.type == MouseEvent.MOUSE_DOWN ||
+	// 		  mouseEvent.type == MouseEvent.CLICK ||
+	// 		  mouseIsDown ||
+	// 		  mouseEvent.buttonDown))
+	// 	{
+	// 		return;
+	// 	}    
+			
+	// 	bDoingDrag = true;
+
+        if (hasEventListener("doDrag"))
+    		dispatchEvent(new Event("doDrag"));
+
+	// 	this.dragInitiator = dragInitiator;
+
+	// 	// The drag proxy is a UIComponent with a single child -
+	// 	// an instance of the dragImage.
+	// 	dragProxy = new DragProxy(dragInitiator, dragSource);
+
+        // var e:Event; 
+        // if (hasEventListener("popUpChildren"))
+        //     e = new DragEvent("popUpChildren", false, true, dragProxy);
+        // if (!e || dispatchEvent(e))	
+	// 		sm.popUpChildren.addChild(dragProxy);	
+
+	// 	if (!dragImage)
+	// 	{
+	// 		// No drag image specified, use default
+	// 		var dragManagerStyleDeclaration:CSSStyleDeclaration =
+        //         getStyleManager(dragInitiator).getMergedStyleDeclaration("mx.managers.DragManager");
+	// 		var dragImageClass:Class =
+	// 			dragManagerStyleDeclaration.getStyle("defaultDragImageSkin");
+	// 		dragImage = new dragImageClass();
+	// 		dragProxy.addChild(DisplayObject(dragImage));
+	// 		proxyWidth = dragInitiator.width;
+	// 		proxyHeight = dragInitiator.height;
+	// 	}
+	// 	else
+	// 	{
+	// 		dragProxy.addChild(DisplayObject(dragImage));
+	// 		if (dragImage is ILayoutManagerClient )
+	// 			UIComponentGlobals.layoutManager.validateClient(ILayoutManagerClient (dragImage), true);
+	// 		if (dragImage is IUIComponent)
+	// 		{
+	// 			proxyWidth = (dragImage as IUIComponent).getExplicitOrMeasuredWidth();
+	// 			proxyHeight = (dragImage as IUIComponent).getExplicitOrMeasuredHeight();
+	// 		}
+	// 		else
+	// 		{
+	// 			proxyWidth = dragImage.measuredWidth;
+	// 			proxyHeight = dragImage.measuredHeight;
+	// 		}
+	// 	}
+
+        // // Set the layoutDirection of the dragProxy and dragImage to match the dragInitiator
+        // // to ensure that they will be in the right position and orientation.
+        // if (dragInitiator is ILayoutDirectionElement &&
+        //     ILayoutDirectionElement(dragInitiator).layoutDirection == LayoutDirection.RTL)
+        //     dragProxy.layoutDirection = LayoutDirection.RTL;
+        
+	// 	dragImage.setActualSize(proxyWidth, proxyHeight);
+	// 	dragProxy.setActualSize(proxyWidth, proxyHeight);
+		
+	// 	// Alpha
+	// 	dragProxy.alpha = imageAlpha;
+
+	// 	dragProxy.allowMove = allowMove;
+		
+        // // Make sure any scale/rotation from the initiator will be reflected.
+        // var concatenatedMatrix:Matrix = 
+        //     MatrixUtil.getConcatenatedMatrix(DisplayObject(dragInitiator), 
+        //                                      DisplayObject(sandboxRoot));
+        
+        // // Zero out the translation part of the matrix, as we're going to 
+        // // position the dragProxy explicitly further below.        
+        // concatenatedMatrix.tx = 0;
+        // concatenatedMatrix.ty = 0;
+        // // Combine with the matrix of the dragImage if it has any.
+        // var m:Matrix = dragImage.transform.matrix;
+        // if (m)
+        // {
+        //     concatenatedMatrix.concat(dragImage.transform.matrix);
+        //     dragImage.transform.matrix = concatenatedMatrix;
+        // }
+        
+        // // Find mouse coordinates in global space
+        // var nonNullTarget:Object = mouseEvent.target;
+	// 	if (nonNullTarget == null)
+	// 		nonNullTarget = dragInitiator;
+		
+	// 	var point:Point = new Point(mouseEvent.localX, mouseEvent.localY);
+	// 	point = DisplayObject(nonNullTarget).localToGlobal(point);
+	// 	point = DisplayObject(sandboxRoot).globalToLocal(point);
+	// 	var mouseX:Number = point.x;
+	// 	var mouseY:Number = point.y;
+
+        // // Find the proxy origin in global space
+        // var proxyOrigin:Point = DisplayObject(dragInitiator).localToGlobal(new Point(-xOffset, -yOffset));
+        // proxyOrigin = DisplayObject(sandboxRoot).globalToLocal(proxyOrigin);
+        
+        // // Set dragProxy.offset to the mouse offset within the drag proxy.
+        // dragProxy.xOffset = mouseX - proxyOrigin.x;
+        // dragProxy.yOffset = mouseY - proxyOrigin.y;
+                
+        // // Setup the initial position of the drag proxy.
+        // dragProxy.x = proxyOrigin.x;
+        // dragProxy.y = proxyOrigin.y;
+		
+	// 	// Remember the starting location of the drag proxy so it can be
+	// 	// "snapped" back if the drop was refused.
+	// 	dragProxy.startX = dragProxy.x;
+	// 	dragProxy.startY = dragProxy.y;
+
+	// 	// Turn on caching.
+	// 	if (dragImage is DisplayObject) 
+	// 		DisplayObject(dragImage).cacheAsBitmap = true;
+			
+
+	// 	var delegate:Object = dragProxy.automationDelegate;
+	// 	if (delegate)
+	// 		delegate.recordAutomatableDragStart(dragInitiator, mouseEvent);
+		
+		var dragController:DragMouseController = (dragInitiator as IStrand).getBeadByType(DragMouseController) as DragMouseController;
+		if (!dragController)
+		{
+			dragController = new DragMouseController();
+		}
+		(dragInitiator as IStrand).addBead(dragController);
+		dragController.addEventListener("dragMove", dragMoveHandler)
+	}
+
+	private function dragMoveHandler(event:DragEvent):void
+	{
+		var relatedObject:IEventDispatcher = event.relatedObject as IEventDispatcher;
+		if (!relatedObject)
+		{
+			return;
+		}
+		if (relatedObject.hasEventListener(DragEvent.DRAG_ENTER) || relatedObject.hasEventListener(DragEvent.DRAG_EXIT) || relatedObject.hasEventListener(DragEvent.DRAG_OVER) || relatedObject.hasEventListener(DragEvent.DRAG_DROP))
+		{
+			var relatedStrand:IStrand = relatedObject as IStrand;
+			var dropController:DropMouseController = relatedStrand.getBeadByType(DropMouseController) as DropMouseController;
+			if (!dropController)
+			{
+				dropController = new DropMouseController();
+				relatedStrand.addBead(dropController);
+			}
+		}
+	}
+	
+	/**
+	 *  Call this method from your <code>dragEnter</code> event handler if you accept
+	 *  the drag/drop data.
+	 *  For example: 
+	 *
+	 *  <pre>DragManager.acceptDragDrop(event.target);</pre>
+	 *
+	 *	@param target The drop target accepting the drag.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function acceptDragDrop(target:IUIComponent):void
+	{
+		// trace("-->acceptDragDrop for DragManagerImpl", sm, target);
+
+		if (dragProxy)
+			dragProxy.target = target as DisplayObject;
+
+        if (hasEventListener("acceptDragDrop"))
+    		dispatchEvent(new Request("acceptDragDrop", false, false, target));
+
+	}
+	
+	/**
+	 *  Sets the feedback indicator for the drag and drop operation.
+	 *  Possible values are <code>DragManager.COPY</code>, <code>DragManager.MOVE</code>,
+	 *  <code>DragManager.LINK</code>, or <code>DragManager.NONE</code>.
+	 *
+	 *  @param feedback The type of feedback indicator to display.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function showFeedback(feedback:String):void
+	{
+		// trace("-->showFeedback for DragManagerImpl", sm, feedback);
+		if (dragProxy)
+		{
+			if (feedback == DragManager.MOVE && !dragProxy.allowMove)
+				feedback = DragManager.COPY;
+
+			dragProxy.action = feedback;
+		}
+
+        if (hasEventListener("showFeedback"))
+    		dispatchEvent(new Request("showFeedback", false, false, feedback));
+
+	}
+	
+	/**
+	 *  Returns the current drag and drop feedback.
+	 *
+	 *  @return  Possible return values are <code>DragManager.COPY</code>, 
+	 *  <code>DragManager.MOVE</code>,
+	 *  <code>DragManager.LINK</code>, or <code>DragManager.NONE</code>.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function getFeedback():String
+	{
+        if (hasEventListener("getFeedback"))
+        {
+		    var request:Request = new Request("getFeedback", false, true);
+		    if (!dispatchEvent(request))
+		    {
+			    return request.value as String;
+		    }
+        }
+
+		// trace("<--getFeedback for DragManagerImpl", sm);
+		return dragProxy ? dragProxy.action : DragManager.NONE;
+	}
+	
+	/**
+	 *  @private
+	 */
+	public function endDrag():void
+	{
+        var e:Event;
+        if (hasEventListener("endDrag"))
+        {
+            e = new Event("endDrag", false, true);
+        }
+        
+		if (!e || dispatchEvent(e))
+		{
+			if (dragProxy)
+			{
+				sm.popUpChildren.removeChild(dragProxy);	
+				
+                if (dragProxy.numChildren > 0)
+				    dragProxy.removeChildAt(0);	// The drag image is the only child
+				dragProxy = null;
+			}
+		}
+
+		dragInitiator = null;
+		bDoingDrag = false;
+
+	}
+
+    /**
+     *  @private
+     */
+    static private function getStyleManager(dragInitiator:IUIComponent):IStyleManager2
+    {
+        // If the dragInitiator has a styleManager, use that one.
+        // In a situation where a main application that loads a module with drag initiator,
+        // the main application may not link in the DragManager and appropriate styles.
+        // We want to use the styles of the module of the dragInitiator. See SDK-24324.
+        if (dragInitiator is IFlexModule)
+            return StyleManager.getStyleManager(IFlexModule(dragInitiator).moduleFactory);
+        
+        return StyleManager.getStyleManager(sm as IFlexModuleFactory);
+    }
+
+	//--------------------------------------------------------------------------
+	//
+	//  Event handlers
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 */
+	private function sm_mouseDownHandler(event:MouseEvent):void
+	{
+		mouseIsDown = true;
+	}
+	
+	/**
+	 *  @private
+	 */
+	private function sm_mouseUpHandler(event:MouseEvent):void
+	{
+		mouseIsDown = false;
+	}
+
+	private var _strand:IStrand;
+	public function set strand(value:IStrand):void
+	{
+		_strand = value;
+	}
+
+}
+
+}
diff --git a/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/IDragManager.as b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/IDragManager.as
new file mode 100644
index 0000000000..0408ad1016
--- /dev/null
+++ b/frameworks/projects/MXRoyaleBase/src/main/royale/mx/managers/IDragManager.as
@@ -0,0 +1,54 @@
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.managers
+{
+
+import flash.events.MouseEvent;
+
+import mx.core.DragSource;
+import mx.core.IFlexDisplayObject;
+import mx.core.IUIComponent;
+
+// [ExcludeClass]
+
+/**
+ *  @private
+ */
+public interface IDragManager
+{
+	function get isDragging():Boolean;
+	function doDrag(
+			dragInitiator:IUIComponent, 
+			dragSource:DragSource,
+			mouseEvent:MouseEvent,
+			dragImage:IFlexDisplayObject = null, // instance of dragged item(s)
+			xOffset:Number = 0,
+			yOffset:Number = 0,
+			imageAlpha:Number = 0.5,
+			allowMove:Boolean = true):void;
+	function acceptDragDrop(target:IUIComponent):void;
+	function showFeedback(feedback:String):void;
+	function getFeedback():String;
+	function endDrag():void;
+}
+
+}
+
diff --git a/frameworks/projects/SparkRoyale/src/main/resources/defaults.css b/frameworks/projects/SparkRoyale/src/main/resources/defaults.css
index fbcfa460e9..573fe910b5 100644
--- a/frameworks/projects/SparkRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/SparkRoyale/src/main/resources/defaults.css
@@ -38,6 +38,7 @@ global {
 Application
 {
 	ICursorManager: ClassReference("mx.managers.CursorManagerImpl");
+	IDragManager: ClassReference("mx.managers.DragManagerImpl");
 }
 
 Button
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Application.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Application.as
index 8ebc58cad6..fb02078b07 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Application.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Application.as
@@ -67,6 +67,7 @@ import mx.core.IUIComponent;
 import mx.events.utils.MouseEventConverter;
 import mx.managers.ISystemManager;
 import mx.managers.ICursorManager;
+import mx.managers.IDragManager;
 
 COMPILE::JS {
     import org.apache.royale.core.ElementWrapper;
@@ -333,6 +334,7 @@ public class Application extends SkinnableContainer implements IStrand, IParent,
             ElementWrapper.converterMap["MouseEvent"] = MouseEventConverter.convert;
         }
         loadBeadFromValuesManager(ICursorManager, "iCursorManager", FlexGlobals.topLevelApplication as IStrand);
+        loadBeadFromValuesManager(IDragManager, "iDragManager", FlexGlobals.topLevelApplication as IStrand);
     }