add panning with the shift key

This commit is contained in:
Jeremy Penner 2011-02-01 08:47:02 -08:00
parent 340de859d1
commit 30c2f7fae9

View file

@ -34,7 +34,7 @@ package
public static const LAYER_MSG: int = 70; public static const LAYER_MSG: int = 70;
private var imgdir: Imgdir; private var imgdir: Imgdir;
private var drag: Drag; private var dragView: Drag;
private var urff: String; private var urff: String;
private var rgurpd: Array; private var rgurpd: Array;
private var alarmImgdir: Tween; private var alarmImgdir: Tween;
@ -68,7 +68,7 @@ package
zoom = 1; zoom = 1;
pointView = new Point(0, 0); pointView = new Point(0, 0);
drag = null; dragView = null;
Chdir(null); Chdir(null);
ToggleUI(); ToggleUI();
Load(); Load();
@ -173,7 +173,18 @@ package
override public function update():void override public function update():void
{ {
var dyFactory:int = 0; var dyFactory:int = 0;
if (Input.mouseUp && dragView !== null)
{
trace("drag done");
dragView.Done();
dragView = null;
}
if (Input.mousePressed) if (Input.mousePressed)
{
if (Input.check(Key.SHIFT))
dragView = Drag.Claim();
else
{ {
var rgtok: Array = []; var rgtok: Array = [];
getLayer(LAYER_TOKENS, rgtok); getLayer(LAYER_TOKENS, rgtok);
@ -190,6 +201,12 @@ package
} }
trace("clicked on " + tokSelected); trace("clicked on " + tokSelected);
} }
}
if (dragView !== null)
{
pointView = pointView.subtract(dragView.Delta(zoom));
dragView.Update();
}
if (Input.pressed(Key.TAB)) if (Input.pressed(Key.TAB))
ToggleUI(); ToggleUI();
if (Input.mouseWheel) if (Input.mouseWheel)