|
Revision 2485, 0.8 kB
(checked in by gyuque, 5 years ago)
|
|
lang/actionscript/swfgmap: implemented spreading.
|
| Line | |
|---|
| 1 | package gyuque.gmap
|
|---|
| 2 | {
|
|---|
| 3 | public class LayerManager extends Layer
|
|---|
| 4 | {
|
|---|
| 5 | import flash.display.*;
|
|---|
| 6 | import flash.geom.Matrix;
|
|---|
| 7 |
|
|---|
| 8 | private var mLayers:Array = new Array();
|
|---|
| 9 |
|
|---|
| 10 | public function LayerManager(c:DisplayObjectContainer)
|
|---|
| 11 | {
|
|---|
| 12 | super(c);
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | public function push(lyr:Layer):void
|
|---|
| 16 | {
|
|---|
| 17 | mLayers.push(lyr);
|
|---|
| 18 | addChild(lyr);
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | protected override function updateContent(refreshAll:Boolean):void
|
|---|
| 22 | {
|
|---|
| 23 | var v:GMapViewport = mViewport;
|
|---|
| 24 |
|
|---|
| 25 | var M:Matrix = v.to_screen_transform;
|
|---|
| 26 | M.tx = transform.matrix.tx;
|
|---|
| 27 | M.ty = transform.matrix.ty;
|
|---|
| 28 |
|
|---|
| 29 | if (refreshAll)
|
|---|
| 30 | {
|
|---|
| 31 | M.tx = v.width * 0.5;
|
|---|
| 32 | M.ty = v.height * 0.5;
|
|---|
| 33 | }
|
|---|
| 34 | else
|
|---|
| 35 | {
|
|---|
| 36 | M.tx += mLastDX;
|
|---|
| 37 | M.ty += mLastDY;
|
|---|
| 38 | }
|
|---|
| 39 | transform.matrix = M;
|
|---|
| 40 | }
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|