Index: lams_tool_mindmap/src/flash/AS/ActionLoader.as =================================================================== diff -u -re28d61401c1f05f1b3db8068f7ad76f161e90f09 -r643162984254c265d82c6c6d5f2ff34c378e1ce4 --- lams_tool_mindmap/src/flash/AS/ActionLoader.as (.../ActionLoader.as) (revision e28d61401c1f05f1b3db8068f7ad76f161e90f09) +++ lams_tool_mindmap/src/flash/AS/ActionLoader.as (.../ActionLoader.as) (revision 643162984254c265d82c6c6d5f2ff34c378e1ce4) @@ -1,5 +1,6 @@ package { import flash.net.*; + import flash.text.*; import actions.*; public class ActionLoader extends URLLoader { protected var localId:int; @@ -16,7 +17,7 @@ this.prevRelated = null; this.nextRelated = null; this.highestRelatedId = -1; - this.request = new URLRequest(server); + this.request = new URLRequest(RequestTools.antiCache(server)); this.request.contentType = "application/x-www-form-urlencoded"; this.request.method = URLRequestMethod.POST; var xml:XML = action.toXml(); Index: lams_tool_mindmap/src/flash/AS/Branch.as =================================================================== diff -u -re28d61401c1f05f1b3db8068f7ad76f161e90f09 -r643162984254c265d82c6c6d5f2ff34c378e1ce4 --- lams_tool_mindmap/src/flash/AS/Branch.as (.../Branch.as) (revision e28d61401c1f05f1b3db8068f7ad76f161e90f09) +++ lams_tool_mindmap/src/flash/AS/Branch.as (.../Branch.as) (revision 643162984254c265d82c6c6d5f2ff34c378e1ce4) @@ -36,7 +36,7 @@ this.addChild(this.sons); this.applyCosmetics(); this.expandButton = new ExpandSign(); - this.expandButton.width = this.expandButton.height = 8; + this.expandButton.width = this.expandButton.height = 12; this.expandButton.addEventListener(MouseEvent.MOUSE_DOWN, this.onExpandPress); this.expanded = true; this.proper(); @@ -80,6 +80,10 @@ try{ this.sons.removeChild(branch); }catch(error:ArgumentError){}; + if(this.sonCount==0){ + this.expanded = true; + InternalConcept(this.base).checkButtons(); + } this.mindMap.conceptRemoved(InternalConcept(branch.base)); } public function getConceptById(id:int):Concept { Index: lams_tool_mindmap/src/flash/AS/Design.as =================================================================== diff -u -re28d61401c1f05f1b3db8068f7ad76f161e90f09 -r643162984254c265d82c6c6d5f2ff34c378e1ce4 --- lams_tool_mindmap/src/flash/AS/Design.as (.../Design.as) (revision e28d61401c1f05f1b3db8068f7ad76f161e90f09) +++ lams_tool_mindmap/src/flash/AS/Design.as (.../Design.as) (revision 643162984254c265d82c6c6d5f2ff34c378e1ce4) @@ -5,10 +5,12 @@ import flash.geom.*; import flash.errors.*; import flash.utils.*; + import zoomer.*; public class Design extends Sprite { + protected static var MIN_SCALE:Number = 0.4; + protected static var MAX_SCALE:Number = 2.5; protected var mindMap:MindMap; protected var frame:WhiteFrame; - protected var edgeOutline:Sprite; protected var navigationBar:Sprite; protected var navigate:Boolean; protected var moving:Boolean; @@ -17,6 +19,8 @@ protected var toolTip:ToolTip; protected var connectionIcon:ConnectionIcon; protected var ground:Sprite; + protected var zoomControl:Zoomer; + protected var zooming:Number; public function Design(mindMap:MindMap, world:Stage) { this.ground = new Sprite(); this.ground.graphics.beginFill(0,0); @@ -40,13 +44,10 @@ this.frame.addEventListener(MouseEvent.MOUSE_OVER, onNavigationHover); this.frame.addEventListener(MouseEvent.MOUSE_OUT, onNavigationOut); this.indicator = new ArrowHead(); + this.indicator.addEventListener(MouseEvent.CLICK, this.onIndicatorClick); this.navigationBar = new Sprite(); this.navigationBar.addChild(this.frame); this.navigationBar.addChild(this.indicator); - this.edgeOutline = new Sprite(); - this.edgeOutline.graphics.lineStyle(2, 0x888888); - this.edgeOutline.graphics.drawRect(0, 0, 800, 600); - this.navigationBar.addChild(this.edgeOutline); this.addChild(this.navigationBar); this.connectionIcon = new ConnectionIcon(); this.connectionIcon.y = 50; @@ -60,15 +61,56 @@ this.navigate = false; this.speedX = 0; this.speedY = 0; + this.zoomControl = new Zoomer(); + this.zoomControl.scaleX = this.zoomControl.scaleY = 28/Math.max(this.zoomControl.width, this.zoomControl.height); + this.addChild(this.zoomControl); + this.zoomControl.scaleX = this.zoomControl.scaleY = 1.3; + this.zoomControl.x = 400-this.zoomControl.width/2-this.zoomControl.getRect(this).left; + this.zoomControl.y = 600-this.zoomControl.getRect(this).bottom; + this.zoomControl.addEventListener(ZoomerEvent.ZOOM_IN, this.onStartZoomIn); + this.zoomControl.addEventListener(ZoomerEvent.ZOOM_OUT, this.onStartZoomOut); + this.zoomControl.addEventListener(ZoomerEvent.STOP_ZOOMING, this.onEndZooming); + this.zooming = 0; this.addEventListener(Event.ENTER_FRAME, onFrame); world.addChild(this); this.mindMap.addEventListener(InformationEvent.INFORMATION, onGetInfo); this.mindMap.addEventListener(InformationEvent.NO_INFORMATION, onNoInfo); try{ ExternalInterface.addCallback("getMindmap", this.toString); }catch(error:Error){ + } } + protected function indicate():void { + this.indicator.visible = true; + var dx:Number, dy:Number; + var tg:Number = (this.frame.width/2-this.mindMap.x)/(this.frame.height/2-this.mindMap.y); + if(Math.abs(tg) <= this.frame.width/this.frame.height){ + dy = this.frame.height/2 * (this.mindMap.y>this.frame.height/2?1:-1); + dx = tg*dy; + }else{ + dx = this.frame.width/2 * (this.mindMap.x>this.frame.width/2?1:-1); + if(tg == Number.POSITIVE_INFINITY){ + dy = 0; + }else dy = dx/tg; + } + var px:Number, py:Number; + px = this.frame.width/2+dx; + py = this.frame.height/2+dy; + var distance:Number = Point.distance(new Point(this.mindMap.x, this.mindMap.y), new Point(px, py)); + this.indicator.alpha = distance/500; + var ax:Number, ay:Number; + if(this.frame.height/2 != py){ + ay = 20*(this.frame.height/2-py)/Math.sqrt(Math.pow(this.frame.height/2-py,2)+Math.pow(this.frame.width/2-px,2)) + py; + ax = (ay-py)*(this.frame.width/2-px)/(this.frame.height/2-py)+px; + }else{ + ay = py; + ax = px+20*(pxthis.frame.width || this.mindMap.y<0 || this.mindMap.y>this.frame.height){ - this.indicator.visible = true; - var dx:Number, dy:Number; - var tg:Number = (this.frame.width/2-this.mindMap.x)/(this.frame.height/2-this.mindMap.y); - if(Math.abs(tg) <= this.frame.width/this.frame.height){ - dy = this.frame.height/2 * (this.mindMap.y>this.frame.height/2?1:-1); - dx = tg*dy; - }else{ - dx = this.frame.width/2 * (this.mindMap.x>this.frame.width/2?1:-1); - if(tg == Number.POSITIVE_INFINITY){ - dy = 0; - }else dy = dx/tg; - } - var px:Number, py:Number; - px = this.frame.width/2+dx; - py = this.frame.height/2+dy; - var distance:Number = Point.distance(new Point(this.mindMap.x, this.mindMap.y), new Point(px, py)); - this.indicator.alpha = distance/500; - var ax:Number, ay:Number; - if(this.frame.height/2 != py){ - ay = 20*(this.frame.height/2-py)/Math.sqrt(Math.pow(this.frame.height/2-py,2)+Math.pow(this.frame.width/2-px,2)) + py; - ax = (ay-py)*(this.frame.width/2-px)/(this.frame.height/2-py)+px; - }else{ - ay = py; - ax = px+20*(pxthis.frame.width || this.mindMap.y<0 || this.mindMap.y>this.frame.height){ + this.indicate(); }else{ - this.edgeOutline.visible = false; + this.indicator.visible = false; } } + protected function onIndicatorClick(event:MouseEvent):void { + this.mindMap.x = 400; + this.mindMap.y = 300; + } protected function onPressGround(event:MouseEvent):void { this.mindMap.startDrag(); } @@ -197,6 +215,15 @@ protected function onLeaveGround(event:MouseEvent):void { this.mindMap.stopDrag(); } + protected function onStartZoomIn(event:ZoomerEvent):void { + this.zooming = 1; + } + protected function onStartZoomOut(event:ZoomerEvent):void { + this.zooming = -1; + } + protected function onEndZooming(event:ZoomerEvent):void { + this.zooming = 0; + } protected function onWinServerResponse(event:ServerMindMapEvent):void { this.connectionIcon.incoming = true; } Index: lams_tool_mindmap/src/flash/AS/InternalConcept.as =================================================================== diff -u -re28d61401c1f05f1b3db8068f7ad76f161e90f09 -r643162984254c265d82c6c6d5f2ff34c378e1ce4 --- lams_tool_mindmap/src/flash/AS/InternalConcept.as (.../InternalConcept.as) (revision e28d61401c1f05f1b3db8068f7ad76f161e90f09) +++ lams_tool_mindmap/src/flash/AS/InternalConcept.as (.../InternalConcept.as) (revision 643162984254c265d82c6c6d5f2ff34c378e1ce4) @@ -35,6 +35,9 @@ public function InternalConcept(word:String, color:int, free:Boolean, owned:Boolean, player:String, id:int){ super(word, color, free, owned, player, id); } + public function checkButtons():void { + this.placeButtons(); + } override protected function createTextFormat():TextFormat { var textFormat:TextFormat = super.createTextFormat(); textFormat.size = 16; Index: lams_tool_mindmap/src/flash/AS/MultiPlayer.as =================================================================== diff -u -re28d61401c1f05f1b3db8068f7ad76f161e90f09 -r643162984254c265d82c6c6d5f2ff34c378e1ce4 --- lams_tool_mindmap/src/flash/AS/MultiPlayer.as (.../MultiPlayer.as) (revision e28d61401c1f05f1b3db8068f7ad76f161e90f09) +++ lams_tool_mindmap/src/flash/AS/MultiPlayer.as (.../MultiPlayer.as) (revision 643162984254c265d82c6c6d5f2ff34c378e1ce4) @@ -3,6 +3,7 @@ import flash.events.*; import flash.net.*; import flash.external.*; + import flash.text.*; import org.lamsfoundation.lams.common.dictionary.*; public class MultiPlayer extends MovieClip{ protected var xmlLabels:XML; @@ -12,7 +13,7 @@ if (this.loaderInfo.parameters.dictionary == undefined) { request = new URLRequest("dictionary.xml"); }else{ - request = new URLRequest(this.loaderInfo.parameters.dictionary); + request = new URLRequest(RequestTools.antiCache(this.loaderInfo.parameters.dictionary)); } var labelsLoader:URLLoader = new URLLoader(request); labelsLoader.addEventListener(Event.COMPLETE, this.onLabelsLoad); @@ -23,7 +24,7 @@ if (this.loaderInfo.parameters.xml == undefined) { request = new URLRequest("tree.xml"); }else{ - request = new URLRequest(this.loaderInfo.parameters.xml); + request = new URLRequest(RequestTools.antiCache(this.loaderInfo.parameters.xml)); } var treeLoader:URLLoader = new URLLoader(request); treeLoader.addEventListener(Event.COMPLETE, this.onTreeLoad); Index: lams_tool_mindmap/src/flash/AS/RequestTools.as =================================================================== diff -u --- lams_tool_mindmap/src/flash/AS/RequestTools.as (revision 0) +++ lams_tool_mindmap/src/flash/AS/RequestTools.as (revision 643162984254c265d82c6c6d5f2ff34c378e1ce4) @@ -0,0 +1,10 @@ +package { + public class RequestTools { + static public function continueURL(url:String):String { + return url.indexOf('?')==-1?url+"?":url+"&"; + } + static public function antiCache(url:String):String { + return continueURL(url)+("noCache="+(new Date()).time)+Math.floor(Math.random()*100); + } + } +} \ No newline at end of file Index: lams_tool_mindmap/src/flash/AS/ServerMindMap.as =================================================================== diff -u -re28d61401c1f05f1b3db8068f7ad76f161e90f09 -r643162984254c265d82c6c6d5f2ff34c378e1ce4 --- lams_tool_mindmap/src/flash/AS/ServerMindMap.as (.../ServerMindMap.as) (revision e28d61401c1f05f1b3db8068f7ad76f161e90f09) +++ lams_tool_mindmap/src/flash/AS/ServerMindMap.as (.../ServerMindMap.as) (revision 643162984254c265d82c6c6d5f2ff34c378e1ce4) @@ -17,8 +17,8 @@ super(new BaseConcept("", 0, false, false, "", -1), player, dictionary); this.fromXml(originalXml, false); this.loaders = new Array(); - this.pollServer = pollServer.indexOf('?')==-1?pollServer+"?":pollServer+"&"; - this.notifyServer = notifyServer; + this.pollServer = pollServer; + this.notifyServer = RequestTools.continueURL(notifyServer)+"lastActionId="+actionId; this.id = id; this.lastActionId = actionId; this.nextLocalId = 0; @@ -31,7 +31,7 @@ } protected function requestActions():void { this.pollTimer.reset(); - var request:URLRequest = new URLRequest(this.pollServer); + var request:URLRequest = new URLRequest(RequestTools.continueURL(RequestTools.antiCache(this.pollServer))); request.method = URLRequestMethod.GET; var urlVariables:URLVariables = new URLVariables("lastActionID="+this.lastActionId); request.data = urlVariables; Index: lams_tool_mindmap/src/flash/AS/SinglePlayer.as =================================================================== diff -u -re28d61401c1f05f1b3db8068f7ad76f161e90f09 -r643162984254c265d82c6c6d5f2ff34c378e1ce4 --- lams_tool_mindmap/src/flash/AS/SinglePlayer.as (.../SinglePlayer.as) (revision e28d61401c1f05f1b3db8068f7ad76f161e90f09) +++ lams_tool_mindmap/src/flash/AS/SinglePlayer.as (.../SinglePlayer.as) (revision 643162984254c265d82c6c6d5f2ff34c378e1ce4) @@ -16,7 +16,7 @@ if (this.loaderInfo.parameters.dictionary == undefined) { request = new URLRequest("dictionary.xml"); }else{ - request = new URLRequest(this.loaderInfo.parameters.dictionary); + request = new URLRequest(RequestTools.antiCache(this.loaderInfo.parameters.dictionary)); } var labelsLoader:URLLoader = new URLLoader(request); labelsLoader.addEventListener(Event.COMPLETE, this.onLabelsLoad); @@ -30,7 +30,7 @@ if (this.loaderInfo.parameters.xml == undefined) { request = new URLRequest("stree.xml"); } else { - request = new URLRequest(this.loaderInfo.parameters.xml); + request = new URLRequest(RequestTools.antiCache(this.loaderInfo.parameters.xml)); } var treeLoader:URLLoader = new URLLoader(request); treeLoader.addEventListener(Event.COMPLETE, this.onTreeLoad); Index: lams_tool_mindmap/src/flash/AS/zoomer/Zoomer.as =================================================================== diff -u --- lams_tool_mindmap/src/flash/AS/zoomer/Zoomer.as (revision 0) +++ lams_tool_mindmap/src/flash/AS/zoomer/Zoomer.as (revision 643162984254c265d82c6c6d5f2ff34c378e1ce4) @@ -0,0 +1,62 @@ +package zoomer{ + import flash.display.*; + import flash.events.*; + import flash.geom.*; + public class Zoomer extends MovieClip { + protected static var ACTIVE_FRAME:int; + protected static var IDLE_FRAME:int; + protected function set idle(value:Boolean) { + if(value){ + if(this.currentFrame!=IDLE_FRAME){ + if(this.currentFrame < ACTIVE_FRAME){ + if(this.currentFrame == IDLE_FRAME+1) this.gotoAndStop("IDLE_FRAME"); + else this.gotoAndPlay(this.totalFrames+2 -(this.currentFrame-IDLE_FRAME)); + }else{ + this.play(); + } + }else{ + this.stop(); + } + }else{ + if(this.currentFrame!=ACTIVE_FRAME){ + if(this.currentFrame > ACTIVE_FRAME){ + if(this.currentFrame == ACTIVE_FRAME+1) this.gotoAndStop("ACTIVE_FRAME"); + else this.gotoAndPlay(ACTIVE_FRAME+1 -(this.currentFrame-ACTIVE_FRAME)); + }else{ + this.play(); + } + }else{ + this.stop(); + } + } + } + public function Zoomer(){ + var i:int; + for(i=0;i