Permalink
Browse files

Significant reworking, many features disabled while restructing archi…

…tecture.
  • Loading branch information...
1 parent 63fee48 commit 6c7cb14b05fdd17287f7a0a77b866fe46bb4cca7 secoif committed Feb 15, 2010
Showing with 1,437 additions and 1,663 deletions.
  1. BIN libs/as3-signals.swc
  2. +12 −1 src/com/comtaste/pantaste/behaviours/BehaviourBase.as
  3. +58 −17 src/com/comtaste/pantaste/behaviours/MoveBehaviour.as
  4. +237 −51 src/com/comtaste/pantaste/behaviours/ResizeBehaviour.as
  5. +103 −0 src/com/comtaste/pantaste/behaviours/SelectBehaviour.as
  6. +73 −19 src/com/comtaste/pantaste/behaviours/TransformBehaviourBase.as
  7. +55 −0 src/com/comtaste/pantaste/behaviours/modifiers/BehaviourModifierBase.as
  8. +58 −0 src/com/comtaste/pantaste/behaviours/modifiers/MaintainAspectRatioModifier.as
  9. +27 −0 src/com/comtaste/pantaste/behaviours/modifiers/SelectModifier.as
  10. +5 −3 src/com/comtaste/pantaste/behaviours/modifiers/SnapToGridModifier.as
  11. +2 −3 src/com/comtaste/pantaste/common/DashConstants.as
  12. +6 −6 src/com/comtaste/pantaste/components/DashDock.as
  13. +165 −349 src/com/comtaste/pantaste/components/DashPanel.as
  14. +12 −13 src/com/comtaste/pantaste/components/DashPanelContainer.as
  15. +10 −1 src/com/comtaste/pantaste/components/DashPanelTitleBar.as
  16. +92 −67 src/com/comtaste/pantaste/components/DashProxy.as
  17. +59 −0 src/com/comtaste/pantaste/components/IconButton.as
  18. +3 −2 src/com/comtaste/pantaste/components/skins/DashDockSkin.mxml
  19. +9 −14 src/com/comtaste/pantaste/components/skins/DashPanelContainerSkin.mxml
  20. +26 −8 src/com/comtaste/pantaste/components/skins/DashPanelControlsSkin.mxml
  21. +70 −36 src/com/comtaste/pantaste/components/skins/DashPanelSkin.mxml
  22. +13 −4 src/com/comtaste/pantaste/components/skins/DashProxySkin.mxml
  23. +96 −62 src/com/comtaste/pantaste/components/skins/PanelControlsButtonSkin.mxml
  24. +14 −4 src/com/comtaste/pantaste/components/skins/TitleBarSkin.mxml
  25. +21 −0 src/com/comtaste/pantaste/components/skins/graphics/Cross.mxml
  26. +27 −0 src/com/comtaste/pantaste/components/skins/graphics/Resizer.mxml
  27. +5 −0 src/com/comtaste/pantaste/selection/ISelectable.as
  28. +179 −0 src/com/comtaste/pantaste/selection/SelectionController.as
  29. +0 −600 src/com/ericfeminella/collections/HashMap.as
  30. +0 −121 src/com/ericfeminella/collections/HashMapEntry.as
  31. +0 −86 src/com/ericfeminella/collections/IHashMapEntry.as
  32. +0 −196 src/com/ericfeminella/collections/IMap.as
View
Binary file not shown.
@@ -117,13 +117,15 @@ package com.comtaste.pantaste.behaviours {
}
public function removeModifier(modifier:IBehaviourModifier):void {
- modifier.behaviour = null;
+
var index:uint = modifiers.indexOf(modifier);
if (index < 0) {
throw new Error("Modifier not found in collection: " + modifier);
}
modifiers.splice(index, 1);
+ modifier.enabled = false;
+ modifier.behaviour = null;
}
//----------------------------------------------------------
@@ -137,18 +139,27 @@ package com.comtaste.pantaste.behaviours {
}
protected function start():void {
+ if (modifiers.length == 0) {
+ return;
+ }
for each (var modifier:IBehaviourModifier in modifiers) {
modifier.start();
}
}
protected function step():void {
+ if (modifiers.length == 0) {
+ return;
+ }
for each (var modifier:IBehaviourModifier in modifiers) {
modifier.step();
}
}
protected function stop():void {
+ if (modifiers.length == 0) {
+ return;
+ }
for each (var modifier:IBehaviourModifier in modifiers) {
modifier.stop();
}
@@ -1,15 +1,18 @@
package com.comtaste.pantaste.behaviours {
import com.comtaste.pantaste.common.DashConstants;
import com.comtaste.pantaste.components.DashProxy;
+
import flash.display.DisplayObject;
import flash.events.Event;
import flash.events.IEventDispatcher;
import flash.events.MouseEvent;
import flash.geom.Point;
+
import mx.core.FlexGlobals;
import mx.core.IVisualElement;
import mx.core.UIComponent;
import mx.events.FlexEvent;
+ import mx.logging.LogLogger;
public class MoveBehaviour extends TransformBehaviourBase {
@@ -45,13 +48,14 @@ package com.comtaste.pantaste.behaviours {
// isMoving
//--------------------------------------
- private var _isMoving:Boolean = false;
+ private static var _isMoving:Boolean = false;
- private function get isMoving():Boolean {
+ public function get isMoving():Boolean {
return _isMoving;
}
- private function set isMoving(value:Boolean):void {
+ public function set isMoving(value:Boolean):void {
+ trace("isMoving = " + value);
_isMoving = value;
if (_isMoving) {
@@ -86,12 +90,28 @@ package com.comtaste.pantaste.behaviours {
//----------------------------------------------------------
override protected function initialize():void {
+ if (target.stage) {
+ setup();
+ } else {
+ target.addEventListener(Event.ADDED_TO_STAGE, function(event:Event):void {
+ target.removeEventListener(Event.ADDED_TO_STAGE, arguments.callee);
+ setup();
+ });
+ }
+ super.initialize();
+ }
+
+ private function setup():void {
cursor = DashConstants.moveCursor;
+ offset = new Point(-10, -5);
super.dispatcher.addEventListener(triggerEvent, onMoveTriggered);
- super.dispatcher.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
- super.dispatcher.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
+ //super.dispatcher.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
+ super.dispatcher.addEventListener(MouseEvent.ROLL_OVER, onMouseOver);
+ //super.dispatcher.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
+ super.dispatcher.addEventListener(MouseEvent.ROLL_OUT, onMouseOut);
+ // target.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
+ target.addEventListener(MouseEvent.ROLL_OUT, onMouseOut);
- super.initialize();
}
//----------------------------------------------------------
@@ -107,10 +127,20 @@ package com.comtaste.pantaste.behaviours {
}
private function onMouseMove(event:MouseEvent):void {
+ if (!enabled) {
+ return;
+ }
+ if (isMoving) {
+ if (!event.buttonDown) {
+ //onMouseUp(event);
+ }
+ step();
+ return;
+ }
if (preparingToDrag) {
newPosition.x = event.stageX;
newPosition.y = event.stageY;
- // var transformedOriginalPosition:Point = UIComponent(moveTarget.parentSelectable).localToGlobal(originalPosition)
+
var differenceX:Number = Math.abs(newPosition.x - originalMousePosition.x);
var differenceY:Number = Math.abs(newPosition.y - originalMousePosition.y);
var distance:Number =
@@ -121,13 +151,13 @@ package com.comtaste.pantaste.behaviours {
}
}
-
+
step();
- trace('step');
+
}
private function onMouseOut(event:MouseEvent):void {
- if (event.currentTarget != dispatcher) {
+ if (event.currentTarget != target || event.currentTarget != dispatcher) {
return;
}
@@ -137,10 +167,14 @@ package com.comtaste.pantaste.behaviours {
}
private function onMouseOver(event:MouseEvent):void {
- if (event.currentTarget != dispatcher) {
+ if (event.currentTarget != dispatcher || event.target != target) {
return;
}
showCursor();
+ this.proxy.invalidateSnapshot();
+ this.proxy.createSnapshot();
+ this.proxy.scaleX = target.scaleX;
+ this.proxy.scaleY = target.scaleY;
}
private function onMouseUp(event:MouseEvent):void {
@@ -149,6 +183,7 @@ package com.comtaste.pantaste.behaviours {
if (preparingToDrag) {
preparingToDrag = false;
+ isMoving = false;
return;
}
stopMoving();
@@ -166,11 +201,14 @@ package com.comtaste.pantaste.behaviours {
triggeringEvent = event;
startMoving();
-
+ event.stopPropagation();
}
private function startDragging():void {
+ proxy.mode = DashProxy.MODE_SNAPSHOT;
+
start();
+ isMoving = true;
if (proxy.initialized) {
proxy.startDrag();
} else {
@@ -182,6 +220,7 @@ package com.comtaste.pantaste.behaviours {
preparingToDrag = false;
+
proxyLayer.addElementAt(proxy, proxyLayer.numElements);
proxy.depth = target.depth + 1;
@@ -190,14 +229,13 @@ package com.comtaste.pantaste.behaviours {
private function startMoving():void {
- isMoving = true;
- proxy.mode = DashProxy.MODE_SNAPSHOT;
- //proxy.depth = target.depth + 1;
-
var triggerPosition:Point = new Point(triggeringEvent.stageX, triggeringEvent.stageY);
- var targetPosition:Point = DisplayObject(proxyLayer).globalToLocal(triggerPosition);
+ var targetPosition:Point = toCoordinateSpace(triggerPosition.x, triggerPosition.y, DisplayObject(proxyLayer));
+
proxy.x = target.x;
proxy.y = target.y;
+ proxy.scaleX = target.scaleX;
+ proxy.scaleY = target.scaleY;
originalPosition = new Point(target.x, target.y);
originalMousePosition = new Point(triggeringEvent.stageX, triggeringEvent.stageY);
@@ -222,6 +260,9 @@ package com.comtaste.pantaste.behaviours {
var position:Point = proxy.localToGlobal(new Point(proxy.x, proxy.y));
var newPosition:Point = target.globalToLocal(position);
+
+
+
proxy.x = 0;
proxy.y = 0;
originalPosition = new Point();
Oops, something went wrong.

0 comments on commit 6c7cb14

Please sign in to comment.