add panning with the shift key
This commit is contained in:
parent
340de859d1
commit
30c2f7fae9
|
@ -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,22 +173,39 @@ 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)
|
||||||
{
|
{
|
||||||
var rgtok: Array = [];
|
if (Input.check(Key.SHIFT))
|
||||||
getLayer(LAYER_TOKENS, rgtok);
|
dragView = Drag.Claim();
|
||||||
tokSelected = null;
|
else
|
||||||
// getLayer returns tokens in draw order, which means furthest back first
|
|
||||||
for (var itok:int = rgtok.length - 1; itok >= 0; itok --)
|
|
||||||
{
|
{
|
||||||
var tok: Token = rgtok[itok];
|
var rgtok: Array = [];
|
||||||
if (tok.collidePoint(tok.x, tok.y, Input.mouseX, Input.mouseY))
|
getLayer(LAYER_TOKENS, rgtok);
|
||||||
|
tokSelected = null;
|
||||||
|
// getLayer returns tokens in draw order, which means furthest back first
|
||||||
|
for (var itok:int = rgtok.length - 1; itok >= 0; itok --)
|
||||||
{
|
{
|
||||||
tokSelected = tok;
|
var tok: Token = rgtok[itok];
|
||||||
break;
|
if (tok.collidePoint(tok.x, tok.y, Input.mouseX, Input.mouseY))
|
||||||
|
{
|
||||||
|
tokSelected = tok;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
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();
|
||||||
|
|
Loading…
Reference in a new issue