Fisheye: Tag 1.2 refers to a dead (removed) revision in file `lams_flex/LamsAuthor/ActivityComponent.as'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_flex/LamsAuthor/src/assets/icons/bin.png =================================================================== RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/assets/icons/bin.png,v diff -u Binary files differ Index: lams_flex/LamsAuthor/src/assets/icons/bin_over.png =================================================================== RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/assets/icons/bin_over.png,v diff -u Binary files differ Index: lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/Bin.mxml =================================================================== RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/Bin.mxml,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/Bin.mxml 2 Feb 2010 00:41:52 -0000 1.1 @@ -0,0 +1,64 @@ + + + + + + + + + + + + + Index: lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/CanvasArea.mxml =================================================================== RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/CanvasArea.mxml,v diff -u -r1.7 -r1.8 --- lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/CanvasArea.mxml 29 Jan 2010 03:51:50 -0000 1.7 +++ lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/CanvasArea.mxml 2 Feb 2010 00:41:52 -0000 1.8 @@ -1,37 +1,27 @@ - - - - - + - + - - - - + + + Index: lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/activity/ActivityComponent.mxml =================================================================== RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/activity/ActivityComponent.mxml,v diff -u -r1.10 -r1.11 --- lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/activity/ActivityComponent.mxml 29 Jan 2010 03:51:50 -0000 1.10 +++ lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/activity/ActivityComponent.mxml 2 Feb 2010 00:41:52 -0000 1.11 @@ -77,9 +77,6 @@ Application.application.canvasArea.propertyInspector.closePropertyInspector(); } - - - // The mouseMove event handler for the Image control // initiates the drag-and-drop operation. protected function mouseMove(event:MouseEvent):void @@ -95,7 +92,7 @@ // Set the offset for dropping the activity to the local mouse position activityComponent.mouseOffSetX = event.localX; - activityComponent.mouseOffSetY = event.localY; + activityComponent.mouseOffSetY = event.localY; DragManager.doDrag(activityComponent, ds, event); setCenter(); @@ -109,7 +106,7 @@ switch (Application.application.cursorState) { case Constants.CURSOR_STATE_TRANSITION: if (this.canStartTransitions) { - startDragging(event); + startTransition(event); } break; @@ -122,7 +119,7 @@ centerY = y + height/2 -10; } - protected function startDragging(event:MouseEvent):void { + protected function startTransition(event:MouseEvent):void { if (transitionOut != null) { //parent.removeChild(transitionOut); @@ -154,7 +151,7 @@ } - protected function stopDragging():void + protected function stopTransition():void { Application.application.uiState = Constants.UI_STATE_NORMAL; systemManager.removeEventListener(MouseEvent.MOUSE_MOVE, systemManagerMouseMoveHandler, true); @@ -182,9 +179,9 @@ */ private function systemManagerMouseUpHandler(event:MouseEvent):void { - stopDragging(); + stopTransition(); - var transitionEvent:TransitionEvent = new TransitionEvent(TransitionEvent.TRANSITION_EVENT); + var transitionEvent:TransitionEvent = new TransitionEvent(TransitionEvent.TRANSITION_COMPLETE); transitionEvent.sourceAcivityComponent = this; transitionEvent.transition = transitionOut; Application.application.dispatchEvent(transitionEvent); @@ -193,7 +190,7 @@ private function stageMouseLeaveHandler(event:MouseEvent):void { - stopDragging(); + stopTransition(); } private function mouseOver(event:MouseEvent):void { Index: lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/transition/TransitionComponent.as =================================================================== RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/transition/TransitionComponent.as,v diff -u -r1.4 -r1.5 --- lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/transition/TransitionComponent.as 28 Jan 2010 23:53:07 -0000 1.4 +++ lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/components/transition/TransitionComponent.as 2 Feb 2010 00:41:52 -0000 1.5 @@ -2,9 +2,15 @@ { import com.dncompute.graphics.GraphicsUtil; + import flash.events.MouseEvent; import flash.geom.Point; + import mx.core.Application; + import mx.core.DragSource; + import mx.managers.DragManager; + import org.lamsfoundation.lams.author.components.activity.ActivityComponent; + import org.lamsfoundation.lams.author.util.Constants; public class TransitionComponent extends DrawingTool { @@ -13,6 +19,7 @@ public function TransitionComponent() { + this.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove); } override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void { @@ -45,6 +52,17 @@ } } + + // The mouseMove event handler for the Image control + // initiates the drag-and-drop operation. + private function mouseMove(event:MouseEvent):void + { + if (Application.application.cursorState == Constants.CURSOR_STATE_NORMAL) { + var ds:DragSource = new DragSource(); + ds.addData(this, "img"); + DragManager.doDrag(this, ds, event, this); + } + } } } \ No newline at end of file Index: lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/controller/AuthorController.as =================================================================== RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/controller/AuthorController.as,v diff -u -r1.8 -r1.9 --- lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/controller/AuthorController.as 28 Jan 2010 23:53:07 -0000 1.8 +++ lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/controller/AuthorController.as 2 Feb 2010 00:41:52 -0000 1.9 @@ -14,6 +14,7 @@ import org.lamsfoundation.lams.author.components.activity.*; import org.lamsfoundation.lams.author.components.toolbar.SystemActivityComponent; import org.lamsfoundation.lams.author.components.transition.TransitionComponent; + import org.lamsfoundation.lams.author.events.AuthorActivityEvent; import org.lamsfoundation.lams.author.events.TransitionEvent; import org.lamsfoundation.lams.author.model.learninglibrary.LearningLibraryEntry; import org.lamsfoundation.lams.author.util.Constants; @@ -224,5 +225,64 @@ return false; } } + + + /** + * This function is invoked when an activity is dragged into the bin + * it deletes the activity and any related transitions + * + * TODO: Check the state of the LD and set it to invalid if neccessary + * + * @param event AuthorActivityEvent containing the acitvity object + * + */ + public function deleteActivity(event:AuthorActivityEvent):void { + var canvasBox:CanvasBox = Application.application.canvasArea.canvasBox; + + var activityComponent:ActivityComponent = event.activityComponent; + + // Remove transition in, if needed + if (activityComponent.transitionIn != null) { + canvasBox.removeChild(activityComponent.transitionIn); + transitionArray.removeItemAt(transitionArray.getItemIndex(activityComponent.transitionIn)); + activityComponent.transitionIn.fromActivity.transitionOut = null; + activityComponent.transitionIn = null; + } + + // Remove transition out if needed + if (activityComponent.transitionOut != null) { + canvasBox.removeChild(activityComponent.transitionOut); + transitionArray.removeItemAt(transitionArray.getItemIndex(activityComponent.transitionOut)); + activityComponent.transitionOut.toActivity.transitionIn = null; + activityComponent.transitionOut = null; + } + + // Remove activity + canvasBox.removeChild(activityComponent); + activityComponent = null; + } + + + /** + * This function is invoked when a transition is dropped into the bin + * it deletes the transition + * + * TODO: Check the state of the LD and set it to invalid if neccessary + * + * @param event the TransitionEvent + */ + public function deleteTransition(event:TransitionEvent): void { + var canvasBox:CanvasBox = Application.application.canvasArea.canvasBox; + + var transition:TransitionComponent = event.transition; + + transitionArray.removeItemAt(transitionArray.getItemIndex(transition)); + transition.fromActivity.transitionOut = null; + transition.toActivity.transitionIn = null; + transition = null; + + } + + } } \ No newline at end of file Index: lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/events/AuthorActivityEvent.as =================================================================== RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/events/AuthorActivityEvent.as,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/events/AuthorActivityEvent.as 2 Feb 2010 00:41:52 -0000 1.1 @@ -0,0 +1,17 @@ +package org.lamsfoundation.lams.author.events +{ + import flash.events.Event; + import org.lamsfoundation.lams.author.components.activity.ActivityComponent; + + public class AuthorActivityEvent extends Event + { + public static const DELETE_ACTIVITY_EVENT:String = "deleteActivityEvent"; + public var activityComponent:ActivityComponent; + + public function AuthorActivityEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false) + { + super(type, bubbles, cancelable); + } + + } +} \ No newline at end of file Index: lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/events/TransitionEvent.as =================================================================== RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/events/TransitionEvent.as,v diff -u -r1.2 -r1.3 --- lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/events/TransitionEvent.as 22 Jan 2010 01:21:39 -0000 1.2 +++ lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/events/TransitionEvent.as 2 Feb 2010 00:41:52 -0000 1.3 @@ -6,7 +6,10 @@ public class TransitionEvent extends AuthorEvent { - public static const TRANSITION_EVENT:String = "transitionEvent"; + public static const TRANSITION_COMPLETE:String = "transitionComplete"; + public static const DELETE_TRANSITION:String = "deleteTransition"; + + public var sourceAcivityComponent:ActivityComponent; public var transition:TransitionComponent; public var localY:int; Index: lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/maps/MainEventMap.mxml =================================================================== RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/maps/MainEventMap.mxml,v diff -u -r1.5 -r1.6 --- lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/maps/MainEventMap.mxml 28 Jan 2010 03:48:06 -0000 1.5 +++ lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/maps/MainEventMap.mxml 2 Feb 2010 00:41:52 -0000 1.6 @@ -57,13 +57,6 @@ --> - - - - @@ -98,7 +91,7 @@ - + @@ -107,7 +100,17 @@ + + + + + + + + + + Index: lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/util/Constants.as =================================================================== RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/util/Constants.as,v diff -u -r1.8 -r1.9 --- lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/util/Constants.as 29 Jan 2010 03:51:50 -0000 1.8 +++ lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/util/Constants.as 2 Feb 2010 00:41:52 -0000 1.9 @@ -19,7 +19,6 @@ public static const UI_STATE_NORMAL:int = 1; public static const UI_STATE_DRAWING:int = 2; - public static const ACTIVITY_STATE_NORMAL:int = 1; public static const ACTIVITY_STATE_DRAWING:int = 2; public static const ACTIVITY_STATE_MOUSE_OVER:int = 3;