flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Updates to DragDrop that makes it work for SWF and JS platforms.
Date Tue, 18 Jul 2017 19:17:52 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 887d7c447 -> d19b4f4ab


Updates to DragDrop that makes it work for SWF and JS platforms.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/d19b4f4a
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/d19b4f4a
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/d19b4f4a

Branch: refs/heads/develop
Commit: d19b4f4ab0d0c73d170cd6b78441df4b07320aaa
Parents: 887d7c4
Author: Peter Ent <pent@apache.org>
Authored: Tue Jul 18 15:17:50 2017 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Tue Jul 18 15:17:50 2017 -0400

----------------------------------------------------------------------
 .../DragDrop/src/main/flex/DragDropClasses.as   |   1 +
 .../flex/org/apache/flex/events/DragEvent.as    |  96 +++++++++-----
 .../org/apache/flex/events/DragEventBase.as     |   1 +
 .../html/beads/SingleSelectionDragImageBead.as  | 131 +++++++++++++++++++
 .../html/beads/SingleSelectionDragSourceBead.as |  41 +++---
 .../html/beads/SingleSelectionDropTargetBead.as |  14 +-
 .../beads/controllers/DragMouseController.as    |  29 ++--
 .../beads/controllers/DropMouseController.as    |  43 +++---
 .../src/main/resources/basic-manifest.xml       |   1 +
 9 files changed, 251 insertions(+), 106 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d19b4f4a/frameworks/projects/DragDrop/src/main/flex/DragDropClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/src/main/flex/DragDropClasses.as b/frameworks/projects/DragDrop/src/main/flex/DragDropClasses.as
index 866c39e..440b540 100644
--- a/frameworks/projects/DragDrop/src/main/flex/DragDropClasses.as
+++ b/frameworks/projects/DragDrop/src/main/flex/DragDropClasses.as
@@ -30,6 +30,7 @@ internal class DragDropClasses
     import org.apache.flex.core.DropType; DropType;
     import org.apache.flex.events.DragEvent; DragEvent;   
 	
+	import org.apache.flex.html.beads.SingleSelectionDragImageBead; SingleSelectionDragImageBead;
 	import org.apache.flex.html.beads.SingleSelectionDragSourceBead; SingleSelectionDragSourceBead;
 	import org.apache.flex.html.beads.SingleSelectionDropTargetBead; SingleSelectionDropTargetBead;
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d19b4f4a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEvent.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEvent.as
b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEvent.as
index 9ed81df..cb161c0 100644
--- a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEvent.as
+++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEvent.as
@@ -24,6 +24,7 @@ package org.apache.flex.events
     COMPILE::JS
     {
         import org.apache.flex.core.IUIBase;
+		import org.apache.flex.core.IStrand;
         import window.Event;
         import window.MouseEvent;
         import org.apache.flex.events.utils.EventUtils;
@@ -261,27 +262,50 @@ package org.apache.flex.events
         public static var dragSource:Object;
 		
 		COMPILE::SWF {
-		private var _clientX:Number;
-		override public function set clientX(value:Number):void
-		{
-			super.clientX = value;
-			_clientX = value;
-		}
-		override public function get clientX():Number
-		{
-			return _clientX;
-		}
-        
-		private var _clientY:Number;
-		override public function set clientY(value:Number):void
-		{
-			super.clientY = value;
-			_clientY = value;
-		}
-		override public function get clientY():Number
-		{
-			return _clientY;
+			private var _clientX:Number;
+			
+			/**
+			 * @private
+			 */
+			override public function set clientX(value:Number):void
+			{
+				super.clientX = value;
+				_clientX = value;
+			}
+			override public function get clientX():Number
+			{
+				return _clientX;
+			}
+	        
+			private var _clientY:Number;
+			
+			/**
+			 * @private
+			 */
+			override public function set clientY(value:Number):void
+			{
+				super.clientY = value;
+				_clientY = value;
+			}
+			override public function get clientY():Number
+			{
+				return _clientY;
+			}
 		}
+		COMPILE::JS {
+			private var _relatedObject:Object;
+			
+			/**
+			 * @private
+			 */
+			public function get relatedObject():Object
+			{
+				return _relatedObject;
+			}
+			public function set relatedObject(value:Object):void
+			{
+				_relatedObject = value;
+			}
 		}
 
         /**
@@ -347,13 +371,18 @@ package org.apache.flex.events
             }
             COMPILE::JS
             {
-                var e:window.Event = event as window.Event;
-                var out:window.MouseEvent = EventUtils.createMouseEvent(type, true, true,
{
-                        view: e.view, detail: e.detail, screenX: e.screenX, screenY: e.screenY,
-                        clientX: e.clientX, clientY: e.clientY, ctrlKey: e.ctrlKey, altKey:
e.altKey,
-                        shiftKey: e.shiftKey, metaKey: e.metaKey, button: e.button, relatedTarget:
e.relatedTarget});
+				var de:DragEvent = new DragEvent(type, true, true);
 
-                return out as DragEvent;
+				de.altKey = event.altKey;
+				de.ctrlKey = event.ctrlKey;
+				de.shiftKey = event.shiftKey;
+				
+				var localPoint:Point = new Point(event.screenX, event.screenY);
+				var clientPoint:Point = PointUtils.localToGlobal(localPoint, event.target);
+				de.clientX = clientPoint.x;
+				de.clientY = clientPoint.y;
+				
+				return de;
             }
         }
         
@@ -380,8 +409,16 @@ package org.apache.flex.events
             }
             COMPILE::JS
             {
-               // ((target as IUIBase).element as IEventDispatcher).dispatchEvent(event as
window.Event);
-				(target as IEventDispatcher).dispatchEvent(event as window.Event);
+				var pet:Object = target.getParentEventTarget();
+				if (!pet) {
+					var p:Object = target.parent;
+					while (p != null && !(p is IStrand)) {
+						p = p.parent;
+					}
+					target.setParentEventTarget(p);
+				}
+				
+				(target as IEventDispatcher).dispatchEvent(event);
             }
         }
 
@@ -389,9 +426,6 @@ package org.apache.flex.events
          */
         private static function installDragEventMixin():Boolean 
         {
-            var o:Object = org.apache.flex.events.ElementEvents.elementEvents;
-            o['dragEnd'] = 1;
-            o['dragMove'] = 1;
             return true;
         }
         

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d19b4f4a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEventBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEventBase.as
b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEventBase.as
index f70b7c6..fc637ef 100644
--- a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEventBase.as
+++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/events/DragEventBase.as
@@ -47,5 +47,6 @@ package org.apache.flex.events
     COMPILE::JS
     public class DragEventBase extends goog.events.BrowserEvent
     {
+		public var bubbles:Boolean;
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d19b4f4a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDragImageBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDragImageBead.as
b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDragImageBead.as
new file mode 100644
index 0000000..6fb10c9
--- /dev/null
+++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDragImageBead.as
@@ -0,0 +1,131 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.flex.html.beads
+{
+	import org.apache.flex.collections.ArrayList;
+	import org.apache.flex.core.IBead;
+	import org.apache.flex.core.IDataProviderModel;
+	import org.apache.flex.core.IDocument;
+	import org.apache.flex.core.IDragInitiator;
+	import org.apache.flex.core.IItemRenderer;
+	import org.apache.flex.core.IItemRendererParent;
+	import org.apache.flex.core.IParent;
+	import org.apache.flex.core.IStrand;
+	import org.apache.flex.core.UIBase;
+	import org.apache.flex.events.DragEvent;
+	import org.apache.flex.events.Event;
+	import org.apache.flex.events.EventDispatcher;
+	import org.apache.flex.events.IEventDispatcher;
+	import org.apache.flex.geom.Point;
+	import org.apache.flex.geom.Rectangle;
+	import org.apache.flex.html.Group;
+	import org.apache.flex.html.Label;
+	import org.apache.flex.html.beads.controllers.DragMouseController;
+	import org.apache.flex.html.supportClasses.DataItemRenderer;
+	import org.apache.flex.utils.PointUtils;
+	
+    
+	/**
+	 *  The SingleSelectionDragImageBead produces a UIBase component that represents
+	 *  the item being dragged. It does this by taking the data associcated with the
+	 *  index of the item selected and running the toString() function on it, placing
+	 *  it inside of a Label that is inside of Group (which is given the className of
+	 *  "DragImage").
+	 * 
+	 *  The createDragImage() function can be overridden and a different component returned.
+	 * 
+	 *  @see org.apache.flex.html.beads.SingleSelectionDropTargetBead.
+     *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class SingleSelectionDragImageBead extends EventDispatcher implements IBead
+	{
+		public function SingleSelectionDragImageBead()
+		{
+			super();
+		}
+		
+		private var _strand:IStrand;
+		
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			
+			IEventDispatcher(_strand).addEventListener(DragEvent.DRAG_START, handleDragStart);
+		}
+		
+		public function get strand():IStrand
+		{
+			return _strand;
+		}
+		
+		/**
+		 * Creates an example/temporary component to be dragged and returns it.
+		 * 
+		 * @param ir DataItemRenderer The itemRenderer to be used as a template.
+		 * @return UIBase The "dragImage" to use.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		protected function createDragImage(ir:DataItemRenderer):UIBase
+		{
+			var dragImage:UIBase = new Group();
+			dragImage.className = "DragImage";
+			dragImage.width = (ir as UIBase).width;
+			dragImage.height = (ir as UIBase).height;
+			var label:Label = new Label();
+			if (ir.dataField != null) {
+				label.text = ir.data[ir.dataField].toString();
+			} else {
+				label.text = ir.data.toString();
+			}
+			
+			COMPILE::JS {
+				dragImage.element.style.position = 'absolute';
+				dragImage.element.style.cursor = 'pointer';
+			}
+				
+			dragImage.addElement(label);
+			
+			return dragImage;
+		}
+		
+		/**
+		 * @private
+		 */
+		private function handleDragStart(event:DragEvent):void
+		{
+			trace("SingleSelectionDragImageBead received the DragStart via: "+event.target.toString());
+
+			var startHere:Object = event.target;
+			
+			if (startHere is DataItemRenderer) {
+				var ir:DataItemRenderer = startHere as DataItemRenderer;
+				DragEvent.dragSource = ir.data;
+				DragMouseController.dragImage = createDragImage(ir);
+			}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d19b4f4a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDragSourceBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDragSourceBead.as
b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDragSourceBead.as
index 6701d80..5fd8e28 100644
--- a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDragSourceBead.as
+++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDragSourceBead.as
@@ -20,15 +20,16 @@ package org.apache.flex.html.beads
 {
 	import org.apache.flex.collections.ArrayList;
 	import org.apache.flex.core.IBead;
-	import org.apache.flex.core.IDragInitiator;
 	import org.apache.flex.core.IDataProviderModel;
 	import org.apache.flex.core.IDocument;
+	import org.apache.flex.core.IDragInitiator;
 	import org.apache.flex.core.IItemRenderer;
 	import org.apache.flex.core.IItemRendererParent;
 	import org.apache.flex.core.IParent;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.UIBase;
 	import org.apache.flex.events.DragEvent;
+	import org.apache.flex.events.Event;
 	import org.apache.flex.events.EventDispatcher;
 	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.geom.Point;
@@ -36,6 +37,7 @@ package org.apache.flex.html.beads
 	import org.apache.flex.html.Group;
 	import org.apache.flex.html.Label;
 	import org.apache.flex.html.beads.controllers.DragMouseController;
+	import org.apache.flex.html.supportClasses.DataItemRenderer;
 	import org.apache.flex.utils.PointUtils;
 	
     
@@ -44,6 +46,10 @@ package org.apache.flex.html.beads
 	 *  By adding this bead, a user can drag a row of the List to a new location within the
list. This bead
 	 *  should be used in conjunction with SingleSelectionDropTargetBead.
 	 * 
+	 *  This bead adds a new event to the strand, "dragImageNeeded", which is dispatched on
the strand
+	 *  just prior to the dragImage's appearance. An event listener can create its own dragImage
if the
+	 *  default, taken from the data item, is not suitable.
+	 * 
 	 *  @see org.apache.flex.html.beads.SingleSelectionDropTargetBead.
      *
 	 *  @langversion 3.0
@@ -100,43 +106,30 @@ package org.apache.flex.html.beads
 		private function handleDragStart(event:DragEvent):void
 		{
 			trace("SingleSelectionDragSourceBead received the DragStart");
+						
+			DragEvent.dragInitiator = this;
 			
-			if (DragMouseController.dragStartObject == null) return; // not interested in empty things
-			
-			var startHere:Object = DragMouseController.dragStartObject;
-			while( !(startHere is IItemRenderer) && startHere != null) {
+			var startHere:Object = event.target;
+			while( !(startHere is DataItemRenderer) && startHere != null) {
 				startHere = startHere.parent;
 			}
 			
-			if (startHere is IItemRenderer) {
-				var ir:IItemRenderer = startHere as IItemRenderer;
+			if (startHere is DataItemRenderer) {
+				var ir:DataItemRenderer = startHere as DataItemRenderer;
 				
 				var p:UIBase = (ir as UIBase).parent as UIBase;
 				indexOfDragSource = p.getElementIndex(ir);
 				
-				var dragImage:UIBase = new Group();
-				dragImage.className = "DragImage";
-				dragImage.width = (ir as UIBase).width;
-				dragImage.height = (ir as UIBase).height;
-				var label:Label = new Label();
-				label.text = ir.data.toString();
-				COMPILE::JS {
-					dragImage.element.style.position = 'absolute';
-					dragImage.element.style.cursor = 'pointer';
-				}
-				dragImage.addElement(label);
-				
-				DragEvent.dragSource = ir.data;
-				DragEvent.dragInitiator = this;
-				DragMouseController.dragImage = dragImage;
+				trace("SingleSelectionDragSourceBead index of dragged object: "+indexOfDragSource);
 			}
+			 
 		}
 		
 		/* IDragInitiator */
 		
 		public function acceptingDrop(dropTarget:Object, type:String):void
 		{
-			trace("Accepting drop of type "+type);
+			trace("SingleSelectionDragSourceBead accepting drop of type "+type);
 			if (dragType == "copy") return;
 			
 			var dataProviderModel:IDataProviderModel = _strand.getBeadByType(IDataProviderModel) as
IDataProviderModel;
@@ -164,7 +157,7 @@ package org.apache.flex.html.beads
 		
 		public function acceptedDrop(dropTarget:Object, type:String):void
 		{
-			trace("Accepted drop of type "+type);
+			trace("SingleSelectionDragSourceBead accepted drop of type "+type);
 			var value:Object = DragEvent.dragSource;
 			trace(" -- index: "+indexOfDragSource+" of data: "+value.toString());
 			

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d19b4f4a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDropTargetBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDropTargetBead.as
b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDropTargetBead.as
index e4ee58a..186613b 100644
--- a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDropTargetBead.as
+++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDropTargetBead.as
@@ -87,30 +87,28 @@ package org.apache.flex.html.beads
 		
 		private function handleDragEnter(event:DragEvent):void
 		{
-			trace("SingleSelectionDropTargetBead received DragEnter");
+			trace("SingleSelectionDropTargetBead received DragEnter via: "+event.target.toString());
 			
 			_dropController.acceptDragDrop(event.target as IUIBase, DropType.COPY);
 		}
 		
 		private function handleDragExit(event:DragEvent):void
 		{
-			trace("SingleSelectionDropTargetBead received DragExit");
+			trace("SingleSelectionDropTargetBead received DragExit via: "+event.target.toString());
 		}
 		
 		private function handleDragOver(event:DragEvent):void
 		{
-			trace("SingleSelectionDropTargetBead received DragOver");
+			trace("SingleSelectionDropTargetBead received DragOver via: "+event.target.toString());
 		}
 		
 		private function handleDragDrop(event:DragEvent):void
 		{
-			trace("SingleSelectionDropTargetBead received DragDrop!");
-			
-			if (DropMouseController.dropTargetObject == null) return; 
-			
+			trace("SingleSelectionDropTargetBead received DragDrop via: "+event.relatedObject.toString());
+						
 			var targetIndex:int = -1; // indicates drop beyond length of items
 			
-			var startHere:Object = DropMouseController.dropTargetObject;
+			var startHere:Object = event.relatedObject;
 			while( !(startHere is IItemRenderer) && startHere != null) {
 				startHere = startHere.parent;
 			}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d19b4f4a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DragMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DragMouseController.as
b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DragMouseController.as
index 2963d86..38b1b1f 100644
--- a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DragMouseController.as
+++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DragMouseController.as
@@ -134,16 +134,6 @@ package org.apache.flex.html.beads.controllers
          *  @productversion FlexJS 0.0
          */
         public static var defaultThreshold:int = 4;
-		
-		/**
-		 * The object under the mouse when the dragStart is dispatched.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.8
-		 */
-		public static var dragStartObject:Object;
         
 		/**
 		 *  constructor.
@@ -222,14 +212,13 @@ package org.apache.flex.html.beads.controllers
                 trace("DRAG-MOUSE: not dragging anything else");
                 if (Math.abs(event.screenX - mouseDownX) > threshold ||
                     Math.abs(event.screenY - mouseDownY) > threshold)
-                {
-					DragMouseController.dragStartObject = event.target;
-					
-                    trace("DRAG-MOUSE: sending dragStart");
+                {					
                     dragEvent = DragEvent.createDragEvent("dragStart", event);
 					dragEvent.clientX = mouseDownX;
 					dragEvent.clientY = mouseDownY;
-                    DragEvent.dispatchDragEvent(dragEvent, _strand);
+					trace("DRAG-MOUSE: sending dragStart via "+event.target.toString());
+					DragEvent.dispatchDragEvent(dragEvent, event.target);
+					
                     if (DragEvent.dragSource != null)
                     {
                         dragging = true;
@@ -251,11 +240,9 @@ package org.apache.flex.html.beads.controllers
             }
             else
             {
-//                trace("DRAG-MOUSE: sending dragMove " + event.target.toString());
+                trace("DRAG-MOUSE: sending dragMove via " + event.target.toString());
                 dragEvent = DragEvent.createDragEvent("dragMove", event);
-//                trace("client: " + event.clientX.toString() + " " + event.clientY.toString()
+ " " + event.target.toString());
                 pt = PointUtils.globalToLocal(new Point(event.clientX, event.clientY), host);
-//                trace("host: " + pt.x.toString() + " " + pt.y.toString());
                 dragImage.x = pt.x + dragImageOffsetX;
                 dragImage.y = pt.y + dragImageOffsetY;
                 DragEvent.dispatchDragEvent(dragEvent, event.target);
@@ -264,12 +251,12 @@ package org.apache.flex.html.beads.controllers
         
         private function dragMouseUpHandler(event:MouseEvent):void
         {
-//            trace("DRAG-MOUSE: dragMouseUp");
+            trace("DRAG-MOUSE: dragMouseUp");
             var dragEvent:DragEvent;
             
             if (dragging)
             {
-//                trace("DRAG-MOUSE: sending dragEnd");
+                trace("DRAG-MOUSE: sending dragEnd via: "+event.target.toString());
 				
 				var screenPoint:Point = new Point(event.screenX, event.screenY);
 				var newPoint:Point = PointUtils.globalToLocal(screenPoint, event.target);
@@ -280,12 +267,14 @@ package org.apache.flex.html.beads.controllers
                 DragEvent.dispatchDragEvent(dragEvent, event.target);
                 event.preventDefault();
             }
+			
             dragging = false;
             DragEvent.dragSource = null;
             DragEvent.dragInitiator = null;
             if (dragImage && host)
                 host.removeElement(dragImage);
             dragImage = null;
+			
             IUIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_MOVE,
dragMouseMoveHandler);
             IUIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP,
dragMouseUpHandler);			
         }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d19b4f4a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DropMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DropMouseController.as
b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DropMouseController.as
index 025a8db..6f39239 100644
--- a/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DropMouseController.as
+++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/controllers/DropMouseController.as
@@ -28,6 +28,10 @@ package org.apache.flex.html.beads.controllers
 	import org.apache.flex.events.MouseEvent;
 	import org.apache.flex.geom.Point;
 	import org.apache.flex.utils.PointUtils;
+	
+	COMPILE::SWF {
+		import flash.display.InteractiveObject;
+	}
 
     /**
      *  Indicates that the mouse has entered the component during
@@ -84,18 +88,7 @@ package org.apache.flex.html.beads.controllers
 	 *  @productversion FlexJS 0.0
 	 */
 	public class DropMouseController extends EventDispatcher implements IBead
-	{
-		
-		/**
-		 * The object under the mouse when the drop was executed.
-		 *  
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion FlexJS 0.8
-		 */
-		public static var dropTargetObject:Object;
-		
+	{		
 		/**
 		 *  constructor.
 		 *  
@@ -156,15 +149,15 @@ package org.apache.flex.html.beads.controllers
             if (!inside)
             {
                 dragEvent = DragEvent.createDragEvent("dragEnter", event as MouseEvent);
-                dispatchEvent(dragEvent);
+				dispatchEvent(dragEvent);
                 inside = true;
-                IUIBase(_strand).topMostEventDispatcher.addEventListener(DragEvent.DRAG_END,
dragEndHandler);
+                IUIBase(_strand).addEventListener(DragEvent.DRAG_END, dragEndHandler);
                 IUIBase(_strand).addEventListener(MouseEvent.ROLL_OUT, rollOutHandler);
             }
             else
             {
                 dragEvent = DragEvent.createDragEvent("dragOver", event as MouseEvent);
-                dispatchEvent(dragEvent);
+				dispatchEvent(dragEvent);
             }
         }
         
@@ -175,10 +168,10 @@ package org.apache.flex.html.beads.controllers
             if (inside)
             {
                 dragEvent = DragEvent.createDragEvent("dragExit", event);
-                dispatchEvent(dragEvent);
+				dispatchEvent(dragEvent);
                 inside = false;
             }
-            IUIBase(_strand).topMostEventDispatcher.removeEventListener(DragEvent.DRAG_END,
dragEndHandler);
+            IUIBase(_strand).removeEventListener(DragEvent.DRAG_END, dragEndHandler);
             IUIBase(_strand).removeEventListener(MouseEvent.ROLL_OUT, rollOutHandler);		

         }
         
@@ -187,21 +180,25 @@ package org.apache.flex.html.beads.controllers
 		 */
         private function dragEndHandler(event:DragEvent):void
         {
-            trace("DROP-MOUSE: dragEnd received for event: "+event.target.toString());
+            trace("DROP-MOUSE: dragEnd received for event via: "+event.target.toString());
             var dragEvent:DragEvent;
-			
-			DropMouseController.dropTargetObject = event.target;
-            
+			            
 			var screenPoint:Point = new Point(event.screenX, event.screenY);
 			var newPoint:Point = PointUtils.globalToLocal(screenPoint, _strand);
             dragEvent = DragEvent.createDragEvent("dragDrop", event as MouseEvent);
 			dragEvent.clientX = newPoint.x;
 			dragEvent.clientY = newPoint.y;
+			COMPILE::SWF {
+				dragEvent.relatedObject = event.target as InteractiveObject;
+			}
+			COMPILE::JS {
+				dragEvent.relatedObject = event.target;
+			}
 						
-			DragEvent.dispatchDragEvent(dragEvent, this);
+			DragEvent.dispatchDragEvent(dragEvent, this); 
             
             inside = false;
-            IUIBase(_strand).topMostEventDispatcher.removeEventListener(DragEvent.DRAG_END,
dragEndHandler);
+            IUIBase(_strand).removeEventListener(DragEvent.DRAG_END, dragEndHandler);
             IUIBase(_strand).removeEventListener(MouseEvent.ROLL_OUT, rollOutHandler);		

         }
 		

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d19b4f4a/frameworks/projects/DragDrop/src/main/resources/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/src/main/resources/basic-manifest.xml b/frameworks/projects/DragDrop/src/main/resources/basic-manifest.xml
index fe1234e..381c96f 100644
--- a/frameworks/projects/DragDrop/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/DragDrop/src/main/resources/basic-manifest.xml
@@ -21,6 +21,7 @@
 
 <componentPackage>
 
+	<component id="SingleSelectionDragImageBead" class="org.apache.flex.html.beads.SingleSelectionDragImageBead"
/>
 	<component id="SingleSelectionDragSourceBead" class="org.apache.flex.html.beads.SingleSelectionDragSourceBead"
/>
 	<component id="SingleSelectionDropTargetBead" class="org.apache.flex.html.beads.SingleSelectionDropTargetBead"
/>
     <component id="DragMouseController" class="org.apache.flex.html.beads.controllers.DragMouseController"
/>


Mime
View raw message