Changeset 6900
- Timestamp:
- 02/19/08 03:33:37 (5 years ago)
- Location:
- lang/actionscript/metro-map/mkmap
- Files:
-
- 1 added
- 3 modified
-
AnchorButton.as (modified) (2 diffs)
-
MCanvas.as (modified) (5 diffs)
-
PolyLine.as (modified) (5 diffs)
-
TipBox.as (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/actionscript/metro-map/mkmap/AnchorButton.as
r6839 r6900 13 13 private var mSegBack:Segment; 14 14 private var mSegMid:Segment; 15 16 private var mCanvas:MCanvas; 15 17 16 18 function AnchorButton(weak:Boolean) … … 31 33 mHitSprite = DragAnchorUtil.makeHitPanel(100); 32 34 addChild(mHitSprite); 35 } 36 37 public function set ownerCanvas(c:MCanvas):void 38 { 39 mCanvas = c; 33 40 } 34 41 -
lang/actionscript/metro-map/mkmap/MCanvas.as
r6871 r6900 14 14 private var mLayers:Array; 15 15 private var mLayerDatas:Array; 16 private var mLineTipBox:TipBox; 17 private var mLineTipBox2:TipBox; 16 18 17 19 function MCanvas(w:int, h:int) … … 19 21 mTitleBoxCtl = new MTitleBoxController(this); 20 22 createLayers(); 23 mLineTipBox = new TipBox(64, 20); 24 mLineTipBox2 = new TipBox(64, 20); 25 addChild(mLineTipBox); 26 addChild(mLineTipBox2); 21 27 22 28 mWidth = w; … … 88 94 } 89 95 96 public function showLineTip(x:int, y:int, msg:String, index:int):void 97 { 98 var t:TipBox = (index==0) ? mLineTipBox : mLineTipBox2; 99 100 t.show(); 101 t.x = x - 32; 102 t.y = y - 10; 103 104 t.text = msg; 105 } 106 90 107 private function deserializeLayer(lyr_elem:XML, idx:int):void 91 108 { … … 135 152 s.y2 = xy[1]; 136 153 137 p.lineColor = hexcolor;138 154 s.updateAnchors(); 139 155 … … 143 159 { 144 160 xy = splitXY(coords[i]); 161 s = p.divideSegmentAt(xy[0], xy[1], s); 145 162 } 146 163 } 164 165 p.lineColor = hexcolor; 147 166 } 148 167 -
lang/actionscript/metro-map/mkmap/PolyLine.as
r6871 r6900 54 54 tb.onMoved = onAnchorMove; 55 55 mb.onMoved = onAnchorMove; 56 57 hb.ownerCanvas = mCanvas; 58 tb.ownerCanvas = mCanvas; 59 mb.ownerCanvas = mCanvas; 56 60 57 61 updateView(); … … 118 122 } 119 123 124 private function makeRatioString(x:int, y:int):String 125 { 126 if (x == 0 && y == 0) 127 return "0 : 0"; 128 129 if (x<0) x = -x; 130 if (y<0) y = -y; 131 132 if (x < y) 133 return "60 : " + int(Number(x)/Number(y) * 60.0).toString(); 134 135 return int(Number(y)/Number(x) * 60.0).toString() + " : 60"; 136 } 137 138 private function showLineInfo(seg1:Segment, seg2:Segment):void 139 { 140 var x:int; 141 var y:int; 142 143 if (seg1) 144 { 145 mid_point(seg1.x2, seg1.y2, seg1.x1, seg1.y1, 20, _tmpPt1); 146 mCanvas.showLineTip(_tmpPt1.x, _tmpPt1.y, makeRatioString(seg1.x1-seg1.x2, seg1.y1-seg1.y2), 0); 147 } 148 149 if (seg2) 150 { 151 mid_point(seg2.x1, seg2.y1, seg2.x2, seg2.y2, 20, _tmpPt1); 152 mCanvas.showLineTip(_tmpPt1.x, _tmpPt1.y, makeRatioString(seg2.x2-seg2.x1, seg2.y2-seg2.y1), 1); 153 } 154 155 } 156 120 157 private function onAnchorMove(anc:AnchorButton, e:MouseEvent):void 121 158 { … … 157 194 } 158 195 159 p rivatefunction divideSegmentAt(x:int, y:int, s:Segment):Segment196 public function divideSegmentAt(x:int, y:int, s:Segment):Segment 160 197 { 161 198 var oldNext:Segment = s.next; … … 164 201 var tb:AnchorButton = new AnchorButton(false); 165 202 var mb:AnchorButton = new AnchorButton(true); 203 204 tb.ownerCanvas = mCanvas; 205 mb.ownerCanvas = mCanvas; 206 166 207 addChild(tb); 167 208 addChild(mb); … … 286 327 private function moveEndAnchor(seg1:Segment, seg2:Segment, x:int, y:int):void 287 328 { 329 showLineInfo(seg1, seg2); 330 288 331 if (seg1 != null) 289 332 {
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)