flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject [37/50] git commit: [flex-asjs] [refs/heads/develop] - New beads to support drag and drop with lists. Preliminary version.
Date Mon, 03 Jul 2017 13:35:31 GMT
New beads to support drag and drop with lists. Preliminary version.


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

Branch: refs/heads/develop
Commit: 88e31ab94d5648b482982523f1f00177a8b7fd01
Parents: c2f7a2d
Author: Peter Ent <pent@apache.org>
Authored: Tue Jun 27 16:03:10 2017 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Tue Jun 27 16:03:10 2017 -0400

----------------------------------------------------------------------
 .../controllers/ItemRendererMouseController.as  |   4 +-
 .../src/main/config/compile-swf-config.xml      |   1 +
 .../DragDrop/src/main/flex/DragDropClasses.as   |   3 +
 .../flex/org/apache/flex/events/DragEvent.as    |  31 +++
 .../html/beads/SingleSelectionDragSourceBead.as | 142 ++++++++++++++
 .../html/beads/SingleSelectionDropTargetBead.as | 189 +++++++++++++++++++
 .../beads/controllers/DragMouseController.as    |  45 +++--
 .../beads/controllers/DropMouseController.as    |  17 +-
 .../src/main/resources/basic-manifest.xml       |   2 +
 9 files changed, 413 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/88e31ab9/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
index 33c6aa2..bc9bc11 100644
--- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
+++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/controllers/ItemRendererMouseController.as
@@ -174,9 +174,7 @@ COMPILE::JS {
 		{
 			var target:ISelectableItemRenderer = event.currentTarget as ISelectableItemRenderer;
 			if (target)
-			{
-				event.stopImmediatePropagation();
-				
+			{				
 				var newEvent:ItemClickedEvent = new ItemClickedEvent("itemClicked");
 				newEvent.data = target.data;
 				newEvent.multipleSelection = event.shiftKey;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/88e31ab9/frameworks/projects/DragDrop/src/main/config/compile-swf-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/DragDrop/src/main/config/compile-swf-config.xml b/frameworks/projects/DragDrop/src/main/config/compile-swf-config.xml
index a557a61..9fd8bab 100644
--- a/frameworks/projects/DragDrop/src/main/config/compile-swf-config.xml
+++ b/frameworks/projects/DragDrop/src/main/config/compile-swf-config.xml
@@ -32,6 +32,7 @@
             <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
             <path-element>../../../../../libs/Core.swc</path-element>
             <path-element>../../../../../libs/Basic.swc</path-element>
+            <path-element>../../../../../libs/Collections.swc</path-element>
         </external-library-path>
         
 		<mxml>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/88e31ab9/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 14d0b54..866c39e 100644
--- a/frameworks/projects/DragDrop/src/main/flex/DragDropClasses.as
+++ b/frameworks/projects/DragDrop/src/main/flex/DragDropClasses.as
@@ -29,6 +29,9 @@ internal class DragDropClasses
 {	  
     import org.apache.flex.core.DropType; DropType;
     import org.apache.flex.events.DragEvent; DragEvent;   
+	
+	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/88e31ab9/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 8acef67..392da45 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
@@ -19,6 +19,8 @@
 package org.apache.flex.events
 {
     import org.apache.flex.core.IDragInitiator;
+	import org.apache.flex.utils.PointUtils;
+	import org.apache.flex.geom.Point;
     COMPILE::JS
     {
         import org.apache.flex.core.IUIBase;
@@ -257,7 +259,30 @@ package org.apache.flex.events
          *  @productversion FlexJS 0.0
          */
         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;
+		}
+		}
 
         /**
          *  Constructor.  Do not call 'new DragEvent', use the
@@ -312,6 +337,12 @@ package org.apache.flex.events
                 de.buttonDown = event.buttonDown;
                 de.delta = event.delta;
                 de.relatedObject = event.relatedObject;
+				
+				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;                    
             }
             COMPILE::JS

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/88e31ab9/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
new file mode 100644
index 0000000..71f5394
--- /dev/null
+++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDragSourceBead.as
@@ -0,0 +1,142 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.core.IBead;
+	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.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.utils.PointUtils;
+	
+    
+	/**
+	 *  The SingleSelectionDragSourceBead brings drag capability to single-selection List components.
+	 *  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.
+	 * 
+     *  @flexjsignoreimport org.apache.flex.core.IDragInitiator
+	 *  @see org.apache.flex.html.beads.SingleSelectionDropTargetBead.
+     *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class SingleSelectionDragSourceBead extends EventDispatcher implements IBead, IDragInitiator
+	{
+		public function SingleSelectionDragSourceBead()
+		{
+			super();
+		}
+		
+		private var _strand:IStrand;
+		private var _dragController:DragMouseController;
+		
+		private var _itemRendererParent:IParent;
+		public function get itemRendererParent():IParent
+		{
+			if (_itemRendererParent == null) {
+				_itemRendererParent = _strand.getBeadByType(IItemRendererParent) as IParent;
+			}
+			return _itemRendererParent;
+		}
+		
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			
+			_dragController = new DragMouseController();
+			_strand.addBead(_dragController);
+			
+			IEventDispatcher(_strand).addEventListener(DragEvent.DRAG_START, handleDragStart);
+		}
+		
+		public function get strand():IStrand
+		{
+			return _strand;
+		}
+		
+		private function handleDragStart(event:DragEvent):void
+		{
+			trace("SingleSelectionDragSourceBead received the DragStart");
+			
+			var downPoint:Point = new Point(event.clientX, event.clientY);//PointUtils.localToGlobal(new
Point(event.clientX, event.clientY), _strand);
+			trace("Dragging from this point: "+downPoint.x+", "+downPoint.y);
+			trace("-- find the itemRenderer this object is over");
+			
+			if (itemRendererParent != null) {
+				var n:Number = itemRendererParent.numElements;
+				for (var i:int=0; i < n; i++) {
+					var child:UIBase = itemRendererParent.getElementAt(i) as UIBase;
+					if (child != null) {
+						var childPoint:Point = PointUtils.localToGlobal(new Point(child.x,child.y), itemRendererParent);
+						trace("-- child "+i+": "+childPoint.x+" - "+(childPoint.x+child.width)+" x "+childPoint.y+"
- "+(childPoint.y+child.height));
+						var rect:Rectangle = new Rectangle(childPoint.x, childPoint.y, child.width, child.height);
+						if (rect.containsPoint(downPoint)) {							
+							var ir:IItemRenderer = child as IItemRenderer;
+							
+							trace("-- dragging this child, " + i + ", at "+childPoint.x+", "+childPoint.y);
+							
+							//var dragImage:Label = new Label();
+							//dragImage.text = ir.data.toString();
+							var dragImage:UIBase = new Group();
+							dragImage.className = "DragImage";
+							dragImage.width = child.width;
+							dragImage.height = child.height;
+							var label:Label = new Label();
+							label.text = ir.data.toString();
+							dragImage.addElement(label);
+							
+							DragEvent.dragSource = {index:i, data:ir.data}; // needs to be the data from the child,
but we'll get to that.
+							DragEvent.dragInitiator = this;
+							DragMouseController.dragImage = dragImage;
+							break;
+						}
+					}
+				}
+			}
+		}
+		
+		/* IDragInitiator */
+		
+		public function acceptingDrop(dropTarget:Object, type:String):void
+		{
+			trace("Accepting drop of type "+type);
+		}
+		
+		public function acceptedDrop(dropTarget:Object, type:String):void
+		{
+			trace("Accepted drop of type "+type);
+			var value:Object = DragEvent.dragSource;
+			trace(" -- index: "+value.index+" of data: "+value.data);
+		}
+		
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/88e31ab9/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
new file mode 100644
index 0000000..0049bc0
--- /dev/null
+++ b/frameworks/projects/DragDrop/src/main/flex/org/apache/flex/html/beads/SingleSelectionDropTargetBead.as
@@ -0,0 +1,189 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.DropType;
+	import org.apache.flex.core.IBead;
+	import org.apache.flex.core.IDataProviderModel;
+	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.IUIBase;
+	import org.apache.flex.core.UIBase;
+	import org.apache.flex.events.DragEvent;
+	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.beads.controllers.DropMouseController;
+	
+    
+	/**
+	 *  The SingleSelectionDropTargetBead enables items to be dropped onto single-selection
List
+	 *  components. This bead can be used with SingleSelectionDragSourceBead to enable the re-arrangement
+	 *  of rows within the same list.
+     *  
+	 *  @see org.apache.flex.html.beads.SingleSelectionDropTargetBead
+     *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class SingleSelectionDropTargetBead extends EventDispatcher implements IBead
+	{
+		public function SingleSelectionDropTargetBead()
+		{
+			super();
+		}
+		
+		private var _strand:IStrand;
+		private var _dropController:DropMouseController;
+		
+		private var _itemRendererParent:IParent;
+		public function get itemRendererParent():IParent
+		{
+			if (_itemRendererParent == null) {
+				_itemRendererParent = _strand.getBeadByType(IItemRendererParent) as IParent;
+			}
+			return _itemRendererParent;
+		}
+		
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			
+			_dropController = new DropMouseController();
+			_strand.addBead(_dropController);
+			
+			IEventDispatcher(_dropController).addEventListener(DragEvent.DRAG_ENTER, handleDragEnter);
+			IEventDispatcher(_dropController).addEventListener(DragEvent.DRAG_EXIT, handleDragExit);
+			IEventDispatcher(_dropController).addEventListener(DragEvent.DRAG_OVER, handleDragOver);
+			IEventDispatcher(_dropController).addEventListener(DragEvent.DRAG_DROP, handleDragDrop);
+		}
+		
+		public function get strand():IStrand
+		{
+			return _strand;
+		}
+		
+		private function handleDragEnter(event:DragEvent):void
+		{
+			var myX:Number = event.clientX;
+			trace("SingleSelectionDropTargetBead received DragEnter"+", at "+myX);
+			
+			_dropController.acceptDragDrop(event.target as IUIBase, DropType.COPY);
+		}
+		
+		private function handleDragExit(event:DragEvent):void
+		{
+			trace("SingleSelectionDropTargetBead received DragExit");
+		}
+		
+		private function handleDragOver(event:DragEvent):void
+		{
+			var myX:Number = event.clientX;
+			trace("SingleSelectionDropTargetBead over "+event.target.toString()+" at "+myX);
+		}
+		
+		private function handleDragDrop(event:DragEvent):void
+		{
+			var myX:Number = event.clientX;
+			trace("SingleSelectionDropTargetBead received DragDrop!");
+			
+			var downPoint:Point = new Point(event.clientX, event.clientY); 
+			trace("Dropping at this point: "+downPoint.x+", "+downPoint.y);
+			trace("-- find the itemRenderer this object is over");
+			
+			var targetIndex:int = -1; // indicates drop beyond length of items
+			
+			if (itemRendererParent != null) {
+				var n:Number = itemRendererParent.numElements;
+				for (var i:int=0; i < n; i++) {
+					var child:UIBase = itemRendererParent.getElementAt(i) as UIBase;
+					if (child != null) {
+						var childPoint:Point = new Point(child.x, child.y); 
+						trace("-- child "+i+": "+childPoint.x+" - "+(childPoint.x+child.width)+" x "+childPoint.y+"
- "+(childPoint.y+child.height));
+						var rect:Rectangle = new Rectangle(childPoint.x, childPoint.y, child.width, child.height);
+						if (rect.containsPoint(downPoint)) {							
+							var ir:IItemRenderer = child as IItemRenderer;
+							targetIndex = i;
+							trace("-- Found this item: "+i);
+							break;
+						}
+					}
+				}
+				
+				if (targetIndex == (n-1)) { // special case when drop on last item
+					targetIndex--;
+				}
+				
+				if (DragEvent.dragInitiator) {
+					DragEvent.dragInitiator.acceptingDrop(_strand, "object");
+				}
+				
+				var dragSource:Object = DragEvent.dragSource;
+				
+				var dataProviderModel:IDataProviderModel = _strand.getBeadByType(IDataProviderModel)
as IDataProviderModel;
+				if (dataProviderModel.dataProvider is Array) {
+					var dataArray:Array = dataProviderModel.dataProvider as Array;
+					
+					// remove the item being selected
+					dataArray.splice(dragSource.index,1);
+					
+					// insert the item being dropped
+					if (targetIndex == -1) {
+						// append to the end
+						dataArray.push(dragSource.data);
+					} else {
+						// insert before targetIndex
+						dataArray.splice(targetIndex, 0, dragSource.data);
+					}
+					
+					var newArray:Array = dataArray.slice()
+					dataProviderModel.dataProvider = newArray;
+				}
+				else if (dataProviderModel.dataProvider is ArrayList) {
+					var dataList:ArrayList = dataProviderModel.dataProvider as ArrayList;
+					
+					// remove the item being selected
+					dataList.removeItemAt(dragSource.index);
+					
+					// insert the item being dropped
+					if (targetIndex == -1) {
+						// sppend to the end
+						dataList.addItem(dragSource.data);
+					} else {
+						// insert before target index
+						dataList.addItemAt(dragSource.data, targetIndex);
+					}
+					
+					var newList:ArrayList = new ArrayList(dataList.source);
+					dataProviderModel.dataProvider = newList;
+					
+					if (DragEvent.dragInitiator) {
+						DragEvent.dragInitiator.acceptedDrop(_strand, "object");
+					}
+				}
+			}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/88e31ab9/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 4c22190..e9451fa 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
@@ -18,19 +18,25 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.html.beads.controllers
 {
+	COMPILE::SWF {
+	import flash.display.InteractiveObject;
+	import flash.display.DisplayObjectContainer;
+	}
+	
 	
 	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IDragInitiator;
-    import org.apache.flex.core.IPopUpHost;
+	import org.apache.flex.core.IPopUpHost;
 	import org.apache.flex.core.IStrand;
-    import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.UIBase;
 	import org.apache.flex.events.DragEvent;
 	import org.apache.flex.events.EventDispatcher;
 	import org.apache.flex.events.IEventDispatcher;
-    import org.apache.flex.events.MouseEvent;
-    import org.apache.flex.geom.Point;
+	import org.apache.flex.events.MouseEvent;
+	import org.apache.flex.geom.Point;
 	import org.apache.flex.utils.PointUtils;
-    import org.apache.flex.utils.UIUtils;
+	import org.apache.flex.utils.UIUtils;
 	
     /**
      *  Indicates that a drag/drop operation is starting.
@@ -185,7 +191,7 @@ package org.apache.flex.html.beads.controllers
          */
         private function dragMouseDownHandler(event:MouseEvent):void
         {
-            trace("dragMouseDown");
+            trace("DRAG-MOUSE: dragMouseDown");
             IUIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_MOVE,
dragMouseMoveHandler);
             IUIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP,
dragMouseUpHandler);
             mouseDownX = event.screenX;
@@ -197,18 +203,20 @@ package org.apache.flex.html.beads.controllers
         {
             var pt:Point;
             var dragEvent:DragEvent;
-            trace("dragMouseMove");
+            trace("DRAG-MOUSE: dragMouseMove");
             
             event.preventDefault();
             
             if (!dragging)
             {
-                trace("not dragging anything else");
+                trace("DRAG-MOUSE: not dragging anything else");
                 if (Math.abs(event.screenX - mouseDownX) > threshold ||
                     Math.abs(event.screenY - mouseDownY) > threshold)
                 {
-                    trace("sending dragStart");
+                    trace("DRAG-MOUSE: sending dragStart");
                     dragEvent = DragEvent.createDragEvent("dragStart", event);
+					dragEvent.clientX = mouseDownX;
+					dragEvent.clientY = mouseDownY;
                     DragEvent.dispatchDragEvent(dragEvent, _strand);
                     if (DragEvent.dragSource != null)
                     {
@@ -218,12 +226,17 @@ package org.apache.flex.html.beads.controllers
                         pt = PointUtils.globalToLocal(new Point(event.clientX, event.clientY),
host);
                         dragImage.x = pt.x + dragImageOffsetX;
                         dragImage.y = pt.y + dragImageOffsetY;
+						(dragImage as UIBase).id = "drag_image";
+						COMPILE::SWF {
+							(dragImage as InteractiveObject).mouseEnabled = false;
+							(dragImage as DisplayObjectContainer).mouseChildren = false;
+						}
                     }
                 }
             }
             else
             {
-                trace("sending dragMove " + event.target.toString());
+                trace("DRAG-MOUSE: sending dragMove " + 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);
@@ -236,13 +249,19 @@ package org.apache.flex.html.beads.controllers
         
         private function dragMouseUpHandler(event:MouseEvent):void
         {
-            trace("dragMouseUp");
+            trace("DRAG-MOUSE: dragMouseUp");
             var dragEvent:DragEvent;
             
             if (dragging)
             {
-                trace("sending dragEnd");
-                dragEvent = DragEvent.createDragEvent("dragEnd", event);
+                trace("DRAG-MOUSE: sending dragEnd");
+				
+				var screenPoint:Point = new Point(event.screenX, event.screenY);
+				var newPoint:Point = PointUtils.globalToLocal(screenPoint, event.target);
+				dragEvent = DragEvent.createDragEvent("dragEnd", event);
+				dragEvent.clientX = newPoint.x;
+				dragEvent.clientY = newPoint.y;
+				
                 DragEvent.dispatchDragEvent(dragEvent, event.target);
                 event.preventDefault();
             }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/88e31ab9/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 f891455..72e54aa 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
@@ -21,11 +21,13 @@ package org.apache.flex.html.beads.controllers
 	import org.apache.flex.core.IBead;
 	import org.apache.flex.core.IDragInitiator;
 	import org.apache.flex.core.IStrand;
-    import org.apache.flex.core.IUIBase;
+	import org.apache.flex.core.IUIBase;
 	import org.apache.flex.events.DragEvent;
 	import org.apache.flex.events.EventDispatcher;
 	import org.apache.flex.events.IEventDispatcher;
-    import org.apache.flex.events.MouseEvent;
+	import org.apache.flex.events.MouseEvent;
+	import org.apache.flex.geom.Point;
+	import org.apache.flex.utils.PointUtils;
 
     /**
      *  Indicates that the mouse has entered the component during
@@ -138,7 +140,7 @@ package org.apache.flex.html.beads.controllers
          */
         private function dragMoveHandler(event:DragEvent):void
         {
-            trace("dragMove");
+            trace("DROP-MOUSE: dragMove" + event.target.toString());
             var dragEvent:DragEvent;
             if (!inside)
             {
@@ -174,11 +176,16 @@ package org.apache.flex.html.beads.controllers
 		 */
         private function dragEndHandler(event:DragEvent):void
         {
-            trace("dragEnd");
+            trace("DROP-MOUSE: dragEnd received for event: "+event.target.toString());
             var dragEvent:DragEvent;
             
+			var screenPoint:Point = new Point(event.screenX, event.screenY);
+			var newPoint:Point = PointUtils.globalToLocal(screenPoint, _strand);
             dragEvent = DragEvent.createDragEvent("dragDrop", event as MouseEvent);
-            dispatchEvent(dragEvent);
+			dragEvent.clientX = newPoint.x;
+			dragEvent.clientY = newPoint.y;
+						
+			DragEvent.dispatchDragEvent(dragEvent, this);
             
             inside = false;
             IUIBase(_strand).topMostEventDispatcher.removeEventListener(DragEvent.DRAG_END,
dragEndHandler);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/88e31ab9/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 bf5911f..fe1234e 100644
--- a/frameworks/projects/DragDrop/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/DragDrop/src/main/resources/basic-manifest.xml
@@ -21,6 +21,8 @@
 
 <componentPackage>
 
+	<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"
/>
     <component id="DropMouseController" class="org.apache.flex.html.beads.controllers.DropMouseController"
/>
 


Mime
View raw message