public override void Execute() { _selectLayer.RestoreTileSelection(_selection); _selectLayer.FloatSelection(); Rectangle bounds = _selectLayer.TileSelection.Bounds; TileCoord offset = new TileCoord(_centerOffset.X - bounds.Center.X, _centerOffset.Y - bounds.Center.Y); _selectLayer.SetSelectionOffset(offset); }
private void UpdateMoveCommon(PointerEventInfo info, ILevelGeometry viewport) { int diffx = (int)info.X - _initialLocation.X; int diffy = (int)info.Y - _initialLocation.Y; if (diffx == 0 && diffy == 0) { return; } int tileDiffX = _initialOffset.X + (int)Math.Floor((double)diffx / Layer.TileWidth); int tileDiffY = _initialOffset.Y + (int)Math.Floor((double)diffy / Layer.TileHeight); _selectLayer.SetSelectionOffset(new TileCoord(tileDiffX, tileDiffY)); }